Class: Emailbutler::Webhooks::Mappers::Mailtrap
- Inherits:
-
Object
- Object
- Emailbutler::Webhooks::Mappers::Mailtrap
- Defined in:
- lib/emailbutler/webhooks/mappers/mailtrap.rb
Constant Summary collapse
- DELIVERABILITY_MAPPER =
{ 'delivery' => 'delivered', '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/mailtrap.rb', line 13 def call(payload:) payload['events'].filter_map { || .stringify_keys! = ['message_id'] status = DELIVERABILITY_MAPPER[['event']] || Emailbutler::Message::FAILED next if .nil? { message_uuid: , status: status, timestamp: ['timestamp'] ? Time.at(['timestamp']).utc.to_datetime : nil } } end |