Class: EsHttpClient::Event
- Inherits:
-
Struct
- Object
- Struct
- EsHttpClient::Event
- Defined in:
- lib/es_http_client/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
3 4 5 |
# File 'lib/es_http_client/event.rb', line 3 def data @data end |
#id ⇒ Object
Returns the value of attribute id
3 4 5 |
# File 'lib/es_http_client/event.rb', line 3 def id @id end |
#number ⇒ Object
Returns the value of attribute number
3 4 5 |
# File 'lib/es_http_client/event.rb', line 3 def number @number end |
#stream_id ⇒ Object
Returns the value of attribute stream_id
3 4 5 |
# File 'lib/es_http_client/event.rb', line 3 def stream_id @stream_id end |
#type ⇒ Object
Returns the value of attribute type
3 4 5 |
# File 'lib/es_http_client/event.rb', line 3 def type @type end |
#updated ⇒ Object
Returns the value of attribute updated
3 4 5 |
# File 'lib/es_http_client/event.rb', line 3 def updated @updated end |
#uri ⇒ Object
Returns the value of attribute uri
3 4 5 |
# File 'lib/es_http_client/event.rb', line 3 def uri @uri end |
Class Method Details
.load_from(hash) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/es_http_client/event.rb', line 5 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
12 13 14 |
# File 'lib/es_http_client/event.rb', line 12 def occurred_at data[:occurredAt] end |