How to find all the methods available using the 'google/api_client' for ruby?

27 views
Skip to first unread message

Richard Burton

unread,
Aug 10, 2012, 6:05:49 AM8/10/12
to adsen...@googlegroups.com
Hi Sergio,

The answer you provided on Stack Overflow was incredibly helpful:


All I had to do was modify this section:

  call = {
   
:api_method => @adsense.reports.generate,
   
:parameters => {
     
'startDate' => '2011-01-01',
     
'endDate' => '2011-08-31',
     
'dimension' => ['MONTH', 'CUSTOM_CHANNEL_NAME'],
     
'metric' => ['EARNINGS', 'TOTAL_EARNINGS']
   
}
 
}
  call = {
   
:api_method => @adsense.reports.generate,
   
:parameters => {
     
'startDate' => '2011-01-01',
     
'endDate' => '2011-08-31',
     
'dimension' => ['MONTH'],
     
'metric' => ['EARNINGS']
   
}
 
}
That returned lots of helpful data. What is the best way for me to find out about all the other methods available when querying AdSense? Should I dig through the 'google/api_client' gem?

I want to reconcile what I have read here: https://developers.google.com/adsense/management/v1.1/reference/index with the ruby methods I need to use. I also want to understand all the metrics and dimensions available and how they interact. 

Any guidance would be much-appreciated.

Thanks,

Richard

Richard Burton

unread,
Aug 10, 2012, 6:12:28 AM8/10/12
to adsen...@googlegroups.com
I have tried using the logic outlined here: https://github.com/google/google-api-ruby-client
# Discover available methods
method_names = client.discovered_api('plus').to_h.keys
However, I can't seem to get it to return the list of methods.

Richard Burton

unread,
Aug 10, 2012, 7:31:21 AM8/10/12
to adsen...@googlegroups.com

Sérgio Gomes

unread,
Aug 15, 2012, 7:02:33 AM8/15/12
to adsen...@googlegroups.com
Hi Richard,

Sorry for the late reply, I was away on vacation :)

The client library generates the classes on the fly, so you may be unable to get the keys, as you were describing. The documentation link you mentioned is indeed the canonical resource for the API.

Let me know if you have any other questions!

Cheers,
Sérgio

---
Sérgio Gomes
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


---
Reply all
Reply to author
Forward
0 new messages