Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/http_event_store/helpers/parse_entries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ def call(entries)
private

def create_event(entry)
return nil unless entry['data']
return nil unless entry['eventType']

id = entry['eventNumber']
event_id = entry['eventId']
type = entry['eventType']
source_event_uri = entry['id']
data = JSON.parse(entry['data'])
data = entry['data'] ? JSON.parse(entry['data']) : nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if nil is good choice here - why not empty hash {} ?

stream_name = entry['streamId']
position = entry['positionEventNumber']
created_time = entry['updated'] ? Time.parse(entry['updated']) : nil


Event.new(type, data, source_event_uri, event_id, id, position, stream_name, created_time)
end
end
Expand Down