Class: Mailkick::Service::Postmark

Inherits:
Mailkick::Service show all
Defined in:
lib/mailkick/service/postmark.rb

Constant Summary collapse

REASONS_MAP =
{
  "SpamNotification" => "spam",
  "SpamComplaint" => "spam",
  "Unsubscribe" => "unsubscribe",
}

Constants inherited from Mailkick::Service

Sendgrid

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Mailkick::Service

#fetch_opt_outs

Constructor Details

#initialize(options = {}) ⇒ Postmark

Returns a new instance of Postmark.



12
13
14
# File 'lib/mailkick/service/postmark.rb', line 12

def initialize(options = {})
  @client = ::Postmark::ApiClient.new(options[:api_key] || ENV["POSTMARK_API_KEY"])
end

Class Method Details

.discoverable?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/mailkick/service/postmark.rb', line 24

def self.discoverable?
  !!(defined?(::Postmark) && ENV["POSTMARK_API_KEY"])
end

Instance Method Details

#bouncesObject



20
21
22
# File 'lib/mailkick/service/postmark.rb', line 20

def bounces
  fetch(@client.bounces)
end

#opt_outsObject



16
17
18
# File 'lib/mailkick/service/postmark.rb', line 16

def opt_outs
  bounces
end