Class: Superfeedr::Entry
- Inherits:
-
Blather::Stanza::PubSubItem
- Object
- Blather::Stanza::PubSubItem
- Superfeedr::Entry
- Defined in:
- lib/superfeedr/entry.rb
Defined Under Namespace
Constant Summary collapse
- NS =
'http://www.w3.org/2005/Atom'.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #authors ⇒ Object
- #categories ⇒ Object
- #chunk ⇒ Object
- #chunks ⇒ Object
- #content ⇒ Object
- #entry ⇒ Object
- #id ⇒ Object
- #links ⇒ Object
- #published ⇒ Object
- #summary ⇒ Object
- #title ⇒ Object
Class Method Details
.parse(node) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/superfeedr/entry.rb', line 5 def self.parse(node) node.find('//ns:event/ns:items/ns2:item', :ns => Blather::Stanza::PubSub::Event.registered_ns, :ns2 => Blather::Stanza::PubSub.registered_ns).map do |item| Entry.new('item').inherit(item) end end |
Instance Method Details
#authors ⇒ Object
50 51 52 |
# File 'lib/superfeedr/entry.rb', line 50 def self.entry.find('ns:author', :ns => NS).map { |l| Author.new.inherit(l) } end |
#categories ⇒ Object
42 43 44 |
# File 'lib/superfeedr/entry.rb', line 42 def categories self.entry.find('ns:category', :ns => NS).map { |cat| cat[:term] } end |
#chunk ⇒ Object
16 17 18 |
# File 'lib/superfeedr/entry.rb', line 16 def chunk self[:chunk].to_i end |
#chunks ⇒ Object
12 13 14 |
# File 'lib/superfeedr/entry.rb', line 12 def chunks self[:chunks].to_i end |
#content ⇒ Object
34 35 36 |
# File 'lib/superfeedr/entry.rb', line 34 def content self.entry.content_from 'ns:content', :ns => NS end |
#entry ⇒ Object
54 55 56 |
# File 'lib/superfeedr/entry.rb', line 54 def entry Blather::XMPPNode.import(super) end |
#id ⇒ Object
20 21 22 |
# File 'lib/superfeedr/entry.rb', line 20 def id self.entry.content_from 'ns:id', :ns => NS end |
#links ⇒ Object
46 47 48 |
# File 'lib/superfeedr/entry.rb', line 46 def links self.entry.find('ns:link', :ns => NS).map { |l| Link.new.inherit(l) } end |
#published ⇒ Object
28 29 30 31 32 |
# File 'lib/superfeedr/entry.rb', line 28 def published if published = self.entry.content_from('ns:published', :ns => NS) DateTime.parse published end end |
#summary ⇒ Object
38 39 40 |
# File 'lib/superfeedr/entry.rb', line 38 def summary self.entry.content_from 'ns:summary', :ns => NS end |
#title ⇒ Object
24 25 26 |
# File 'lib/superfeedr/entry.rb', line 24 def title self.entry.content_from 'ns:title', :ns => NS end |