Class: Emailbutler::Webhooks::Mappers::Mailjet
- Inherits:
-
Object
- Object
- Emailbutler::Webhooks::Mappers::Mailjet
- Defined in:
- lib/emailbutler/webhooks/mappers/mailjet.rb
Constant Summary collapse
- DELIVERABILITY_MAPPER =
{ 'sent' => '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 27 |
# File 'lib/emailbutler/webhooks/mappers/mailjet.rb', line 13 def call(payload:) payload.stringify_keys! # message-id contains data like <uuid> = payload['Message_GUID'] status = DELIVERABILITY_MAPPER[payload['event']] || Emailbutler::Message::FAILED return [] if .nil? [ { message_uuid: , status: status, timestamp: payload['time'] ? Time.at(payload['time'].to_i).utc.to_datetime : nil } ] end |