Class: RubyEventStore::Browser::JsonApiStream

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

Instance Method Summary collapse

Constructor Details

#initialize(stream_name, events_from_stream_url, related_streams) ⇒ JsonApiStream

Returns a new instance of JsonApiStream.



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

def initialize(stream_name, events_from_stream_url, related_streams)
  @stream_name = stream_name
  @events_from_stream_url = events_from_stream_url
  @related_streams = related_streams
end

Instance Method Details

#to_hObject



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

def to_h
  {
    id: stream_name,
    type: "streams",
    attributes: {
      related_streams: related_streams
    },
    relationships: {
      events: {
        links: {
          self: events_from_stream_url
        }
      }
    }
  }
end