PERF: only require aws-sdk-sns gem when it's being used
This commit is contained in:
parent
a3e9b809b2
commit
fc14847c14
|
@ -1,5 +1,3 @@
|
||||||
require "aws-sdk-sns"
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class ConfirmSnsSubscription < Jobs::Base
|
class ConfirmSnsSubscription < Jobs::Base
|
||||||
|
@ -8,8 +6,9 @@ module Jobs
|
||||||
def execute(args)
|
def execute(args)
|
||||||
return unless raw = args[:raw].presence
|
return unless raw = args[:raw].presence
|
||||||
return unless json = args[:json].presence
|
return unless json = args[:json].presence
|
||||||
|
|
||||||
return unless subscribe_url = json["SubscribeURL"].presence
|
return unless subscribe_url = json["SubscribeURL"].presence
|
||||||
|
|
||||||
|
require "aws-sdk-sns"
|
||||||
return unless Aws::SNS::MessageVerifier.new.authentic?(raw)
|
return unless Aws::SNS::MessageVerifier.new.authentic?(raw)
|
||||||
|
|
||||||
# confirm subscription by visiting the URL
|
# confirm subscription by visiting the URL
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
require "aws-sdk-sns"
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class ProcessSnsNotification < Jobs::Base
|
class ProcessSnsNotification < Jobs::Base
|
||||||
|
@ -14,6 +12,7 @@ module Jobs
|
||||||
return unless message_id = message.dig("mail", "messageId").presence
|
return unless message_id = message.dig("mail", "messageId").presence
|
||||||
return unless bounce_type = message.dig("bounce", "bounceType").presence
|
return unless bounce_type = message.dig("bounce", "bounceType").presence
|
||||||
|
|
||||||
|
require "aws-sdk-sns"
|
||||||
return unless Aws::SNS::MessageVerifier.new.authentic?(raw)
|
return unless Aws::SNS::MessageVerifier.new.authentic?(raw)
|
||||||
|
|
||||||
message.dig("bounce", "bouncedRecipients").each do |r|
|
message.dig("bounce", "bouncedRecipients").each do |r|
|
||||||
|
|
Loading…
Reference in New Issue