Class: Aws::Rails::ActionMailbox::SnsNotification Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/rails/action_mailbox/sns_notification.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: MessageContentError

Instance Method Summary collapse

Constructor Details

#initialize(request_body) ⇒ SnsNotification

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SnsNotification.

[View source]

14
15
16
# File 'lib/aws/rails/action_mailbox/sns_notification.rb', line 14

def initialize(request_body)
  @request_body = request_body
end

Instance Method Details

#message_contentObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

[View source]

34
35
36
37
38
39
40
41
42
43
44
# File 'lib/aws/rails/action_mailbox/sns_notification.rb', line 34

def message_content
  raise MessageContentError, 'Incoming emails must have notificationType `Received`' unless receipt?

  if content_in_s3?
    s3_content
  else
    return message[:content] unless destination

    "X-Original-To: #{destination}\n#{message[:content]}"
  end
end

#subscription_confirmed?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)
[View source]

18
19
20
# File 'lib/aws/rails/action_mailbox/sns_notification.rb', line 18

def subscription_confirmed?
  (200..299).cover?(confirmation_response.code.to_i)
end

#topicObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

[View source]

26
27
28
# File 'lib/aws/rails/action_mailbox/sns_notification.rb', line 26

def topic
  notification.fetch(:TopicArn)
end

#typeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

[View source]

30
31
32
# File 'lib/aws/rails/action_mailbox/sns_notification.rb', line 30

def type
  notification.fetch(:Type)
end

#verified?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)
[View source]

22
23
24
# File 'lib/aws/rails/action_mailbox/sns_notification.rb', line 22

def verified?
  SnsMessageVerifier.verifier.authentic?(@request_body)
end