blob: 6de442a8e222c616ac9de3b367868b40c3a53feb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class Pubsubhubbub
H = {"User-Agent" => "PubSubHubbub Ruby", "Content-Type" => "application/x-www-form-urlencoded"}
def initialize(hub, options={})
@headers = H.merge(options[:head]) if options[:head]
@hub = hub
end
def publish(feed)
begin
response = RestClient.post(@hub, :headers => @headers, 'hub.url' => feed, 'hub.mode' => 'publish')
return response
rescue RestClient::BadRequest=> e
Rails.logger.warn "Public URL for your users are incorrect. this is ok if you are in development and localhost is your pod_url#{e.inspect}"
end
end
end
|