class MingleEvents::Feed::Page
A page of Atom events. I.e., not a Mingle page. Most users of this library will not use this class to access the Mingle Atom feed, but will use the ProjectFeed class which handles paging transparently.
Attributes
url[RW]
Public Class Methods
new(url, mingle_access)
click to toggle source
# File lib/mingle_events/feed/page.rb 11 def initialize(url, mingle_access) 12 @url = url 13 @mingle_access = mingle_access 14 end
Public Instance Methods
entries()
click to toggle source
# File lib/mingle_events/feed/page.rb 16 def entries 17 @entries ||= page_as_document.select_all('./atom:feed/atom:entry').map do |entry_element| 18 Entry.new(entry_element) 19 end 20 end
next()
click to toggle source
# File lib/mingle_events/feed/page.rb 22 def next 23 next_url_element = page_as_document.select("./atom:feed/atom:link[@rel='next']") 24 if next_url_element.nil? 25 nil 26 else 27 Page.new(next_url_element.attr("href"), @mingle_access) 28 end 29 end
Private Instance Methods
page_as_document()
click to toggle source
# File lib/mingle_events/feed/page.rb 33 def page_as_document 34 @page_as_document ||= Xml.parse(@mingle_access.fetch_page(@url), ATOM_AND_MINGLE_NS) 35 end