How do I access Google API methods that include siteURL with the ruby client?

190 views Asked by At

I'm trying to access the Google Webmaster Tools API with the ruby client:

webmaster_tools_api = client.discovered_api('webmasters', 'v3') 

                  result = client.execute(
                    :api_method  => webmaster_tools_api.sites.example.com.urlCrawlErrorsCounts.query,

                   )

The API method I am trying to access uses the siteurl in the method name. This won't work because the syntax conflicts.

Is there a way to access API method names that include URLs?

1

There are 1 answers

1
Dave Slutzkin On BEST ANSWER
results = client.execute(
  api_method: webmaster_tools_api.urlcrawlerrorscounts.query,
  parameters: { 'siteUrl' => 'example.com' }
)

(Google's API docs are terrible so it's not surprising you couldn't find this.)