Sha256: d16cd9d8c7fc2b7e85e4c7579f0dfcbf6b161a4e49203f6e986d7b31ab69aad8
Contents?: true
Size: 1023 Bytes
Versions: 1
Compression:
Stored size: 1023 Bytes
Contents
require 'sns_endpoint' require 'net/http' module EmailEvents::Adapters module Ses class Initializer < Abstract::Initializer def self.load_adapter? smtp_settings = Rails.configuration.action_mailer.smtp_settings smtp_settings.present? && smtp_settings[:address].include?('amazonaws.com') end 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 end class SnsEndpointTopicListMatcher < Array # match any topic ending in the topic name (as opposed to the long ARN topic ID) def include?(arn) self.any? {|topic| arn.end_with? topic} end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
email_events-1.0 | lib/email_events/adapters/ses/initializer.rb |