Class: Emailbutler::Webhooks::Mappers::Mandrill
- Inherits:
-
Object
- Object
- Emailbutler::Webhooks::Mappers::Mandrill
- Defined in:
- lib/emailbutler/webhooks/mappers/mandrill.rb
Constant Summary collapse
- DELIVERABILITY_MAPPER =
{ 'send' => 'processed', 'open' => 'delivered', 'click' => 'delivered' }.freeze
Instance Method Summary collapse
Instance Method Details
#call(payload:) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/emailbutler/webhooks/mappers/mandrill.rb', line 13 def call(payload:) payload['mandrill_events'].filter_map { || .stringify_keys! = ['_id'] status = DELIVERABILITY_MAPPER[['event']] || Emailbutler::Message::FAILED next if .nil? { message_uuid: , status: status, timestamp: ['ts'] ? Time.at(['ts']).utc.to_datetime : nil } } end |