Class: HttpEventStore::Actions::ReadAllStreamEvents

Inherits:
Object
  • Object
show all
Defined in:
lib/http_event_store/actions/read_all_stream_events.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ReadAllStreamEvents

Returns a new instance of ReadAllStreamEvents.


5
6
7
# File 'lib/http_event_store/actions/read_all_stream_events.rb', line 5

def initialize(client)
  @client = client
end

Instance Method Details

#call(stream_name) ⇒ Object


9
10
11
12
13
14
15
16
# File 'lib/http_event_store/actions/read_all_stream_events.rb', line 9

def call(stream_name)
  raise IncorrectStreamData if stream_name.nil? || stream_name.empty?
  entries = get_all_stream_entries(stream_name)
  return_events(entries)
rescue ClientError => e
  raise StreamAlreadyDeleted if e.code == 410
  raise StreamNotFound if e.code == 404
end