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

adsense.reports.generate is not allowing multiple values for metric attributes #69

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. authenticate via oauth 2
2. use v1.2 (adsense.reports.generate)
3. put multiple elements in array for metric attribute

What is the expected output? What do you see instead?
i expect all the metric attributes to appear with data,

instead i see no data at all, here's an example
when i put 
'metric' => %w(CLICKS EARNINGS),

i get the following

"{\"kind\":\"adsense#report\",\"totalMatchedRows\":\"0\",\"headers\":[{\"name\":
\"CUSTOM_CHANNEL_ID\",\"type\":\"DIMENSION\"}],\"totals\":[\"\"],\"averages\":[\
"\"]}"

if i use only 1 element in metric, it works, for instance,
'metric' => %w(CLICKS),

i get the following

"{\"kind\":\"adsense#report\",\"totalMatchedRows\":\"2\",\"headers\":[{\"name\":
\"CUSTOM_CHANNEL_ID\",\"type\":\"DIMENSION\"},{\"name\":\"CLICKS\",\"type\":\"ME
TRIC_TALLY\"}],\"rows\":[[\"partner-pub-2227041865223506:1000000001\",\"112\"],[
\"partner-pub-2227041865223506:1000000002\",\"89\"]],\"totals\":[\"\",\"201\"],\
"averages\":[\"\",\"100\"]}"

What version of the product are you using? On what operating system?
im running on Centos 6, using  gem 'google-api-client'

Please provide any additional information below.

Original issue reported on code.google.com by michael...@gmail.com on 8 Nov 2012 at 3:36

GoogleCodeExporter commented 9 years ago
Likely caused by an issue with how Faraday encodes query parameters 
(https://github.com/technoweenie/faraday/issues/182.)  A fix to Faraday was 
committed, but still waiting for them to cut a new gem with it included. Will 
verify once it is available.

Original comment by sba...@google.com on 12 Nov 2012 at 7:23

GoogleCodeExporter commented 9 years ago
Thanks

Original comment by michael...@gmail.com on 13 Nov 2012 at 5:11

GoogleCodeExporter commented 9 years ago
We've had to fork Faraday to get this working for us. With the new Faraday, you 
can use:

Faraday::Utils.default_params_encoder = Faraday::FlatParamsEncoder

to specify a parameter encoder that doesn't try to treat multiple occurrences 
of the same param as nested params and insert []. This required hacking the 
version number back to 0.8.x as both google-api-client and signet specifically 
depend on ~> 0.8.4 and ~> 0.8.1 respectively.

However, when the new Faraday is cut, if both of those other gems are updated 
to use Faraday 0.9.x, that line is all that's required to get things working.

Original comment by simoneau.louis on 9 Jan 2013 at 8:49

GoogleCodeExporter commented 9 years ago
The new FlatParamsEncoder does indeed fix reports.

However, when Faraday 0.9 is released this option should be set at the 
APIClient level, that is, not changing the default behavior of Faraday.

Original comment by damian.j...@gmail.com on 8 Apr 2013 at 5:34

GoogleCodeExporter commented 9 years ago
Please see https://github.com/google/google-api-ruby-client/issues/35 for 
further updates

Original comment by sba...@google.com on 8 Apr 2013 at 8:39

GoogleCodeExporter commented 9 years ago
Oh! It's great to know you guys use GitHub. :)

Original comment by damian.j...@gmail.com on 8 Apr 2013 at 10:22