Skip to content

Commit da6977f

Browse files
author
Tim Emiola
committed
Version bump, and updates the googleauth dependency
1 parent da7616d commit da6977f

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

google-api-client.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
2626
s.add_runtime_dependency 'addressable', '~> 2.3'
2727
s.add_runtime_dependency 'signet', '~> 0.6'
2828
s.add_runtime_dependency 'faraday', '~> 0.9'
29-
s.add_runtime_dependency 'googleauth', '~> 0.1'
29+
s.add_runtime_dependency 'googleauth', '~> 0.3'
3030
s.add_runtime_dependency 'multi_json', '~> 1.10'
3131
s.add_runtime_dependency 'autoparse', "~> 0.3"
3232
s.add_runtime_dependency 'extlib', '~> 0.9'

lib/google/api_client.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module Google
4141
# This class manages APIs communication.
4242
class APIClient
4343
include Google::APIClient::Logging
44-
44+
4545
##
4646
# Creates a new Google API client.
4747
#
@@ -58,7 +58,7 @@ class APIClient
5858
# </ul>
5959
# @option options [Boolean] :auto_refresh_token (true)
6060
# The setting that controls whether or not the api client attempts to
61-
# refresh authorization when a 401 is hit in #execute. If the token does
61+
# refresh authorization when a 401 is hit in #execute. If the token does
6262
# not support it, this option is ignored.
6363
# @option options [String] :application_name
6464
# The name of the application using the client.
@@ -86,7 +86,7 @@ class APIClient
8686
# Pass through of options to set on the Faraday connection
8787
def initialize(options={})
8888
logger.debug { "#{self.class} - Initializing client with options #{options}" }
89-
89+
9090
# Normalize key to String to allow indifferent access.
9191
options = options.inject({}) do |accu, (key, value)|
9292
accu[key.to_sym] = value
@@ -182,7 +182,7 @@ def authorization=(new_authorization)
182182
)
183183
when :google_app_default
184184
require 'googleauth'
185-
new_authorization = Google::Auth.get_application_default(nil)
185+
new_authorization = Google::Auth.get_application_default
186186

187187
when :oauth_2
188188
require 'signet/oauth_2/client'
@@ -214,7 +214,7 @@ def authorization=(new_authorization)
214214

215215
##
216216
# The setting that controls whether or not the api client attempts to
217-
# refresh authorization when a 401 is hit in #execute.
217+
# refresh authorization when a 401 is hit in #execute.
218218
#
219219
# @return [Boolean]
220220
attr_accessor :auto_refresh_token
@@ -261,7 +261,7 @@ def authorization=(new_authorization)
261261

262262
##
263263
# Number of times to retry on recoverable errors
264-
#
264+
#
265265
# @return [FixNum]
266266
# Number of retries
267267
attr_accessor :retries
@@ -471,7 +471,7 @@ def preferred_version(api)
471471
# Verifies an ID token against a server certificate. Used to ensure that
472472
# an ID token supplied by an untrusted client-side mechanism is valid.
473473
# Raises an error if the token is invalid or missing.
474-
#
474+
#
475475
# @deprecated Use the google-id-token gem for verifying JWTs
476476
def verify_id_token!
477477
require 'jwt'
@@ -580,7 +580,7 @@ def generate_request(options={})
580580
# - (TrueClass, FalseClass) :authenticated (default: true) -
581581
# `true` if the request must be signed or somehow
582582
# authenticated, `false` otherwise.
583-
# - (TrueClass, FalseClass) :gzip (default: true) -
583+
# - (TrueClass, FalseClass) :gzip (default: true) -
584584
# `true` if gzip enabled, `false` otherwise.
585585
# - (FixNum) :retries -
586586
# # of times to retry on recoverable errors
@@ -620,7 +620,7 @@ def execute!(*params)
620620
options.update(params.shift) if params.size > 0
621621
request = self.generate_request(options)
622622
end
623-
623+
624624
request.headers['User-Agent'] ||= '' + self.user_agent unless self.user_agent.nil?
625625
request.headers['Accept-Encoding'] ||= 'gzip' unless options[:gzip] == false
626626
request.headers['Content-Type'] ||= ''
@@ -629,11 +629,11 @@ def execute!(*params)
629629

630630
connection = options[:connection] || self.connection
631631
request.authorization = options[:authorization] || self.authorization unless options[:authenticated] == false
632-
632+
633633
tries = 1 + (options[:retries] || self.retries)
634634
attempt = 0
635635

636-
Retriable.retriable :tries => tries,
636+
Retriable.retriable :tries => tries,
637637
:on => [TransmissionError],
638638
:on_retry => client_error_handler,
639639
:interval => lambda {|attempts| (2 ** attempts) + rand} do
@@ -642,7 +642,7 @@ def execute!(*params)
642642
# This 2nd level retriable only catches auth errors, and supports 1 retry, which allows
643643
# auth to be re-attempted without having to retry all sorts of other failures like
644644
# NotFound, etc
645-
Retriable.retriable :tries => ((expired_auth_retry || tries > 1) && attempt == 1) ? 2 : 1,
645+
Retriable.retriable :tries => ((expired_auth_retry || tries > 1) && attempt == 1) ? 2 : 1,
646646
:on => [AuthorizationError],
647647
:on_retry => authorization_error_handler(request.authorization) do
648648
result = request.send(connection, true)
@@ -709,7 +709,7 @@ def resolve_uri(template, mapping={})
709709
end
710710
return Addressable::Template.new(@base_uri + template).expand(mapping)
711711
end
712-
712+
713713

714714
##
715715
# Returns on proc for special processing of retries for authorization errors
@@ -719,7 +719,7 @@ def resolve_uri(template, mapping={})
719719
# OAuth 2 credentials
720720
# @return [Proc]
721721
def authorization_error_handler(authorization)
722-
can_refresh = authorization.respond_to?(:refresh_token) && auto_refresh_token
722+
can_refresh = authorization.respond_to?(:refresh_token) && auto_refresh_token
723723
Proc.new do |exception, tries|
724724
next unless exception.kind_of?(AuthorizationError)
725725
if can_refresh

lib/google/api_client/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class APIClient
1818
module VERSION
1919
MAJOR = 0
2020
MINOR = 8
21-
TINY = 2
21+
TINY = 3
2222
PATCH = nil
2323
STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
2424
end

0 commit comments

Comments
 (0)