Class: RightAws::Sns
- Inherits:
-
Object
- Object
- RightAws::Sns
- Defined in:
- lib/sns/right_sns.rb
Overview
RightAws::Sns – RightScale’s Amazon SNS interface
The RightAws::Sns class provides a complete interface to Amazon’s Simple Notification Service. For explanations of the semantics of each call, please refer to Amazon’s documentation at docs.amazonwebservices.com/sns/2010-03-31/api/
Error handling: all operations raise an RightAws::AwsError in case of problems. Note that transient errors are automatically retried.
sns = RightAws::Sns.new(aws_access_key_id, aws_secret_access_key)
topics = sns.topics #=> [<Sns::Topic>, <Sns::Topic>]
topic1 = sns.create_topic('bananas') #=> <Sns::Topic>
topic1.subscribe('email', '[email protected]') #=> true
...
topic1.('Some content', 'An optional subject')
Params is a hash:
{:server => 'sns.us-east-1.amazonaws.com' # Amazon service host: 'sns.us-east-1.amazonaws.com' (default)
:port => 443 # Amazon service port: 80 or 443 (default)
:multi_thread => true|false # Multi-threaded (connection per each thread): true or false (default)
:signature_version => '0' # The signature version : '0' or '1'(default)
:logger => Logger Object} # Logger instance: logs to STDOUT if omitted }
Defined Under Namespace
Classes: Member, Message, Topic
Instance Attribute Summary collapse
-
#interface ⇒ Object
readonly
Returns the value of attribute interface.
Instance Method Summary collapse
-
#create_topic(name) ⇒ Object
Creates a new topic.
-
#initialize(aws_access_key_id = nil, aws_secret_access_key = nil, params = {}) ⇒ Sns
constructor
A new instance of Sns.
-
#topic(arn) ⇒ Object
Returns Topic instance by ARN.
-
#topics ⇒ Object
Retrieves a list of topics.
Constructor Details
#initialize(aws_access_key_id = nil, aws_secret_access_key = nil, params = {}) ⇒ Sns
Returns a new instance of Sns.
55 56 57 |
# File 'lib/sns/right_sns.rb', line 55 def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={}) @interface = SnsInterface.new(aws_access_key_id, aws_secret_access_key, params) end |
Instance Attribute Details
#interface ⇒ Object (readonly)
Returns the value of attribute interface.
53 54 55 |
# File 'lib/sns/right_sns.rb', line 53 def interface @interface end |
Instance Method Details
#create_topic(name) ⇒ Object
Creates a new topic.
76 77 78 |
# File 'lib/sns/right_sns.rb', line 76 def create_topic(name) @interface.create_topic(self, name) end |