Class: Amazon::Coral::IdentityHandler
- Defined in:
- lib/amazon/coral/identityhandler.rb
Overview
Preloads identity information into request objects. Useful if all requests through a client will utilize the same identity.
Instance Method Summary collapse
- #before(job) ⇒ Object
-
#initialize(attributes) ⇒ IdentityHandler
constructor
Instantiates an IdentityHandler with a hash of identity attributes to be contributed to the request’s identity.
Methods inherited from Handler
Constructor Details
#initialize(attributes) ⇒ IdentityHandler
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.
16 17 18 |
# File 'lib/amazon/coral/identityhandler.rb', line 16 def initialize(attributes) @attributes = attributes.to_hash end |
Instance Method Details
#before(job) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# 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 |