Class: RubyEventStore::Browser::JsonApiEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_event_store/browser/json_api_event.rb

Instance Method Summary collapse

Constructor Details

#initialize(event, parent_event_id) ⇒ JsonApiEvent

Returns a new instance of JsonApiEvent.



6
7
8
9
# File 'lib/ruby_event_store/browser/json_api_event.rb', line 6

def initialize(event, parent_event_id)
  @event = event
  @parent_event_id = parent_event_id
end

Instance Method Details

#to_hObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ruby_event_store/browser/json_api_event.rb', line 11

def to_h
  {
    id: event.event_id,
    type: "events",
    attributes: {
      event_type: event.event_type,
      data: event.data,
      metadata: ,
      correlation_stream_name: correlation_stream_name,
      causation_stream_name: causation_stream_name,
      type_stream_name: type_stream_name,
      parent_event_id: parent_event_id
    }
  }
end