Class: PushNotify::Content
- Inherits:
-
Object
- Object
- PushNotify::Content
- Defined in:
- lib/push-notify.rb
Overview
A collection of URLs representing updated content.
Instance Attribute Summary collapse
-
#new_content_urls ⇒ Object
readonly
Returns the value of attribute new_content_urls.
Instance Method Summary collapse
-
#initialize(*new_content_urls) ⇒ Content
constructor
A new instance of Content.
-
#tell(*hub_urls) ⇒ Object
Notify pubsubhubbub hubs that this content has been updated.
Constructor Details
#initialize(*new_content_urls) ⇒ Content
Returns a new instance of Content.
10 11 12 |
# File 'lib/push-notify.rb', line 10 def initialize(*new_content_urls) @new_content_urls = new_content_urls end |
Instance Attribute Details
#new_content_urls ⇒ Object (readonly)
Returns the value of attribute new_content_urls.
30 31 32 |
# File 'lib/push-notify.rb', line 30 def new_content_urls @new_content_urls end |
Instance Method Details
#tell(*hub_urls) ⇒ Object
Notify pubsubhubbub hubs that this content has been updated.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/push-notify.rb', line 15 def tell(*hub_urls) hub_urls.each do |hub_url| hub_uri = hub_url.is_a?(URI) ? hub_url : URI(hub_url) # pubsubhubbub supports multiple hub.url fields in one POST but # net/http does not new_content_urls.each do |new_content_url| resp = Net::HTTP.post_form(hub_uri, { 'hub.mode' => 'publish', 'hub.url' => new_content_url }) yield resp if block_given? end end end |