Class: Hootenanny::TopicSynchronizer
- Inherits:
-
Object
- Object
- Hootenanny::TopicSynchronizer
- Defined in:
- lib/hootenanny/topic_synchronizer.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ TopicSynchronizer
constructor
A new instance of TopicSynchronizer.
- #sync ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ TopicSynchronizer
Returns a new instance of TopicSynchronizer.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/hootenanny/topic_synchronizer.rb', line 5 def initialize( = {}) self.subscriber_url = .fetch(:subscriber) self.topic_url = .fetch(:topic) self.digest_secret = .fetch(:digest_secret, nil) self.local_feed_store = [:local_feed_store] || Hootenanny.config.default_local_feed_store self.remote_feed_store = [:remote_feed_store] || Hootenanny.config.default_remote_feed_store self.subscription_delivery = [:subscription_delivery] || Hootenanny.config.default_subscription_delivery end |
Class Method Details
.sync(options = {}) ⇒ Object
18 19 20 |
# File 'lib/hootenanny/topic_synchronizer.rb', line 18 def self.sync( = {}) self.new().sync end |
Instance Method Details
#sync ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/hootenanny/topic_synchronizer.rb', line 22 def sync return true if unsynchronized_feed.empty? if subscription_delivery.deliver( feed: unsynchronized_feed, url: topic_url, subscriber: subscriber_url) local_feed_store.store( feed: remote_feed.to_digest_feed, url: topic_url, type: 'digest', path: subscriber_url.to_digest) else false end end |