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


7
8
9
# File 'lib/pubsubhubbub.rb', line 7

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

Instance Method Details

#publish(feed) ⇒ Object


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

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