Authenticates requests using IAM credentials.
Initializes an IAMCredentials.
@param selector the IAM selector. @param token the IAM token.
# File lib/googleauth/iam.rb, line 47 def initialize(selector, token) raise TypeError unless selector.is_a? String raise TypeError unless token.is_a? String @selector = selector @token = token end
Returns a clone of a_hash updated with the authoriation header
# File lib/googleauth/iam.rb, line 62 def apply(a_hash) a_copy = a_hash.clone apply!(a_copy) a_copy end
Adds the credential fields to the hash.
# File lib/googleauth/iam.rb, line 55 def apply!(a_hash) a_hash[SELECTOR_KEY] = @selector a_hash[TOKEN_KEY] = @token a_hash end
Returns a reference to the apply method, suitable for passing as a closure
# File lib/googleauth/iam.rb, line 70 def updater_proc lambda(&method(:apply)) end