Sha256: 7751c9cc65bc8fb6a4102dbef9c595e5a914e6967e699f227b818a3f55477c99
Contents?: true
Size: 794 Bytes
Versions: 4
Compression:
Stored size: 794 Bytes
Contents
# frozen_string_literal: true module Emailbutler module Webhooks module Mappers class Mandrill DELIVERABILITY_MAPPER = { 'send' => 'processed', 'open' => 'delivered', 'click' => 'delivered' }.freeze def call(payload:) payload['mandrill_events'].filter_map { |message| message.stringify_keys! message_uuid = message['_id'] status = DELIVERABILITY_MAPPER[message['event']] || Emailbutler::Message::FAILED next if message_uuid.nil? { message_uuid: message_uuid, status: status, timestamp: message['ts'] ? Time.at(message['ts']).utc.to_datetime : nil } } end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems