Class: Shoryuken::Topic
- Inherits:
-
Object
- Object
- Shoryuken::Topic
- Defined in:
- lib/shoryuken/topic.rb
Instance Method Summary collapse
- #arn ⇒ Object
-
#initialize(name, sns) ⇒ Topic
constructor
A new instance of Topic.
- #send_message(body, options = {}) ⇒ Object
Constructor Details
#initialize(name, sns) ⇒ Topic
Returns a new instance of Topic.
3 4 5 |
# File 'lib/shoryuken/topic.rb', line 3 def initialize(name, sns) @name, @sns = name, sns end |
Instance Method Details
#arn ⇒ Object
7 8 9 |
# File 'lib/shoryuken/topic.rb', line 7 def arn @arn ||= Client.sns_arn.new(@name).to_s end |
#send_message(body, options = {}) ⇒ Object
11 12 13 14 15 |
# File 'lib/shoryuken/topic.rb', line 11 def (body, = {}) body = JSON.dump(body) if body.is_a?(Hash) @sns.publish(topic_arn: arn, message: body) end |