Class: NotificationStanza

Inherits:
Object
  • Object
show all
Includes:
SAXMachine
Defined in:
lib/stanzas/notification_stanza.rb

Overview

Notification : sent every time a feed has been fetched. It has the following methods:

  • message_status : a simple message that gives information about the last fetch

  • http_status : status of the http response

  • feed_url : url of the feed

  • next_fetch : Time when the feed will be fetched again (this is purely informative and it might change)

  • items : array of new items detected (might be empty)

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ NotificationStanza

Returns a new instance of NotificationStanza.



52
53
54
# File 'lib/stanzas/notification_stanza.rb', line 52

def initialize(xml)
  parse(xml.to_s)
end

Instance Method Details

#feed_urlObject



64
65
66
# File 'lib/stanzas/notification_stanza.rb', line 64

def feed_url
  CGI.unescape(@feed_url).gsub("\n", "")
end

#http_statusObject



60
61
62
# File 'lib/stanzas/notification_stanza.rb', line 60

def http_status
  @http_status.to_i
end

#next_fetchObject



56
57
58
# File 'lib/stanzas/notification_stanza.rb', line 56

def next_fetch
  Time.parse(@next_fetch)
end