Class: EventStoreClient::DeserializedEvent
- Inherits:
-
Object
- Object
- EventStoreClient::DeserializedEvent
- Defined in:
- lib/event_store_client/deserialized_event.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ DeserializedEvent
constructor
A new instance of DeserializedEvent.
-
#payload_content_type ⇒ Object
content type of the event data.
-
#schema ⇒ Object
event schema.
Constructor Details
#initialize(args = {}) ⇒ DeserializedEvent
Returns a new instance of DeserializedEvent.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/event_store_client/deserialized_event.rb', line 20 def initialize(args = {}) validate(args[:data]) unless args[:skip_validation] @data = args.fetch(:data) { {} } @metadata = args.fetch(:metadata) { {} } .merge( 'type' => self.class.name, 'content-type' => payload_content_type ) @type = args[:type] || self.class.name @title = args[:title] @id = args[:id] end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/event_store_client/deserialized_event.rb', line 10 def data @data end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/event_store_client/deserialized_event.rb', line 10 def id @id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
10 11 12 |
# File 'lib/event_store_client/deserialized_event.rb', line 10 def @metadata end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
10 11 12 |
# File 'lib/event_store_client/deserialized_event.rb', line 10 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/event_store_client/deserialized_event.rb', line 10 def type @type end |
Instance Method Details
#payload_content_type ⇒ Object
content type of the event data
40 41 42 43 44 |
# File 'lib/event_store_client/deserialized_event.rb', line 40 def payload_content_type return 'application/json' if EventStoreClient.config.adapter == :grpc 'application/vnd.eventstore.events+json' end |
#schema ⇒ Object
event schema
37 |
# File 'lib/event_store_client/deserialized_event.rb', line 37 def schema; end |