Class: EmailEvents::Adapters::Ses::Initializer

Inherits:
Abstract::Initializer show all
Defined in:
lib/email_events/adapters/ses/initializer.rb

Class Method Summary collapse

Class Method Details

.initializeObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/email_events/adapters/ses/initializer.rb', line 12

def self.initialize
  SnsEndpoint.setup do |config|
    config.topics_list = SnsEndpointTopicListMatcher.new ['email_events']
    config.message_proc = EmailEvents::Service::HandleEvent
    config.subscribe_proc = Proc.new do |data|
      # confirm the subscription
      confirmation_endpoint = URI.parse(data['SubscribeURL'])
      Net::HTTP.get confirmation_endpoint
    end
  end
end

.load_adapter?Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/email_events/adapters/ses/initializer.rb', line 7

def self.load_adapter?
  smtp_settings = Rails.configuration.action_mailer.smtp_settings
  smtp_settings.present? && smtp_settings[:address].include?('amazonaws.com')
end