-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
40 lines (31 loc) · 1.43 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
SupperfeedrPshb
===============
This is a simple PubSubHubbub client that allows you to easily subscribe and
unsubscribe from feeds. It was initially written for Superfeedr.com but should
work with other hubs although this is untested.
It does not handle the challenge/response part of things but I have included a simple
example of this below. It will not handle recieving updates to your feeds either.
This plugin requires everyones favorite party: HTTParty
So please make sure you install that.
Example
=======
Lets create our happy Pshb'er:
pshb = SuperfeedrPshb::SuperfeedrPshb.new("username", "password",
"http://base.url.of.your.site.with.no.trailing.slash",
"http://yourhub.com/defaults/to/superfeedr/but/is/optional")
Now lets subscribe to a feed:
pshb.subscribe("/your/callback/inc/preceding/slash", "http://feed.com/to/subscribe/to", "verify_token")
Now lets unsubscribe the feed:
pshb.unsubscribe("/your/callback/inc/preceding/slash", "http://feed.com/to/subscribe/to", "verify_token")
Here is an example of a simple controller action to echo back the challenge, you will
also need to handle your feed updates in this action too:
def pshb
if !params["hub.challenge"].nil?
@challenge = params["hub.challenge"]
render :action => "pshb", :status => 200
else
@challenge = "uhoh!"
render :action => "pshb", :status => 404
end
end
Copyright (c) 2009 Eddy Parris http://www.tech-noir.co.uk, released under the MIT license