Class: Rubizon::SimpleNotificationService::Topic

Inherits:
Object
  • Object
show all
Defined in:
lib/rubizon/product/sns.rb

Instance Method Summary collapse

Constructor Details

#initialize(sns, arn) ⇒ Topic

Specify the topic.

sns - An instance of the SimpleNotificationService class arn - Specify the topic’s ARN



36
37
38
39
# File 'lib/rubizon/product/sns.rb', line 36

def initialize(sns,arn)
  @sns= sns
  @arn= arn
end

Instance Method Details

#publish(message, subject = nil) ⇒ Object

Publish a message to the topic.

message - The message you want to send to the topic. subject - Optional parameter to be used as the “Subject” line of when the message is delivered to e-mail endpoints.

Returns the Request object. The url, and its elements may be obtained from the returned request object.



48
49
50
51
52
53
# File 'lib/rubizon/product/sns.rb', line 48

def publish(message,subject=nil)
  request= create_request
  request.add_query_elements('Action'=>'Publish','Message'=>message)
  request.add_query_elements('Subject'=>subject) if subject
  request
end