Class: AWS::SQS::ReceivedSNSMessage
- Inherits:
-
Object
- Object
- AWS::SQS::ReceivedSNSMessage
- Includes:
- Core::Model
- Defined in:
- lib/aws/sqs/received_sns_message.rb
Overview
Represents message published from an AWS::SNS::Topic to an Queue.
Instance Attribute Summary
Attributes included from Core::Model
Instance Method Summary collapse
-
#body ⇒ Object
@return Returns the decoded message as was published.
-
#initialize(body, options = {}) ⇒ ReceivedSNSMessage
constructor
A new instance of ReceivedSNSMessage.
-
#message_id ⇒ String
Returns the unique id of the SNS message.
-
#message_type ⇒ String
Returns the message type.
-
#published_at ⇒ Time
Returns the time the message was published at by SNS.
-
#raw_message ⇒ String
Returns the JSON hash (as a string) as was published by SNS.
-
#signature ⇒ String
Returns the calculated signature for the message.
-
#signature_version ⇒ String
Returns the signature version.
-
#signing_cert_url ⇒ String
Returns the url for the signing cert.
-
#to_h ⇒ Hash
Returns the decoded message as a hash.
-
#topic ⇒ SNS::Topic
Returns the topic that published this message.
-
#topic_arn ⇒ String
Returns the ARN for the topic that published this message.
-
#unsubscribe_url ⇒ String
Returns the url you can request to unsubscribe message from this queue.
Methods included from Core::Model
#client, #config_prefix, #inspect
Constructor Details
#initialize(body, options = {}) ⇒ ReceivedSNSMessage
Returns a new instance of ReceivedSNSMessage.
28 29 30 31 |
# File 'lib/aws/sqs/received_sns_message.rb', line 28 def initialize body, = {} @body = body super end |
Instance Method Details
#body ⇒ Object
@return Returns the decoded message as was published.
41 42 43 |
# File 'lib/aws/sqs/received_sns_message.rb', line 41 def body to_h[:body] end |
#message_id ⇒ String
Returns the unique id of the SNS message.
78 79 80 |
# File 'lib/aws/sqs/received_sns_message.rb', line 78 def to_h[:message_id] end |
#message_type ⇒ String
Returns the message type.
57 58 59 |
# File 'lib/aws/sqs/received_sns_message.rb', line 57 def to_h[:message_type] end |
#published_at ⇒ Time
Returns the time the message was published at by SNS. by SNS.
73 74 75 |
# File 'lib/aws/sqs/received_sns_message.rb', line 73 def published_at to_h[:published_at] end |
#raw_message ⇒ String
36 37 38 |
# File 'lib/aws/sqs/received_sns_message.rb', line 36 def @body end |
#signature ⇒ String
Returns the calculated signature for the message.
62 63 64 |
# File 'lib/aws/sqs/received_sns_message.rb', line 62 def signature to_h[:signature] end |
#signature_version ⇒ String
Returns the signature version.
67 68 69 |
# File 'lib/aws/sqs/received_sns_message.rb', line 67 def signature_version to_h[:signature_version] end |
#signing_cert_url ⇒ String
Returns the url for the signing cert.
83 84 85 |
# File 'lib/aws/sqs/received_sns_message.rb', line 83 def signing_cert_url to_h[:signing_cert_url] end |
#to_h ⇒ Hash
Returns the decoded message as a hash.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/aws/sqs/received_sns_message.rb', line 94 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 |
#topic ⇒ SNS::Topic
Returns the topic that published this message.
52 53 54 |
# File 'lib/aws/sqs/received_sns_message.rb', line 52 def topic SNS::Topic.new(topic_arn, :config => config) end |
#topic_arn ⇒ String
Returns the ARN for the topic that published this message.
47 48 49 |
# File 'lib/aws/sqs/received_sns_message.rb', line 47 def topic_arn to_h[:topic_arn] end |
#unsubscribe_url ⇒ String
Returns the url you can request to unsubscribe message from this queue.
89 90 91 |
# File 'lib/aws/sqs/received_sns_message.rb', line 89 def unsubscribe_url to_h[:unsubscribe_url] end |