change some code to let ruby 2.1.2 can use no problem
This commit is contained in:
1 parent
cd9b0126d3
commit
c48221bcd9
4 files changed
+10
-10
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user