Sha256: 9c4848c4c13e774e7ae22d92ce085112dcb96f3ca2e091bc0957154217d0a98d
Contents?: true
Size: 942 Bytes
Versions: 4
Compression:
Stored size: 942 Bytes
Contents
# frozen_string_literal: true module Emailbutler module Webhooks module Mappers class Smtp2Go DELIVERABILITY_MAPPER = { 'processed' => 'processed', 'delivered' => 'delivered', 'open' => 'delivered', 'click' => 'delivered', 'bounce' => 'failed', 'reject' => 'failed', 'spam' => 'failed' }.freeze def call(payload:) payload.stringify_keys! # message-id contains data like <uuid> message_uuid = payload['message-id'][1..-2] status = DELIVERABILITY_MAPPER[payload['event']] return [] if message_uuid.nil? || status.nil? [ { message_uuid: message_uuid, status: status, timestamp: payload['sendtime'] ? Time.at(payload['sendtime'].to_i).utc.to_datetime : nil } ] end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems