Sha256: c20c1dd4f39a89a39f7d1af1e0bd682651c4674e5fc1a84c7813aa1157a04ec7
Contents?: true
Size: 914 Bytes
Versions: 1
Compression:
Stored size: 914 Bytes
Contents
# https://github.com/wildbit/postmark-gem module Mailkick class Service class Postmark < Mailkick::Service REASONS_MAP = { "SpamNotification" => "spam", "SpamComplaint" => "spam", "Unsubscribe" => "unsubscribe" } def initialize(options = {}) @client = ::Postmark::ApiClient.new(options[:api_key] || ENV["POSTMARK_API_KEY"]) end def opt_outs bounces end def bounces fetch(@client.bounces) end def self.discoverable? !!(defined?(::Postmark) && ENV["POSTMARK_API_KEY"]) end protected def fetch(response) response.map do |record| { email: record[:email], time: ActiveSupport::TimeZone["UTC"].parse(record[:bounced_at]), reason: REASONS_MAP.fetch(record[:type], "bounce") } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mailkick-1.3.1 | lib/mailkick/service/postmark.rb |