From 2a088820366c2d24e8f8c8167ac8b9ada0a3cb6e Mon Sep 17 00:00:00 2001 From: YAMADA Tsuyoshi Date: Tue, 4 Apr 2017 17:09:15 +0900 Subject: [PATCH 1/2] Timeout options in google-api-client 0.11.0 have been moved from request_options to client_options. see also: https://github.com/google/google-api-ruby-client/blob/0.11.0/MIGRATING.md#timeouts https://github.com/google/google-api-ruby-client/blob/0.11.0/CHANGELOG.md#0110 --- lib/google_drive/api_client_fetcher.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/google_drive/api_client_fetcher.rb b/lib/google_drive/api_client_fetcher.rb index 5377d9d9..d876c33b 100644 --- a/lib/google_drive/api_client_fetcher.rb +++ b/lib/google_drive/api_client_fetcher.rb @@ -22,8 +22,17 @@ def initialize(authorization) @drive.authorization = authorization # Make the timeout virtually infinite because some of the operations (e.g., uploading a large file) # can take very long. - @drive.request_options.timeout_sec = 100_000_000 - @drive.request_options.open_timeout_sec = 100_000_000 + if @drive.request_options.respond_to?(:timeout_sec=) + # google-api-client 0.9.x, 0.10.x + @drive.request_options.timeout_sec = 100_000_000 + @drive.request_options.open_timeout_sec = 100_000_000 + else + # google-api-client 0.11.0 or later + # see also: https://github.com/google/google-api-ruby-client/blob/0.11.0/MIGRATING.md#timeouts + @drive.client_options.open_timeout_sec = 100_000_000 + @drive.client_options.read_timeout_sec = 100_000_000 + @drive.client_options.send_timeout_sec = 100_000_000 + end end attr_reader(:drive) From 5bc599b3e23c01007dfe0b2adec3b175a26e7dc5 Mon Sep 17 00:00:00 2001 From: YAMADA Tsuyoshi Date: Tue, 4 Apr 2017 21:00:30 +0900 Subject: [PATCH 2/2] Dropped google-api-client 0.9.x, 0.10.x support --- google_drive.gemspec | 2 +- lib/google_drive/api_client_fetcher.rb | 14 +++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/google_drive.gemspec b/google_drive.gemspec index ac9b6f2c..1b73f766 100644 --- a/google_drive.gemspec +++ b/google_drive.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |s| s.require_paths = ['lib'] s.add_dependency('nokogiri', ['>= 1.5.3', '< 2.0.0']) - s.add_dependency('google-api-client', ['>= 0.9.0', '< 1.0.0']) + s.add_dependency('google-api-client', ['>= 0.11.0', '< 1.0.0']) s.add_dependency('googleauth', ['>= 0.5.0', '< 1.0.0']) s.add_development_dependency('test-unit', ['>= 3.0.0', '< 4.0.0']) s.add_development_dependency('rake', ['>= 0.8.0']) diff --git a/lib/google_drive/api_client_fetcher.rb b/lib/google_drive/api_client_fetcher.rb index d876c33b..82ecff3d 100644 --- a/lib/google_drive/api_client_fetcher.rb +++ b/lib/google_drive/api_client_fetcher.rb @@ -22,17 +22,9 @@ def initialize(authorization) @drive.authorization = authorization # Make the timeout virtually infinite because some of the operations (e.g., uploading a large file) # can take very long. - if @drive.request_options.respond_to?(:timeout_sec=) - # google-api-client 0.9.x, 0.10.x - @drive.request_options.timeout_sec = 100_000_000 - @drive.request_options.open_timeout_sec = 100_000_000 - else - # google-api-client 0.11.0 or later - # see also: https://github.com/google/google-api-ruby-client/blob/0.11.0/MIGRATING.md#timeouts - @drive.client_options.open_timeout_sec = 100_000_000 - @drive.client_options.read_timeout_sec = 100_000_000 - @drive.client_options.send_timeout_sec = 100_000_000 - end + @drive.client_options.open_timeout_sec = 100_000_000 + @drive.client_options.read_timeout_sec = 100_000_000 + @drive.client_options.send_timeout_sec = 100_000_000 end attr_reader(:drive)