Class: Circuitry::TopicCreator
- Inherits:
-
Object
- Object
- Circuitry::TopicCreator
- Includes:
- Services::SNS
- Defined in:
- lib/circuitry/topic_creator.rb
Instance Attribute Summary collapse
-
#topic_name ⇒ Object
readonly
Returns the value of attribute topic_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(topic_name) ⇒ TopicCreator
constructor
A new instance of TopicCreator.
- #topic ⇒ Object
Methods included from Services::SNS
Constructor Details
#initialize(topic_name) ⇒ TopicCreator
Returns a new instance of TopicCreator.
16 17 18 |
# File 'lib/circuitry/topic_creator.rb', line 16 def initialize(topic_name) @topic_name = topic_name end |
Instance Attribute Details
#topic_name ⇒ Object (readonly)
Returns the value of attribute topic_name.
10 11 12 |
# File 'lib/circuitry/topic_creator.rb', line 10 def topic_name @topic_name end |
Class Method Details
.find_or_create(topic_name) ⇒ Object
12 13 14 |
# File 'lib/circuitry/topic_creator.rb', line 12 def self.find_or_create(topic_name) new(topic_name).topic end |
Instance Method Details
#topic ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/circuitry/topic_creator.rb', line 20 def topic return @topic if defined?(@topic) response = sns.create_topic(topic_name) arn = response.body.fetch('TopicArn') { raise TopicCreatorError.new('No TopicArn returned from SNS') } @topic = Topic.new(arn) end |