From 6692b24fa9914b9e6a9b16c6d3c6fd8c723d4330 Mon Sep 17 00:00:00 2001 From: John Drago Date: Wed, 17 Feb 2016 10:32:38 -0800 Subject: [PATCH 1/7] Update 'samples' link to 'samples' folder The original samples link pointed to the (now) out of date examples for version 0.8 of this gem. I lost a few hours wondering why things were not working. Hoping to save someone else the time I lost (and reap the karmic bounty thereof). --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a9b5af95f..f3fa5b32f 100644 --- a/README.md +++ b/README.md @@ -220,8 +220,8 @@ Samples for versions 0.9 and onward can be found in the `samples` directory. Contributions for additional samples are welcome. See [CONTRIBUTING](CONTRIBUTING.md). Samples for previous versions can be found in the -[google-api-ruby-client-samples](https://github.com/google/google-api-ruby-client-samples) -repository. +[samples](samples) +folder. ## Generating APIs From b0173dc57a4fcd02dbfd6c75fbab7c991ef633cc Mon Sep 17 00:00:00 2001 From: joker1007 Date: Wed, 24 Feb 2016 02:55:55 +0900 Subject: [PATCH 2/7] Assign `open_timeout` option in `apply_request_options` --- lib/google/apis/core/http_command.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/google/apis/core/http_command.rb b/lib/google/apis/core/http_command.rb index d18eb85f2..73b736dda 100644 --- a/lib/google/apis/core/http_command.rb +++ b/lib/google/apis/core/http_command.rb @@ -292,6 +292,7 @@ module Google end req.header.update(header) req.options.timeout = options.timeout_sec + req.options.open_timeout = options.open_timeout_sec end private From 4b6f5d0a2b8e8019ea8045b681987f90af03c2d3 Mon Sep 17 00:00:00 2001 From: joker1007 Date: Thu, 25 Feb 2016 02:48:02 +0900 Subject: [PATCH 3/7] Fix Hash value assignment in JsonSupport#getter_fn because current version cannot send `false` value. If given parameter is `false`, current version does not use it. --- lib/google/apis/core/json_representation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/google/apis/core/json_representation.rb b/lib/google/apis/core/json_representation.rb index 843038a02..9fbf4bf01 100644 --- a/lib/google/apis/core/json_representation.rb +++ b/lib/google/apis/core/json_representation.rb @@ -39,7 +39,7 @@ module Google ivar_name = "@#{name}".to_sym lambda do |_| if respond_to?(:[]) - self[name] || instance_variable_get(ivar_name) + self.key?(name) ? self[name] : instance_variable_get(ivar_name) else instance_variable_get(ivar_name) end From fe7c37739930657353d2f4791bbcbb93d24d7a9e Mon Sep 17 00:00:00 2001 From: joker1007 Date: Thu, 25 Feb 2016 05:34:39 +0900 Subject: [PATCH 4/7] Add boolean test case --- .../apis/core/json_representation_spec.rb | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/spec/google/apis/core/json_representation_spec.rb b/spec/google/apis/core/json_representation_spec.rb index ebbe3e681..644a5ac0b 100644 --- a/spec/google/apis/core/json_representation_spec.rb +++ b/spec/google/apis/core/json_representation_spec.rb @@ -28,7 +28,8 @@ RSpec.describe Google::Apis::Core::JsonRepresentation do attr_accessor :nil_value attr_accessor :numeric_value attr_accessor :string_value - attr_accessor :boolean_value + attr_accessor :boolean_value_true + attr_accessor :boolean_value_false attr_accessor :date_value attr_accessor :bytes_value attr_accessor :items @@ -44,7 +45,8 @@ RSpec.describe Google::Apis::Core::JsonRepresentation do property :nil_value, as: 'nilValue' property :numeric_value, as: 'numericValue' property :string_value, as: 'stringValue' - property :boolean_value, as: 'booleanValue' + property :boolean_value_true, as: 'booleanValueTrue' + property :boolean_value_false, as: 'booleanValueFalse' property :date_value, as: 'dateValue', type: DateTime property :bytes_value, as: 'bytesValue', base64: true property :items @@ -75,7 +77,8 @@ RSpec.describe Google::Apis::Core::JsonRepresentation do end it 'serializes boolean values' do - expect(json).to be_json_eql(%(true)).at_path('booleanValue') + expect(json).to be_json_eql(%(true)).at_path('booleanValueTrue') + expect(json).to be_json_eql(%(false)).at_path('booleanValueFalse') end it 'serializes date values' do @@ -107,7 +110,8 @@ RSpec.describe Google::Apis::Core::JsonRepresentation do model.numeric_value = 123 model.string_value = 'test' model.date_value = DateTime.new(2015, 5, 1, 12) - model.boolean_value = true + model.boolean_value_true = true + model.boolean_value_false = false model.bytes_value = 'Hello world' model.items = [1, 2, 3] model.child = child_class.new @@ -127,7 +131,8 @@ RSpec.describe Google::Apis::Core::JsonRepresentation do string_value: 'test', numeric_value: 123, date_value: DateTime.new(2015, 5, 1, 12), - boolean_value: true, + boolean_value_true: true, + boolean_value_false: false, bytes_value: 'Hello world', items: [1, 2, 3], child: { @@ -146,7 +151,8 @@ RSpec.describe Google::Apis::Core::JsonRepresentation do json = <