class Amazon::Coral::IdentityHandler
Preloads identity information into request objects. Useful if all requests through a client will utilize the same identity.
Public Class Methods
new(attributes)
click to toggle source
Instantiates an IdentityHandler
with a hash of identity attributes to be contributed to the request’s identity. Attributes specified here will not override those explicitly associated with a request.
# File lib/amazon/coral/identityhandler.rb, line 16 def initialize(attributes) @attributes = attributes.to_hash end
Public Instance Methods
before(job)
click to toggle source
# File lib/amazon/coral/identityhandler.rb, line 20 def before(job) identity = job.request[:identity] # for each shared identity attribute, set it on the request's # identity IFF no attribute with that key is already present @attributes.each { |k,v| identity[k] = v unless identity.has_key?(k) } end