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

Validation fails for repeated parameters #41

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Find a method which takes repeated validated parameters (e.g. 
adsense.reports.generate)
2. Provide an array of valid values for that parameter

Example:
$client.execute('adsense.reports.generate', {'endDate' => '2010-01-01', 
'startDate' => '2012-01-01', 'dimension' => ['MONTH', 'DATE'], 'metric' => 
['PAGE_VIEWS', 'CLICKS']})

What is the expected output? What do you see instead?
Expected: successful method call.
Instead: validation fails, because the array as a whole is being validated, 
instead of each value individually.

Example:
ArgumentError: Parameter 'dimension' has an invalid value: MONTHDATE. Must 
match: /^[a-zA-Z_]+$/.
        from /usr/local/google/home/sgomes/git/google-api-ruby-client/lib/google/api_client/discovery/method.rb:318:in `validate_parameters'
        from /usr/local/google/home/sgomes/git/google-api-ruby-client/lib/google/api_client/discovery/method.rb:306:in `each'
        from /usr/local/google/home/sgomes/git/google-api-ruby-client/lib/google/api_client/discovery/method.rb:306:in `validate_parameters'
        from /usr/local/google/home/sgomes/git/google-api-ruby-client/lib/google/api_client/discovery/method.rb:177:in `generate_uri'
        from /usr/local/google/home/sgomes/git/google-api-ruby-client/lib/google/api_client/discovery/method.rb:227:in `generate_request'
        from /usr/local/google/home/sgomes/git/google-api-ruby-client/lib/google/api_client/reference.rb:234:in `to_request'
        from /usr/local/google/home/sgomes/git/google-api-ruby-client/lib/google/api_client.rb:560:in `generate_request'
        from /usr/local/google/home/sgomes/git/google-api-ruby-client/lib/google/api_client.rb:707:in `execute'
        from (irb):2

What version of the product are you using? On what operating system?
Current revision (5626cb4a6e01), on Ruby 1.8.7, on Linux 2.6.38.8

Please provide any additional information below.
Working on a fix.

Original issue reported on code.google.com by sergio.gomes%google.com@gtempaccount.com on 27 Apr 2012 at 2:11

GoogleCodeExporter commented 9 years ago
Submitted patch for review: http://codereview.appspot.com/6133045/

Original comment by sergio.gomes%google.com@gtempaccount.com on 27 Apr 2012 at 3:53

GoogleCodeExporter commented 9 years ago
This issue has been fixed, please close.

Original comment by sergio.gomes%google.com@gtempaccount.com on 16 May 2012 at 2:40

GoogleCodeExporter commented 9 years ago

Original comment by sgo...@google.com on 18 May 2012 at 12:37