Class: Item
- Inherits:
-
Object
- Object
- Item
- Defined in:
- lib/stanzas/notification_stanza.rb
Instance Method Summary (collapse)
- - (Object) authors
- - (Object) categories
- - (Object) chunk
- - (Object) chunks
- - (Object) content
-
- (Item) initialize(node)
constructor
A new instance of Item.
- - (Object) links
- - (Object) locations
- - (Object) published
- - (Object) summary
- - (Object) title
- - (Object) unique_id
Constructor Details
- (Item) initialize(node)
A new instance of Item
109 110 111 |
# File 'lib/stanzas/notification_stanza.rb', line 109 def initialize(node) @node = node end |
Instance Method Details
- (Object) authors
166 167 168 169 170 171 172 173 174 |
# File 'lib/stanzas/notification_stanza.rb', line 166 def if !@authors @authors = [] @node.xpath("./atom:entry/atom:author", {"atom" => "http://www.w3.org/2005/Atom"}).each do |node| @authors.push(Author.new(node)) end end @authors end |
- (Object) categories
176 177 178 179 180 181 182 183 184 |
# File 'lib/stanzas/notification_stanza.rb', line 176 def categories if !@categories @categories = [] @node.xpath("./atom:entry/atom:category", {"atom" => "http://www.w3.org/2005/Atom"}).each do |node| @categories.push(Category.new(node)) end end @categories end |
- (Object) chunk
152 153 154 |
# File 'lib/stanzas/notification_stanza.rb', line 152 def chunk @node["chunk"].to_i end |
- (Object) chunks
148 149 150 |
# File 'lib/stanzas/notification_stanza.rb', line 148 def chunks @node["chunks"].to_i end |
- (Object) content
126 127 128 129 130 131 132 133 |
# File 'lib/stanzas/notification_stanza.rb', line 126 def content if !@content if content = @node.at_xpath("./atom:entry/atom:content", {"atom" => "http://www.w3.org/2005/Atom"}) @content = content.text end end @content end |
- (Object) links
156 157 158 159 160 161 162 163 164 |
# File 'lib/stanzas/notification_stanza.rb', line 156 def links if !@links @links = [] @node.xpath("./atom:entry/atom:link", {"atom" => "http://www.w3.org/2005/Atom"}).each do |node| @links.push(Link.new(node)) end end @links end |
- (Object) locations
186 187 188 189 190 191 192 193 194 |
# File 'lib/stanzas/notification_stanza.rb', line 186 def locations if !@locations @locations = [] @node.xpath("./atom:entry/georss:point", {"atom" => "http://www.w3.org/2005/Atom", "georss" => "http://www.georss.org/georss"}).each do |node| @locations.push(Location.new(node)) end end @locations end |
- (Object) published
139 140 141 142 143 144 145 146 |
# File 'lib/stanzas/notification_stanza.rb', line 139 def published if !@published if published = @node.at_xpath("./atom:entry/atom:published", {"atom" => "http://www.w3.org/2005/Atom"}).text @published = Time.parse(published) end end @published end |
- (Object) summary
117 118 119 120 121 122 123 124 |
# File 'lib/stanzas/notification_stanza.rb', line 117 def summary if !@summary if summary = @node.at_xpath("./atom:entry/atom:summary", {"atom" => "http://www.w3.org/2005/Atom"}) @summary = summary.text end end @summary end |
- (Object) title
113 114 115 |
# File 'lib/stanzas/notification_stanza.rb', line 113 def title @title ||= @node.at_xpath("./atom:entry/atom:title", {"atom" => "http://www.w3.org/2005/Atom"}).text end |
- (Object) unique_id
135 136 137 |
# File 'lib/stanzas/notification_stanza.rb', line 135 def unique_id @unique_id ||= @node.at_xpath("./atom:entry/atom:id", {"atom" => "http://www.w3.org/2005/Atom"}).text end |