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
54 55 56 57 |
# File 'lib/command_post/identity/identity.rb', line 54 def self.find aggregate_id Aggregate.get_by_aggregate_id self, aggregate_id end |
.generate_checksum(value) ⇒ Object
26 27 28 29 30 |
# File 'lib/command_post/identity/identity.rb', line 26 def self.generate_checksum value sha = Digest::SHA2.new sha.update(value) sha.to_s end |
.select(&block) ⇒ Object
40 41 42 |
# File 'lib/command_post/identity/identity.rb', line 40 def self.select (&block) Aggregate.where(self).select end |
Instance Method Details
#aggregate_id ⇒ Object
14 15 16 17 |
# File 'lib/command_post/identity/identity.rb', line 14 def aggregate_id @data[:aggregate_info][:aggregate_id] end |
#aggregate_info ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/command_post/identity/identity.rb', line 45 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
9 10 11 12 |
# File 'lib/command_post/identity/identity.rb', line 9 def aggregate_lookup_value field = (schema_fields[:lookup][:use]) (self.send field.to_sym).to_s end |
#aggregate_pointer ⇒ Object
20 21 22 23 |
# File 'lib/command_post/identity/identity.rb', line 20 def aggregate_pointer AggregatePointer.new(aggregate_info) end |
#checksum ⇒ Object
33 34 35 36 37 |
# File 'lib/command_post/identity/identity.rb', line 33 def checksum data = Array.new @data.keys.select {|x| x != :aggregate_info}.each {|x| data << @data[x] } Identity.generate_checksum(data.join()) end |