This class is the starting point for working with Amazon Simple Notification Service (SNS).
To use Amazon SNS you must first sign up here.
For more information about Amazon SNS:
You can setup default credentials for all AWS services via AWS.config:
AWS.config( :access_key_id => 'YOUR_ACCESS_KEY_ID', :secret_access_key => 'YOUR_SECRET_ACCESS_KEY')
Or you can set them directly on the SNS interface:
sns = AWS::SNS.new( :access_key_id => 'YOUR_ACCESS_KEY_ID', :secret_access_key => 'YOUR_SECRET_ACCESS_KEY')
# File spec/aws/sns/topic_spec.rb, line 90 def params_for_endpoint(*args) params = nil client.should_receive(:subscribe) do |p| params = p resp end topic.subscribe(*args) params end
# File spec/aws/sns/topic_spec.rb, line 446 def should_receive_publish_with options = {} client.should_receive(:publish).with do |opts| opts[:topic_arn].should == topic.arn opts[:message_structure].should == 'json' JSON.parse(opts[:message]).should == JSON.parse(options.merge(:default => 'message').to_json) end.and_return(response) end
# File spec/aws/sns/subscription_collection_spec.rb, line 33 def stub_two_members(resp) resp.stub(:subscriptions). and_return([double("sub 1", :subscription_arn => "arn1", :endpoint => "e1", :protocol => "p-1", :owner => "o1", :topic_arn => "t1"), double("sub 2", :subscription_arn => "arn2", :endpoint => "e2", :protocol => "p-2", :owner => "o2", :topic_arn => "t2")]) end
@return [SubscriptionCollection] Returns a subscription
collection for managing SNS subscriptions.
# File lib/aws/sns.rb, line 69 def subscriptions SubscriptionCollection.new(:config => config) end
@return [TopicCollection] Returns a topic collection for managing
SNS topics.
# File lib/aws/sns.rb, line 63 def topics TopicCollection.new(:config => config) end