33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/event_store/http/controls/read_stream/output_schema/optimized.rb', line 33
def self.instance(raw_data)
raw_data.fetch('entries').map do |entry|
id = entry.fetch 'eventId'
type = entry.fetch 'eventType'
stream = entry.fetch 'streamId'
position = entry.fetch 'eventNumber'
global_position = entry.fetch 'positionEventNumber'
data_text = entry.fetch 'data'
data = EventStore::HTTP::JSON::Deserialize.(data_text)
metadata_text = entry['metaData']
metadata_text = nil if metadata_text == ''
unless metadata_text.nil?
metadata = EventStore::HTTP::JSON::Deserialize.(metadata_text)
end
Event::Example.new id, type, data, metadata, stream, position, global_position
end
end
|