Module: CommandPost::Identity
- Defined in:
- lib/command_post/identity/identity.rb
Class Method Summary collapse
Instance Method Summary collapse
- #aggregate_id ⇒ Object
- #aggregate_info ⇒ Object
- #aggregate_lookup_value ⇒ Object
- #aggregate_pointer ⇒ Object
- #checksum ⇒ Object
Class Method Details
.find(aggregate_id) ⇒ Object
53 54 55 56 |
# File 'lib/command_post/identity/identity.rb', line 53 def self.find aggregate_id Aggregate.get_by_aggregate_id self, aggregate_id end |
.generate_checksum(value) ⇒ Object
25 26 27 28 29 |
# File 'lib/command_post/identity/identity.rb', line 25 def self.generate_checksum value sha = Digest::SHA2.new sha.update(value) sha.to_s end |
Instance Method Details
#aggregate_id ⇒ Object
13 14 15 16 |
# File 'lib/command_post/identity/identity.rb', line 13 def aggregate_id @data[:aggregate_info][:aggregate_id] end |
#aggregate_info ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/command_post/identity/identity.rb', line 44 def aggregate_info if @data.keys.include? :aggregate_info @data[:aggregate_info] else raise "A request was made for 'AggregateInfo at a time when it was not present in object state." end end |
#aggregate_lookup_value ⇒ Object
8 9 10 11 |
# File 'lib/command_post/identity/identity.rb', line 8 def aggregate_lookup_value field = (schema_fields[:lookup][:use]) (self.send field.to_sym).to_s end |
#aggregate_pointer ⇒ Object
19 20 21 22 |
# File 'lib/command_post/identity/identity.rb', line 19 def aggregate_pointer AggregatePointer.new(aggregate_info) end |
#checksum ⇒ Object
32 33 34 35 36 |
# File 'lib/command_post/identity/identity.rb', line 32 def checksum data = Array.new @data.keys.select {|x| x != :aggregate_info}.each {|x| data << @data[x] } Identity.generate_checksum(data.join()) end |