class AWS::SQS::ReceivedSNSMessage

Represents message published from an {SNS::Topic} to an {SQS::Queue}.

def body

@return[String] Returns the decoded message as was published.
def body
  to_h[:body]
end

def initialize body, options = {}

Parameters:
  • options (Hash) --
  • body (String) -- The SQS message body
def initialize body, options = {}
  @body = body
  super
end

def message_id

Returns:
  • (String) - Returns the unique id of the SNS message.
def message_id
  to_h[:message_id]
end

def message_type

Returns:
  • (String) - Returns the message type.
def message_type
  to_h[:message_type]
end

def published_at

Returns:
  • (Time) - Returns the time the message was published at by SNS.
def published_at
  to_h[:published_at]
end

def raw_message

Returns:
  • (String) - Returns the JSON hash (as a string) as was
def raw_message
  @body
end

def signature

Returns:
  • (String) - Returns the calculated signature for the message.
def signature
  to_h[:signature]
end

def signature_version

Returns:
  • (String) - Returns the signature version.
def signature_version
  to_h[:signature_version]
end

def signing_cert_url

Returns:
  • (String) - Returns the url for the signing cert.
def signing_cert_url
  to_h[:signing_cert_url]
end

def to_h

Returns:
  • (Hash) - Returns the decoded message as a hash.
def to_h
  data = JSON.parse(@body)
  {
    :body => data['Message'],
    :topic_arn => data['TopicArn'],
    :message_type => data['Type'],
    :signature => data['Signature'],
    :signature_version => data['SignatureVersion'],
    :published_at => Time.parse(data['Timestamp']),
    :message_id => data['MessageId'],
    :signing_cert_url => data['SigningCertURL'],
    :unsubscribe_url => data['UnsubscribeURL'],
  }
end

def topic

Returns:
  • (SNS::Topic) - Returns the topic that published this message.
def topic
  SNS::Topic.new(topic_arn, :config => config)
end

def topic_arn

Returns:
  • (String) - Returns the ARN for the topic that published this
def topic_arn
  to_h[:topic_arn]
end

def unsubscribe_url

Returns:
  • (String) - Returns the url you can request to unsubscribe message
def unsubscribe_url
  to_h[:unsubscribe_url]
end