change some code to let ruby 2.1.2 can use no problem
This commit is contained in:
parent
cd9b0126d3
commit
c48221bcd9
|
@ -25,14 +25,14 @@ Gem::Specification.new do |gem|
|
|||
end
|
||||
gem.require_paths = ["lib"]
|
||||
gem.platform = Gem::Platform::RUBY
|
||||
gem.required_ruby_version = ">= 2.4.0"
|
||||
gem.required_ruby_version = ">= 2.0"
|
||||
|
||||
gem.add_dependency "faraday", ">= 0.17.3", "< 2.0"
|
||||
gem.add_dependency "faraday", "~> 0.15.4"
|
||||
gem.add_dependency "jwt", ">= 1.4", "< 3.0"
|
||||
gem.add_dependency "memoist", "~> 0.16"
|
||||
gem.add_dependency "multi_json", "~> 1.11"
|
||||
gem.add_dependency "os", ">= 0.9", "< 2.0"
|
||||
gem.add_dependency "signet", "~> 0.14"
|
||||
gem.add_dependency "signet"
|
||||
|
||||
gem.add_development_dependency "yard", "~> 0.9"
|
||||
end
|
||||
|
|
|
@ -34,11 +34,11 @@ module Google
|
|||
# Module Auth provides classes that provide Google-specific authorization
|
||||
# used to access Google APIs.
|
||||
module Auth
|
||||
NOT_FOUND_ERROR = <<~ERROR_MESSAGE.freeze
|
||||
NOT_FOUND_ERROR = """~ERROR_MESSAGE.freeze
|
||||
Could not load the default credentials. Browse to
|
||||
https://developers.google.com/accounts/docs/application-default-credentials
|
||||
for more information
|
||||
ERROR_MESSAGE
|
||||
ERROR_MESSAGE"""
|
||||
|
||||
module_function
|
||||
|
||||
|
|
|
@ -35,16 +35,16 @@ module Google
|
|||
# Module Auth provides classes that provide Google-specific authorization
|
||||
# used to access Google APIs.
|
||||
module Auth
|
||||
NO_METADATA_SERVER_ERROR = <<~ERROR.freeze
|
||||
NO_METADATA_SERVER_ERROR = """
|
||||
Error code 404 trying to get security access token
|
||||
from Compute Engine metadata for the default service account. This
|
||||
may be because the virtual machine instance does not have permission
|
||||
scopes specified.
|
||||
ERROR
|
||||
UNEXPECTED_ERROR_SUFFIX = <<~ERROR.freeze
|
||||
"""
|
||||
UNEXPECTED_ERROR_SUFFIX = """
|
||||
trying to get security access token from Compute Engine metadata for
|
||||
the default service account
|
||||
ERROR
|
||||
"""
|
||||
|
||||
# Extends Signet::OAuth2::Client so that the auth token is obtained from
|
||||
# the GCE metadata server.
|
||||
|
|
|
@ -48,7 +48,7 @@ module Signet
|
|||
def apply! a_hash, opts = {}
|
||||
# fetch the access token there is currently not one, or if the client
|
||||
# has expired
|
||||
token_type = target_audience ? :id_token : :access_token
|
||||
token_type = defined?(target_audience) ? :id_token : :access_token
|
||||
fetch_access_token! opts if send(token_type).nil? || expires_within?(60)
|
||||
a_hash[AUTH_METADATA_KEY] = "Bearer #{send token_type}"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue