class Google::Auth::IAMCredentials

Authenticates requests using IAM credentials.

def apply(a_hash)

Returns a clone of a_hash updated with the authoriation header
def apply(a_hash)
  a_copy = a_hash.clone
  apply!(a_copy)
  a_copy
end

def apply!(a_hash)

Adds the credential fields to the hash.
def apply!(a_hash)
  a_hash[SELECTOR_KEY] = @selector
  a_hash[TOKEN_KEY] = @token
  a_hash
end

def initialize(selector, token)

Parameters:
  • token () -- the IAM token.
  • selector () -- the IAM selector.
def initialize(selector, token)
  raise TypeError unless selector.is_a? String
  raise TypeError unless token.is_a? String
  @selector = selector
  @token = token
end

def updater_proc

a closure
Returns a reference to the #apply method, suitable for passing as
def updater_proc
  lambda(&method(:apply))
end