Class: Pubsubhubbub

Inherits:
Object
  • Object
show all
Defined in:
lib/pubsubhubbub.rb

Instance Method Summary collapse

Constructor Details

#initialize(hub, options = {}) ⇒ Pubsubhubbub

Returns a new instance of Pubsubhubbub.


9
10
11
# File 'lib/pubsubhubbub.rb', line 9

def initialize(hub, options={})
  @hub = hub
end

Instance Method Details

#publish(feed) ⇒ Object


13
14
15
16
17
18
19
20
# File 'lib/pubsubhubbub.rb', line 13

def publish(feed)

  conn = Faraday.new do |c|
    c.use Faraday::Request::UrlEncoded  # encode request params as "www-form-urlencoded"
    c.use Faraday::Adapter::NetHttp     # perform requests with Net::HTTP
  end
  conn.post @hub, {'hub.url' => feed, 'hub.mode' => 'publish'}
end