Class: Mailkick::Service::AwsSes
- Inherits:
-
Mailkick::Service
- Object
- Mailkick::Service
- Mailkick::Service::AwsSes
- Defined in:
- lib/mailkick/service/aws_ses.rb
Constant Summary collapse
- REASONS_MAP =
{ "BOUNCE" => "bounce", "COMPLAINT" => "spam" }
Constants inherited from Mailkick::Service
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ AwsSes
constructor
A new instance of AwsSes.
- #opt_outs ⇒ Object
Methods inherited from Mailkick::Service
Constructor Details
#initialize(options = {}) ⇒ AwsSes
Returns a new instance of AwsSes.
11 12 13 |
# File 'lib/mailkick/service/aws_ses.rb', line 11 def initialize( = {}) @options = end |
Class Method Details
.discoverable? ⇒ Boolean
36 37 38 |
# File 'lib/mailkick/service/aws_ses.rb', line 36 def self.discoverable? !!defined?(::Aws::SESV2::Client) end |
Instance Method Details
#opt_outs ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mailkick/service/aws_ses.rb', line 15 def opt_outs response = client.list_suppressed_destinations({ reasons: ["BOUNCE", "COMPLAINT"], # TODO make configurable start_date: Time.now - (86400 * 365), end_date: Time.now }) opt_outs = [] response.each do |page| page.suppressed_destination_summaries.each do |record| opt_outs << { email: record.email_address, time: record.last_update_time, reason: REASONS_MAP[record.reason] } end end opt_outs end |