superfeedr-ruby 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/stanzas/notification_stanza.rb +211 -28
- data/lib/superfeedr.rb +8 -4
- data/spec/stanzas/notifications_stanza_spec.rb +120 -31
- data/spec/superfeedr_ruby_spec.rb +2 -2
- metadata +24 -13
data/VERSION.yml
CHANGED
@@ -9,31 +9,177 @@
|
|
9
9
|
# - chunks (long entries might be notified in several chunks)
|
10
10
|
# - chunk (current chunk out of chunks)
|
11
11
|
#
|
12
|
-
|
12
|
+
# <item xmlns="http://jabber.org/protocol/pubsub" chunks="2" chunk="1">
|
13
|
+
# <entry xmlns="http://www.w3.org/2005/Atom" xml:lang="">
|
14
|
+
# <title>cool</title>
|
15
|
+
# <content type="text">cool</content>
|
16
|
+
# <id>tag:pubhubsubbub-example-app,2009:ahhwdWJzdWJodWJidWItZXhhbXBsZS1hcHByDQsSBUVudHJ5GMGOEAw</id>
|
17
|
+
# <published>2010-03-25T16:57:18Z</published>
|
18
|
+
# <link type="text/html" href="http://pubsubhubbub-example-app.appspot.com/ahhwdWJzdWJodWJidWItZXhhbXBsZS1hcHByDQsSBUVudHJ5GMGOEAw" title="" rel="alternate"/>
|
19
|
+
# </entry>
|
20
|
+
# </item>
|
21
|
+
|
22
|
+
class Link
|
23
|
+
def initialize(node)
|
24
|
+
@node = node
|
25
|
+
end
|
26
|
+
|
27
|
+
def title
|
28
|
+
@node["title"]
|
29
|
+
end
|
30
|
+
|
31
|
+
def href
|
32
|
+
@node["href"]
|
33
|
+
end
|
34
|
+
|
35
|
+
def rel
|
36
|
+
@node["rel"]
|
37
|
+
end
|
38
|
+
|
39
|
+
def type
|
40
|
+
@node["type"]
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
class Author
|
46
|
+
def initialize(node)
|
47
|
+
@node = node
|
48
|
+
end
|
49
|
+
|
50
|
+
def name
|
51
|
+
if !@name
|
52
|
+
if name = @node.at_xpath("./atom:name", {"atom" => "http://www.w3.org/2005/Atom"})
|
53
|
+
@name = name.text
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def uri
|
59
|
+
if !@uri
|
60
|
+
if uri = @node.at_xpath("./atom:uri", {"atom" => "http://www.w3.org/2005/Atom"})
|
61
|
+
@uri = uri.text
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def email
|
67
|
+
if !@email
|
68
|
+
if email = @node.at_xpath("./atom:email", {"atom" => "http://www.w3.org/2005/Atom"})
|
69
|
+
@email = email.text
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
class Category
|
77
|
+
def initialize(node)
|
78
|
+
@node = node
|
79
|
+
end
|
80
|
+
|
81
|
+
def term
|
82
|
+
@node["term"]
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
class Location
|
87
|
+
def initialize(node)
|
88
|
+
@node = node
|
89
|
+
end
|
90
|
+
|
91
|
+
def point
|
92
|
+
@point ||= @node.text
|
93
|
+
end
|
94
|
+
|
95
|
+
def lat
|
96
|
+
@lat ||= point.split().first.to_f
|
97
|
+
end
|
98
|
+
|
99
|
+
def lon
|
100
|
+
@lon ||= point.split().last.to_f
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
13
105
|
class Item
|
14
|
-
include SAXMachine
|
15
|
-
element :item, :as => :chunk, :value => :chunk
|
16
|
-
element :item, :as => :chunks, :value => :chunks
|
17
|
-
element :title
|
18
|
-
element :summary
|
19
|
-
element :link, :as => :link, :value => :href
|
20
|
-
element :id, :as => :unique_id
|
21
|
-
element :published
|
22
106
|
|
23
|
-
def
|
24
|
-
|
107
|
+
def initialize(node)
|
108
|
+
@node = node
|
109
|
+
end
|
110
|
+
|
111
|
+
def title
|
112
|
+
@title ||= @node.at_xpath("./atom:entry/atom:title", {"atom" => "http://www.w3.org/2005/Atom"}).text
|
113
|
+
end
|
114
|
+
|
115
|
+
def summary
|
116
|
+
if !@summary
|
117
|
+
if summary = @node.at_xpath("./atom:entry/atom:summary", {"atom" => "http://www.w3.org/2005/Atom"})
|
118
|
+
@summary = summary.text
|
119
|
+
end
|
120
|
+
end
|
121
|
+
@summary
|
122
|
+
end
|
123
|
+
|
124
|
+
def unique_id
|
125
|
+
@unique_id ||= @node.at_xpath("./atom:entry/atom:id", {"atom" => "http://www.w3.org/2005/Atom"}).text
|
25
126
|
end
|
26
127
|
|
27
128
|
def published
|
28
|
-
|
129
|
+
if !@published
|
130
|
+
if published = @node.at_xpath("./atom:entry/atom:published", {"atom" => "http://www.w3.org/2005/Atom"}).text
|
131
|
+
@published = Time.parse(published)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
@published
|
29
135
|
end
|
30
136
|
|
31
137
|
def chunks
|
32
|
-
@chunks.to_i
|
138
|
+
@node["chunks"].to_i
|
33
139
|
end
|
34
140
|
|
35
141
|
def chunk
|
36
|
-
@chunk.to_i
|
142
|
+
@node["chunk"].to_i
|
143
|
+
end
|
144
|
+
|
145
|
+
def links
|
146
|
+
if !@links
|
147
|
+
@links = []
|
148
|
+
@node.xpath("./atom:entry/atom:link", {"atom" => "http://www.w3.org/2005/Atom"}).each do |node|
|
149
|
+
@links.push(Link.new(node))
|
150
|
+
end
|
151
|
+
end
|
152
|
+
@links
|
153
|
+
end
|
154
|
+
|
155
|
+
def authors
|
156
|
+
if !@authors
|
157
|
+
@authors = []
|
158
|
+
@node.xpath("./atom:entry/atom:author", {"atom" => "http://www.w3.org/2005/Atom"}).each do |node|
|
159
|
+
@authors.push(Author.new(node))
|
160
|
+
end
|
161
|
+
end
|
162
|
+
@authors
|
163
|
+
end
|
164
|
+
|
165
|
+
def categories
|
166
|
+
if !@categories
|
167
|
+
@categories = []
|
168
|
+
@node.xpath("./atom:entry/atom:category", {"atom" => "http://www.w3.org/2005/Atom"}).each do |node|
|
169
|
+
@categories.push(Category.new(node))
|
170
|
+
end
|
171
|
+
end
|
172
|
+
@categories
|
173
|
+
end
|
174
|
+
|
175
|
+
def locations
|
176
|
+
if !@locations
|
177
|
+
@locations = []
|
178
|
+
@node.xpath("./atom:entry/georss:point", {"atom" => "http://www.w3.org/2005/Atom", "georss" => "http://www.georss.org/georss"}).each do |node|
|
179
|
+
@locations.push(Location.new(node))
|
180
|
+
end
|
181
|
+
end
|
182
|
+
@locations
|
37
183
|
end
|
38
184
|
|
39
185
|
end
|
@@ -46,30 +192,67 @@ end
|
|
46
192
|
# - feed_url : url of the feed
|
47
193
|
# - next_fetch : Time when the feed will be fetched again (this is purely informative and it might change)
|
48
194
|
# - items : array of new items detected (might be empty)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
195
|
+
#
|
196
|
+
#
|
197
|
+
# <message xmlns="jabber:client" from="firehoser.superfeedr.com" to="julien@superfeedr.com">
|
198
|
+
# <event xmlns="http://jabber.org/protocol/pubsub#event">
|
199
|
+
# <status xmlns="http://superfeedr.com/xmpp-pubsub-ext" feed="http://pubsubhubbub-example-app.appspot.com/feed">
|
200
|
+
# <http code="200">25002 bytes fetched in 0.73s for 1 new entries.</http>
|
201
|
+
# <next_fetch>2010-03-25T17:06:30+00:00</next_fetch>
|
202
|
+
# <title>PubSubHubBub example app</title>
|
203
|
+
# </status>
|
204
|
+
# <items node="http://pubsubhubbub-example-app.appspot.com/feed">
|
205
|
+
# <item xmlns="http://jabber.org/protocol/pubsub" chunks="1" chunk="1">
|
206
|
+
# <entry xmlns="http://www.w3.org/2005/Atom" xml:lang="" xmlns:xml="http://www.w3.org/XML/1998/namespace">
|
207
|
+
# <title>cool</title>
|
208
|
+
# <content type="text">cool</content>
|
209
|
+
# <id>tag:pubhubsubbub-example-app,2009:ahhwdWJzdWJodWJidWItZXhhbXBsZS1hcHByDQsSBUVudHJ5GMGOEAw</id>
|
210
|
+
# <published>2010-03-25T16:57:18Z</published>
|
211
|
+
# <link type="text/html" href="http://pubsubhubbub-example-app.appspot.com/ahhwdWJzdWJodWJidWItZXhhbXBsZS1hcHByDQsSBUVudHJ5GMGOEAw" title="" rel="alternate"/>
|
212
|
+
# </entry>
|
213
|
+
# <entry xmlns="http://www.w3.org/2005/Atom" xml:lang="" xmlns:xml="http://www.w3.org/XML/1998/namespace">
|
214
|
+
# <title>great</title>
|
215
|
+
# <content type="text">great</content>
|
216
|
+
# <id>tag:pubhubsubbub-example-app,2009:ahhwdWJzdWJodWJidWItZXhhbXBsZS1hcHByDQsSBUVudHJ5GMGOEAx</id>
|
217
|
+
# <published>2010-03-25T16:57:19Z</published>
|
218
|
+
# <link type="text/html" href="http://pubsubhubbub-example-app.appspot.com/ahhwdWJzdWJodWJidWItZXhhbXBsZS1hcHByDQsSBUVudHJ5GMGOEAx" title="" rel="alternate"/>
|
219
|
+
# </entry>
|
220
|
+
# </item>
|
221
|
+
# </items>
|
222
|
+
# </event>
|
223
|
+
# </message>
|
224
|
+
|
225
|
+
class NotificationStanza < Skates::Base::Stanza
|
55
226
|
|
56
227
|
def next_fetch
|
57
|
-
|
228
|
+
if !@next_fetch
|
229
|
+
time = @node.at_xpath("./ps:event/sf:status/sf:next_fetch", {"ps" => "http://jabber.org/protocol/pubsub#event", "sf" => "http://superfeedr.com/xmpp-pubsub-ext"}).text
|
230
|
+
@next_fetch = Time.parse(time)
|
231
|
+
end
|
232
|
+
@next_fetch
|
58
233
|
end
|
59
234
|
|
60
235
|
def http_status
|
61
|
-
@http_status.to_i
|
236
|
+
@http_status ||= @node.at_xpath("./ps:event/sf:status/sf:http/@code", {"ps" => "http://jabber.org/protocol/pubsub#event", "sf" => "http://superfeedr.com/xmpp-pubsub-ext"}).text.to_i
|
62
237
|
end
|
63
238
|
|
64
239
|
def feed_url
|
65
|
-
|
240
|
+
@feed_url ||= @node.at_xpath("./ps:event/sf:status/@feed", {"ps" => "http://jabber.org/protocol/pubsub#event", "sf" => "http://superfeedr.com/xmpp-pubsub-ext"}).text
|
66
241
|
end
|
67
242
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
243
|
+
def message_status
|
244
|
+
@message_status ||= @node.at_xpath("./ps:event/sf:status/sf:http", {"ps" => "http://jabber.org/protocol/pubsub#event", "sf" => "http://superfeedr.com/xmpp-pubsub-ext"}).text
|
245
|
+
end
|
246
|
+
|
247
|
+
def entries
|
248
|
+
if !@entries
|
249
|
+
@entries = []
|
250
|
+
@node.xpath("./ps:event/ps:items/ps2:item", {"ps" => "http://jabber.org/protocol/pubsub#event", "ps2" => "http://jabber.org/protocol/pubsub"}).each do |node|
|
251
|
+
@entries.push(Item.new(node))
|
252
|
+
end
|
253
|
+
end
|
254
|
+
@entries
|
255
|
+
end
|
73
256
|
|
74
257
|
end
|
75
258
|
|
data/lib/superfeedr.rb
CHANGED
@@ -137,8 +137,12 @@ module Superfeedr
|
|
137
137
|
##
|
138
138
|
# Called with a response to a subscriptions listing
|
139
139
|
def self.on_subscriptions(stanza, &block)
|
140
|
-
|
141
|
-
|
140
|
+
xmlns = {
|
141
|
+
'pubsub' => 'http://jabber.org/protocol/pubsub',
|
142
|
+
'superfeedr' => 'http://superfeedr.com/xmpp-pubsub-ext'
|
143
|
+
}
|
144
|
+
page = stanza.xpath('//pubsub:subscriptions/@superfeedr:page', xmlns).to_s.to_i
|
145
|
+
feeds = stanza.xpath('//pubsub:subscription', xmlns).map { |s| CGI.unescapeHTML(s["node"]) }
|
142
146
|
block.call(page, feeds)
|
143
147
|
end
|
144
148
|
|
@@ -192,7 +196,7 @@ module Superfeedr
|
|
192
196
|
@@callbacks[stanza["id"]][:method].call(stanza, &@@callbacks[stanza["id"]][:param])
|
193
197
|
@@callbacks.delete(stanza["id"])
|
194
198
|
else
|
195
|
-
if stanza.name == "message" and stanza.
|
199
|
+
if stanza.name == "message" and !stanza.xpath("./ps:event", {"ps" => "http://jabber.org/protocol/pubsub#event"}).empty?
|
196
200
|
@@notification_callback.call(NotificationStanza.new(stanza)) if @@notification_callback
|
197
201
|
# Here we need to call the main notification callback!
|
198
202
|
end
|
@@ -206,4 +210,4 @@ module Superfeedr
|
|
206
210
|
end
|
207
211
|
|
208
212
|
|
209
|
-
end
|
213
|
+
end
|
@@ -3,50 +3,62 @@ describe NotificationStanza do
|
|
3
3
|
|
4
4
|
before(:each) do
|
5
5
|
xml = <<-EOXML
|
6
|
-
<message from=
|
7
|
-
<event xmlns=
|
8
|
-
<status
|
9
|
-
<http code="200">
|
10
|
-
<next_fetch>
|
6
|
+
<message xmlns="jabber:client" from="firehoser.superfeedr.com" to="julien@superfeedr.com">
|
7
|
+
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
8
|
+
<status xmlns="http://superfeedr.com/xmpp-pubsub-ext" feed="http://pubsubhubbub-example-app.appspot.com/feed">
|
9
|
+
<http code="200">25002 bytes fetched in 0.73s for 1 new entries.</http>
|
10
|
+
<next_fetch>2010-03-25T17:06:30+00:00</next_fetch>
|
11
|
+
<title>PubSubHubBub example app</title>
|
11
12
|
</status>
|
12
|
-
<items node=
|
13
|
-
<item
|
14
|
-
<entry xmlns=
|
15
|
-
<
|
13
|
+
<items node="http://pubsubhubbub-example-app.appspot.com/feed">
|
14
|
+
<item xmlns="http://jabber.org/protocol/pubsub" chunks="2" chunk="1">
|
15
|
+
<entry xmlns="http://www.w3.org/2005/Atom" xml:lang="" xmlns:xml="http://www.w3.org/XML/1998/namespace">
|
16
|
+
<id>tag:pubhubsubbub-example-app,2009:ahhwdWJzdWJodWJidWItZXhhbXBsZS1hcHByDQsSBUVudHJ5GMGOEAw</id>
|
17
|
+
<title>cool</title>
|
18
|
+
<content type="text">cool</content>
|
16
19
|
<summary>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</summary>
|
17
|
-
<
|
18
|
-
<
|
19
|
-
<
|
20
|
+
<published>2010-03-25T16:57:18Z</published>
|
21
|
+
<link type="text/html" href="http://pubsubhubbub-example-app.appspot.com/ahhwdWJzdWJodWJidWItZXhhbXBsZS1hcHByDQsSBUVudHJ5GMGOEAw" title="cool" rel="alternate"/>
|
22
|
+
<link href="http://domain.tld/entries/12345/comments.xml" rel="replies" type="application/atom+xml" />
|
23
|
+
<point xmlns="http://www.georss.org/georss">47.597553 -122.15925</point>
|
24
|
+
<author>
|
25
|
+
<name>John Doe</name>
|
26
|
+
<email>john@superfeedr.com</email>
|
27
|
+
</author>
|
28
|
+
<category term="tag" scheme="http://www.sixapart.com/ns/types#tag" />
|
29
|
+
<category term="category" scheme="http://www.sixapart.com/ns/types#tag" />
|
20
30
|
</entry>
|
21
31
|
</item>
|
22
|
-
<item
|
23
|
-
<entry xmlns=
|
24
|
-
<title>
|
25
|
-
<
|
26
|
-
<
|
27
|
-
<
|
28
|
-
<
|
32
|
+
<item xmlns="http://jabber.org/protocol/pubsub" chunks="2" chunk="2">
|
33
|
+
<entry xmlns="http://www.w3.org/2005/Atom" xml:lang="" xmlns:xml="http://www.w3.org/XML/1998/namespace">
|
34
|
+
<title>great</title>
|
35
|
+
<content type="text">great</content>
|
36
|
+
<id>tag:pubhubsubbub-example-app,2009:ahhwdWJzdWJodWJidWItZXhhbXBsZS1hcHByDQsSBUVudHJ5GMGOEAx</id>
|
37
|
+
<published>2010-03-25T16:57:19Z</published>
|
38
|
+
<link type="text/html" href="http://pubsubhubbub-example-app.appspot.com/ahhwdWJzdWJodWJidWItZXhhbXBsZS1hcHByDQsSBUVudHJ5GMGOEAx" title="" rel="alternate"/>
|
29
39
|
</entry>
|
30
40
|
</item>
|
31
41
|
</items>
|
32
42
|
</event>
|
33
43
|
</message>
|
34
44
|
EOXML
|
35
|
-
@stanza = NotificationStanza.new(xml)
|
45
|
+
@stanza = NotificationStanza.new(Nokogiri::XML(xml).root)
|
36
46
|
end
|
37
47
|
|
38
48
|
it "should have the right feed_url" do
|
39
|
-
@stanza.feed_url.should == "http://
|
49
|
+
@stanza.feed_url.should == "http://pubsubhubbub-example-app.appspot.com/feed"
|
40
50
|
end
|
41
51
|
|
42
|
-
it "should have the right message_status"
|
52
|
+
it "should have the right message_status" do
|
53
|
+
@stanza.message_status.should == "25002 bytes fetched in 0.73s for 1 new entries."
|
54
|
+
end
|
43
55
|
|
44
56
|
it "should have the right http_status" do
|
45
57
|
@stanza.http_status.should == 200
|
46
58
|
end
|
47
59
|
|
48
60
|
it "should have the have the right next_fetch" do
|
49
|
-
@stanza.next_fetch.should == Time.parse("
|
61
|
+
@stanza.next_fetch.should == Time.parse("2010-03-25T17:06:30+00:00")
|
50
62
|
end
|
51
63
|
|
52
64
|
it "should have the right number of items" do
|
@@ -67,25 +79,102 @@ describe NotificationStanza do
|
|
67
79
|
end
|
68
80
|
|
69
81
|
it "should have the right title" do
|
70
|
-
@item.title.should == "
|
82
|
+
@item.title.should == "cool"
|
71
83
|
end
|
72
84
|
|
73
85
|
it "should have the right summary" do
|
74
86
|
@item.summary.should == "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
|
75
87
|
end
|
76
88
|
|
77
|
-
it "should have the right link" do
|
78
|
-
@item.link.should == "http://superfeedr.com/entries/12345789"
|
79
|
-
end
|
80
|
-
|
81
89
|
it "should have the right unique_id" do
|
82
|
-
@item.unique_id.should == "tag:
|
90
|
+
@item.unique_id.should == "tag:pubhubsubbub-example-app,2009:ahhwdWJzdWJodWJidWItZXhhbXBsZS1hcHByDQsSBUVudHJ5GMGOEAw"
|
83
91
|
end
|
84
92
|
|
85
93
|
it "should have the right published" do
|
86
|
-
@item.published.should == Time.parse("2010-
|
94
|
+
@item.published.should == Time.parse("2010-03-25T16:57:18Z")
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should have the right number of links" do
|
98
|
+
@item.should have(2).links
|
87
99
|
end
|
88
100
|
|
101
|
+
describe "links" do
|
102
|
+
before(:each) do
|
103
|
+
@link = @item.links.first
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should have the right title" do
|
107
|
+
@link.title.should == "cool"
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should have the right href" do
|
111
|
+
@link.href.should == "http://pubsubhubbub-example-app.appspot.com/ahhwdWJzdWJodWJidWItZXhhbXBsZS1hcHByDQsSBUVudHJ5GMGOEAw"
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should have the right rel" do
|
115
|
+
@link.rel.should == "alternate"
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should have the right mime type" do
|
119
|
+
@link.type.should == "text/html"
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should have the right number of locations" do
|
125
|
+
@item.should have(1).locations
|
126
|
+
end
|
127
|
+
|
128
|
+
describe "locations" do
|
129
|
+
before(:each) do
|
130
|
+
@location = @item.locations.first
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should have the right lat" do
|
134
|
+
@location.lat.should == 47.597553
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should have the right lon" do
|
138
|
+
@location.lon.should == -122.15925
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should have the right number of authors" do
|
144
|
+
@item.should have(1).authors
|
145
|
+
end
|
146
|
+
|
147
|
+
describe "authors" do
|
148
|
+
before(:each) do
|
149
|
+
@author = @item.authors.first
|
150
|
+
end
|
151
|
+
|
152
|
+
it "should have the right name" do
|
153
|
+
@author.name.should == "John Doe"
|
154
|
+
end
|
155
|
+
|
156
|
+
it "should have the right uri" do
|
157
|
+
@author.uri.should == nil
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should have the right email" do
|
161
|
+
@author.email.should == "john@superfeedr.com"
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
165
|
+
|
166
|
+
it "should have the right number of categories" do
|
167
|
+
@item.should have(2).categories
|
168
|
+
end
|
169
|
+
|
170
|
+
describe "categories" do
|
171
|
+
before(:each) do
|
172
|
+
@category = @item.categories.first
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should have the right term" do
|
176
|
+
@category.term.should == "tag"
|
177
|
+
end
|
178
|
+
end
|
89
179
|
end
|
90
|
-
|
91
180
|
end
|
@@ -217,8 +217,8 @@ EOXML
|
|
217
217
|
it "should call the block with the page number and the list of feeds as an array" do
|
218
218
|
xml = <<-EOXML
|
219
219
|
<iq type="result" to="you@superfeedr.com/home" id="subman1" from="firehoser.superfeedr.com">
|
220
|
-
<pubsub>
|
221
|
-
<subscriptions page="3">
|
220
|
+
<pubsub xmlns:superfeedr='http://superfeedr.com/xmpp-pubsub-ext' xmlns='http://jabber.org/protocol/pubsub'>
|
221
|
+
<subscriptions superfeedr:page="3">
|
222
222
|
<subscription node="http://domain.tld/path/to/a/feed/atom.xml&toto=tutu" subscription="subscribed" jid="you@superfeedr.com" />
|
223
223
|
<subscription node="http://domain2.tld/path/to/feed.rss" subscription="subscribed" jid="you@superfeedr.com" />
|
224
224
|
</subscriptions>
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: superfeedr-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 4
|
8
|
+
- 2
|
9
|
+
version: 0.4.2
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- julien Genestoux
|
@@ -9,29 +14,33 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-03-25 00:00:00 +01:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: skates
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
23
29
|
version: "0"
|
24
|
-
|
30
|
+
type: :runtime
|
31
|
+
version_requirements: *id001
|
25
32
|
- !ruby/object:Gem::Dependency
|
26
33
|
name: nokogiri
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
34
|
+
prerelease: false
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
39
|
+
segments:
|
40
|
+
- 0
|
33
41
|
version: "0"
|
34
|
-
|
42
|
+
type: :runtime
|
43
|
+
version_requirements: *id002
|
35
44
|
description:
|
36
45
|
email: julien.genestoux@gmail.com
|
37
46
|
executables: []
|
@@ -74,18 +83,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
83
|
requirements:
|
75
84
|
- - ">="
|
76
85
|
- !ruby/object:Gem::Version
|
86
|
+
segments:
|
87
|
+
- 0
|
77
88
|
version: "0"
|
78
|
-
version:
|
79
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
90
|
requirements:
|
81
91
|
- - ">="
|
82
92
|
- !ruby/object:Gem::Version
|
93
|
+
segments:
|
94
|
+
- 0
|
83
95
|
version: "0"
|
84
|
-
version:
|
85
96
|
requirements: []
|
86
97
|
|
87
98
|
rubyforge_project: superfeedr-ruby
|
88
|
-
rubygems_version: 1.3.
|
99
|
+
rubygems_version: 1.3.6
|
89
100
|
signing_key:
|
90
101
|
specification_version: 3
|
91
102
|
summary: Ruby Client for the Superfeedr
|