Class: EventStore::HTTP::ReadEvent::Substitute::ReadEvent

Inherits:
EventStore::HTTP::ReadEvent show all
Defined in:
lib/event_store/http/read_event/substitute.rb

Constant Summary

Constants inherited from EventStore::HTTP::ReadEvent

Error, EventNotFoundError

Instance Attribute Summary collapse

Attributes inherited from EventStore::HTTP::ReadEvent

#output_schema

Instance Method Summary collapse

Methods inherited from EventStore::HTTP::ReadEvent

#build_request, #event_path

Methods included from EventStore::HTTP::Request

included

Instance Attribute Details

#responseObject

Returns the value of attribute response.



10
11
12
# File 'lib/event_store/http/read_event/substitute.rb', line 10

def response
  @response
end

Instance Method Details

#call(uri = nil, stream: nil, position: nil) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/event_store/http/read_event/substitute.rb', line 12

def call(uri=nil, stream: nil, position: nil)
  uri ||= event_path stream, position

  uri = URI(uri)

  events.fetch uri.path do
    raise EventNotFoundError
  end
end

#eventsObject



28
29
30
# File 'lib/event_store/http/read_event/substitute.rb', line 28

def events
  @events ||= {}
end

#set_response(event, stream, position) ⇒ Object



22
23
24
25
26
# File 'lib/event_store/http/read_event/substitute.rb', line 22

def set_response(event, stream, position)
  path = event_path stream, position

  events[path] = event
end