Class: EsReadModel::Event
- Inherits:
-
Struct
- Object
- Struct
- EsReadModel::Event
- Defined in:
- lib/es_readmodel/event.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#id ⇒ Object
Returns the value of attribute id.
-
#number ⇒ Object
Returns the value of attribute number.
-
#stream_id ⇒ Object
Returns the value of attribute stream_id.
-
#type ⇒ Object
Returns the value of attribute type.
-
#updated ⇒ Object
Returns the value of attribute updated.
-
#uri ⇒ Object
Returns the value of attribute uri.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data
5 6 7 |
# File 'lib/es_readmodel/event.rb', line 5 def data @data end |
#id ⇒ Object
Returns the value of attribute id
5 6 7 |
# File 'lib/es_readmodel/event.rb', line 5 def id @id end |
#number ⇒ Object
Returns the value of attribute number
5 6 7 |
# File 'lib/es_readmodel/event.rb', line 5 def number @number end |
#stream_id ⇒ Object
Returns the value of attribute stream_id
5 6 7 |
# File 'lib/es_readmodel/event.rb', line 5 def stream_id @stream_id end |
#type ⇒ Object
Returns the value of attribute type
5 6 7 |
# File 'lib/es_readmodel/event.rb', line 5 def type @type end |
#updated ⇒ Object
Returns the value of attribute updated
5 6 7 |
# File 'lib/es_readmodel/event.rb', line 5 def updated @updated end |
#uri ⇒ Object
Returns the value of attribute uri
5 6 7 |
# File 'lib/es_readmodel/event.rb', line 5 def uri @uri end |
Class Method Details
.load_from(hash) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/es_readmodel/event.rb', line 7 def self.load_from(hash) return nil unless hash['data'] data = JSON.parse(hash['data'], symbolize_names: true) event = Event.new(hash['eventId'], hash['eventType'], data, hash['updated'], hash['eventNumber'].to_i, hash['id'], hash['streamId']) event end |
Instance Method Details
#occurred_at ⇒ Object
14 15 16 |
# File 'lib/es_readmodel/event.rb', line 14 def occurred_at data[:occurredAt] end |