Class: RhoDevelopment::SubscriberPartialUpdateNotifyingTask
- Inherits:
-
LiveUpdateTask
- Object
- LiveUpdateTask
- RhoDevelopment::SubscriberPartialUpdateNotifyingTask
- Defined in:
- lib/build/development/live_update_task.rb
Overview
Notifies specified subscriber about a new partial update
Class Method Summary collapse
-
.fromHash(aHash) ⇒ Object
Creates instance of class and parametrises it with values from passed argument.
-
.taskName ⇒ String
Returns unique task name.
Instance Method Summary collapse
-
#action ⇒ Object
Notify the subscriber about partial update bundle.
-
#dispatchToUrl(anUri) ⇒ Object
Method serializes itself to a hash and sends post request with the hash to specified URI.
-
#initialize(aSubscriber, aFilename) ⇒ SubscriberPartialUpdateNotifyingTask
constructor
Initialize instance with instance of Subscriber.
Methods inherited from LiveUpdateTask
Constructor Details
#initialize(aSubscriber, aFilename) ⇒ SubscriberPartialUpdateNotifyingTask
Initialize instance with instance of Subscriber
257 258 259 260 |
# File 'lib/build/development/live_update_task.rb', line 257 def initialize(aSubscriber, aFilename) @subscriber = aSubscriber @filename = aFilename end |
Class Method Details
.fromHash(aHash) ⇒ Object
Creates instance of class and parametrises it with values from passed argument
249 250 251 252 253 |
# File 'lib/build/development/live_update_task.rb', line 249 def self.fromHash(aHash) subscriber = Configuration::subscriber_by_ip(aHash['ip']) filename = aHash['filename'] self.new(subscriber, filename) end |
.taskName ⇒ String
Returns unique task name
242 243 244 |
# File 'lib/build/development/live_update_task.rb', line 242 def self.taskName 'NotifySubscriberAboutPartialUpdate' end |
Instance Method Details
#action ⇒ Object
Notify the subscriber about partial update bundle
263 264 265 |
# File 'lib/build/development/live_update_task.rb', line 263 def action @subscriber.partial_notify(@filename) end |
#dispatchToUrl(anUri) ⇒ Object
Method serializes itself to a hash and sends post request with the hash to specified URI
269 270 271 272 |
# File 'lib/build/development/live_update_task.rb', line 269 def dispatchToUrl(anUri) uri = URI.join(anUri, 'tasks/new') Net::HTTP.post_form(uri, {'taskName' => self.class.taskName, 'ip' => @subscriber.ip, 'filename' => @filename}) end |