Class: RisingDragon::SNS::Publisher
- Inherits:
-
Object
- Object
- RisingDragon::SNS::Publisher
- Defined in:
- lib/rising_dragon/sns/publisher.rb
Instance Attribute Summary collapse
-
#use_cache ⇒ Object
Returns the value of attribute use_cache.
Instance Method Summary collapse
-
#initialize(sns_client) ⇒ Publisher
constructor
A new instance of Publisher.
- #publish(topic_name, event_type, data) ⇒ Object
Constructor Details
#initialize(sns_client) ⇒ Publisher
Returns a new instance of Publisher.
5 6 7 8 9 |
# File 'lib/rising_dragon/sns/publisher.rb', line 5 def initialize(sns_client) @sns_client = sns_client @topic_cache = {} @use_cache = true # default true :) end |
Instance Attribute Details
#use_cache ⇒ Object
Returns the value of attribute use_cache.
4 5 6 |
# File 'lib/rising_dragon/sns/publisher.rb', line 4 def use_cache @use_cache end |
Instance Method Details
#publish(topic_name, event_type, data) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/rising_dragon/sns/publisher.rb', line 11 def publish(topic_name, event_type, data) event = create_event(event_type, data) topic = get_topic(topic_name) @sns_client.publish(topic_arn: topic.topic_arn, message: event.to_json) end |