Closed GoogleCodeExporter closed 9 years ago
Original comment by bobaman@google.com
on 15 Jun 2012 at 9:22
i agree 10000%.
Using the examples in the README, lead me to the code, which lead me to adding
`pry`, which lead me to an error in Google::APIClient::Method line 107 (108
after i added pry).
Basically reading the comments in deep google , i understood you needed to do
something like this:
~ bundle exec google-api irb oauth-2-login
--scope='https://www.googleapis.com/auth/analytics.readonly'
--client-id='blahaddyoursehere.apps.googleusercontent.com'
--client-secret='secret-codedstuff'
1.9.3p125 :001 > blah = $client.discovered_api("analytics", "v3")
=> #<Google::APIClient::API:0x3fd009016a6c ID:analytics:v3>
1.9.3p125 :002 > method = Google::APIClient::Method.new(blah.name,
blah.method_base.to_s, "analytics.data.ga.get",
$client.discovery_document("analytics", "v3"))
=> #<Google::APIClient::Method:0x3fd009025aa8 ID:analytics:v3>
1.9.3p125 :003 > $client.execute(method, {})
NoMethodError: undefined method `join' for
#<Google::APIClient::Method:0x3fd009025aa8 ID:analytics:v3>
See, just doing $client.execute('analytics.data.ga.get', {}) returned nothing
but errors, that led me to this current error that I think line 107 is wrong...
maybe you meant URI::Template.join
Original comment by phi...@ingraminternet.com
on 26 Jun 2012 at 10:51
Original comment by bobaman@google.com
on 23 Jul 2012 at 7:37
Original comment by bobaman@google.com
on 23 Jul 2012 at 7:38
AFAIK, service accounts aren't supported with analytics API. Will add analytics
sample and a service accounts sample, but won't be in the same one. Service
accounts is currently limited to APIs like storage & prediction.
Original comment by sba...@google.com
on 23 Jul 2012 at 9:44
As a stopgap until formal documentation shows up, here's a quick blog post I
wrote up for using SA auth with Google analytics:
Working example code:
http://ominian.com/2012/07/12/service-accounts-with-ruby-and-the-google-api-clie
nt/
And a complete Gist file here https://gist.github.com/3166610
It's a little slow, but it does work. I would use the Analytics explorer tool
here http://ga-dev-tools.appspot.com/explorer/ to build your queries and then
go from there.
Original comment by ward.dav...@gmail.com
on 23 Jul 2012 at 10:23
Ah, inviting the service account through analytics works for auth :)
Original comment by sba...@google.com
on 23 Jul 2012 at 10:55
Hehe, that's actually pretty clever.
Original comment by bobaman@google.com
on 24 Jul 2012 at 12:29
Added to the samples repository.
Original comment by sba...@google.com
on 24 Jul 2012 at 9:56
Might want to mention in the sample to add the SA email address to the desired
Google analytics profile to allow for access.
Original comment by ward.dav...@gmail.com
on 25 Jul 2012 at 4:32
Original issue reported on code.google.com by
Winderme...@gmail.com
on 15 Jun 2012 at 12:16