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

Booleans like containsSampledData are incorrectly supported in ruby #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Do a "data.ga.get" query (Core Reporting API for Google Analytics report 
data) which doesn't contain sampled data
2. Try to look at value of containsSampledData

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

Expected output is false
Instead following exceptions is returned:
.rvm/gems/ruby-1.9.2-p320/gems/autoparse-0.3.1/lib/autoparse.rb:248:in 
`import_boolean': Expected boolean, got NilClass. (TypeError)
        from .rvm/gems/ruby-1.9.2-p320/gems/autoparse-0.3.1/lib/autoparse.rb:151:in `import'
        from .rvm/gems/ruby-1.9.2-p320/gems/autoparse-0.3.1/lib/autoparse/instance.rb:346:in `__get__'
        from .rvm/gems/ruby-1.9.2-p320/gems/autoparse-0.3.1/lib/autoparse.rb:129:in `block (2 levels) in generate'

What version of the product are you using? On what operating system?
google-api-client (0.4.3)
autoparse (0.3.1)
ruby 1.9.2 p320
Linux, Debian Lenny

Please provide any additional information below.

The problem is apparently in following line:
value = @data[property_key] || schema_class.data['default']
(In the __get__ function as mentioned in exception)
The @data[property_key] is false, which is correct.
The schema_class.data['default'] is nil.
Function AutoParse.import, called on next line, expect false and not nil.

Can be solved by replacing the line with following two:
value = @data[property_key]
value = schema_class.data['default'] if(value === nil)

Original issue reported on code.google.com by adwo...@ipdgroup.com on 5 Jun 2012 at 5:17

GoogleCodeExporter commented 9 years ago
Crossreported as http://code.google.com/p/ruby-autoparse/issues/detail?id=1 ...

Original comment by adwo...@ipdgroup.com on 5 Jun 2012 at 5:27

GoogleCodeExporter commented 9 years ago

Original comment by bobaman@google.com on 15 Jun 2012 at 9:23

GoogleCodeExporter commented 9 years ago

Original comment by bobaman@google.com on 23 Jul 2012 at 7:35

GoogleCodeExporter commented 9 years ago
Fixed in af967f7.

Original comment by bobaman@google.com on 31 Jul 2012 at 1:38