diff options
| author | mo khan <mo@mokhan.ca> | 2015-02-21 22:12:49 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-02-21 22:12:49 -0700 |
| commit | 7cd78597d794efcf79090377bbc1909a1d6d3ad9 (patch) | |
| tree | f4f55eb33be3912030c505198e67b1cba9ba2473 /app/workers | |
| parent | feaf5cfae0f948ceebae4d1ff2c80d84cd76cae0 (diff) | |
| parent | 05b427bd4d9f9c4ea60f9485f06d68de0b689d28 (diff) | |
merge with master
Diffstat (limited to 'app/workers')
| -rw-r--r-- | app/workers/event_intake.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/app/workers/event_intake.rb b/app/workers/event_intake.rb index 79be810..a4cbf67 100644 --- a/app/workers/event_intake.rb +++ b/app/workers/event_intake.rb @@ -5,11 +5,16 @@ class EventIntake from_queue "worker.events" def work(event_json) - logger.info event_json - json = JSON.parse(event_json) - json['type'] = json['type'].capitalize - event = Event.create!(json) - logger.info("Create Event: #{event.id}") + logger.info(event_json) + Event.create!(to_hash(event_json)) ack! end + + private + + def to_hash(json) + JSON.parse(json).tap do |event| + event['type'].capitalize! + end + end end |
