superfeedr-ruby 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 4
4
- :patch: 2
4
+ :patch: 3
@@ -223,31 +223,40 @@ end
223
223
  # </message>
224
224
 
225
225
  class NotificationStanza < Skates::Base::Stanza
226
+
227
+ XMLNS = {
228
+ "ps" => "http://jabber.org/protocol/pubsub#event",
229
+ "ps2" => "http://jabber.org/protocol/pubsub",
230
+ "sf" => "http://superfeedr.com/xmpp-pubsub-ext" } unless defined? XMLNS
226
231
 
227
232
  def next_fetch
228
233
  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
234
+ time = @node.at_xpath("./ps:event/sf:status/sf:next_fetch", XMLNS).text
230
235
  @next_fetch = Time.parse(time)
231
236
  end
232
237
  @next_fetch
233
238
  end
234
239
 
235
240
  def http_status
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
241
+ @http_status ||= @node.at_xpath("./ps:event/sf:status/sf:http/@code", XMLNS).text.to_i
237
242
  end
238
243
 
239
244
  def feed_url
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
245
+ @feed_url ||= @node.at_xpath("./ps:event/sf:status/@feed", XMLNS).text
241
246
  end
242
247
 
243
248
  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
249
+ @message_status ||= @node.at_xpath("./ps:event/sf:status/sf:http", XMLNS).text
250
+ end
251
+
252
+ def title
253
+ @title ||= @node.at_xpath("./ps:event/sf:status/sf:title", XMLNS).text
245
254
  end
246
255
 
247
256
  def entries
248
257
  if !@entries
249
258
  @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|
259
+ @node.xpath("./ps:event/ps:items/ps2:item", XMLNS).each do |node|
251
260
  @entries.push(Item.new(node))
252
261
  end
253
262
  end
@@ -57,9 +57,13 @@ describe NotificationStanza do
57
57
  @stanza.http_status.should == 200
58
58
  end
59
59
 
60
- it "should have the have the right next_fetch" do
60
+ it "should have the right next_fetch" do
61
61
  @stanza.next_fetch.should == Time.parse("2010-03-25T17:06:30+00:00")
62
62
  end
63
+
64
+ it "should have the title" do
65
+ @stanza.title.should == 'PubSubHubBub example app'
66
+ end
63
67
 
64
68
  it "should have the right number of items" do
65
69
  @stanza.entries.count.should == 2
@@ -177,4 +181,4 @@ describe NotificationStanza do
177
181
  end
178
182
  end
179
183
  end
180
- end
184
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 2
9
- version: 0.4.2
8
+ - 3
9
+ version: 0.4.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - julien Genestoux
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-25 00:00:00 +01:00
17
+ date: 2010-03-30 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency