Class: Emailbutler::Webhooks::Mappers::Resend
- Inherits:
-
Object
- Object
- Emailbutler::Webhooks::Mappers::Resend
- Defined in:
- lib/emailbutler/webhooks/mappers/resend.rb
Constant Summary collapse
- DELIVERABILITY_MAPPER =
{ 'email.sent' => 'processed', 'email.delivered' => 'delivered', 'email.opened' => 'delivered', 'email.clicked' => 'delivered' }.freeze
Instance Method Summary collapse
Instance Method Details
#call(payload:) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/emailbutler/webhooks/mappers/resend.rb', line 14 def call(payload:) payload.stringify_keys! = payload.dig('data', 'email_id') status = DELIVERABILITY_MAPPER[payload['type']] || Emailbutler::Message::FAILED return [] if .nil? [ { message_uuid: , status: status, timestamp: payload['created_at'] ? DateTime.parse(payload['created_at']).utc : nil } ] end |