class Google::Auth::IAMCredentials
Authenticates requests using IAM credentials.
Constants
- SELECTOR_KEY
- TOKEN_KEY
Public Class Methods
Source
# File lib/googleauth/iam.rb, line 32 def initialize selector, token raise TypeError unless selector.is_a? String raise TypeError unless token.is_a? String @selector = selector @token = token end
Initializes an IAMCredentials
.
@param selector the IAM selector. @param token the IAM token.
Public Instance Methods
Source
# File lib/googleauth/iam.rb, line 47 def apply a_hash a_copy = a_hash.clone apply! a_copy a_copy end
Returns a clone of a_hash updated with the authoriation header
Source
# File lib/googleauth/iam.rb, line 40 def apply! a_hash a_hash[SELECTOR_KEY] = @selector a_hash[TOKEN_KEY] = @token a_hash end
Adds the credential fields to the hash.
Source
# File lib/googleauth/iam.rb, line 55 def updater_proc proc { |a_hash, _opts = {}| apply a_hash } end
Returns a reference to the apply
method, suitable for passing as a closure