ip2k / google-api-ruby-client

Automatically exported from code.google.com/p/google-api-ruby-client
Apache License 2.0
0 stars 0 forks source link

analytics looks for wrong version #39

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
require 'google/api_client'

@client = Google::APIClient.new
@client.authorization.client_id     = 'xxxx'
@client.authorization.client_secret = 'xxxx'
@client.authorization.redirect_uri  = 'xxx'
# @client.authorization.code          = params[:code] if params[:code]
@analytics = @client.discovered_api('analytics')

What is the expected output? What do you see instead?

/home/ray/.rvm/gems/ruby-1.9.3-p125/gems/google-api-client-0.4.2/lib/google/api_
client.rb:305:in `discovery_document': Could not retrieve discovery document 
at: https://www.googleapis.com/discovery/v1/apis/analytics/v1/rest 
(Google::APIClient::ClientError)
    from /home/ray/.rvm/gems/ruby-1.9.3-p125/gems/google-api-client-0.4.2/lib/google/api_client.rb:347:in `discovered_api'
    from import.rb:13:in `<main>'

It's looking for v1 of the analytics API but the discovery document only lists 
v3 and v2.4.

What version of the product are you using? On what operating system?

0.4.2, ruby 1.9.3-p125 on CentOS 5.7

Please provide any additional information below.

Original issue reported on code.google.com by JimmyBla...@gmail.com on 2 Mar 2012 at 1:42

GoogleCodeExporter commented 9 years ago
You need to manually specify a version in this situation. So:

@analytics = @client.discovered_api('analytics', 'v3')

Original comment by bobaman@google.com on 2 Mar 2012 at 2:33