Class: Gns::GithubAtom
- Inherits:
-
Object
- Object
- Gns::GithubAtom
- Defined in:
- lib/gns/github_atom.rb
Instance Method Summary collapse
- #get_atom ⇒ Object
- #get_atom_items ⇒ Object
-
#initialize(url, start_time = Time.now) ⇒ GithubAtom
constructor
A new instance of GithubAtom.
- #recent_items ⇒ Object
Constructor Details
#initialize(url, start_time = Time.now) ⇒ GithubAtom
Returns a new instance of GithubAtom.
7 8 9 10 11 |
# File 'lib/gns/github_atom.rb', line 7 def initialize(url, start_time = Time.now) @url = url @last_updated = start_time @client = HTTPClient.new end |
Instance Method Details
#get_atom ⇒ Object
27 28 29 |
# File 'lib/gns/github_atom.rb', line 27 def get_atom @client.get_content(@url) end |
#get_atom_items ⇒ Object
21 22 23 24 25 |
# File 'lib/gns/github_atom.rb', line 21 def get_atom_items RSS::Parser.parse(get_atom).items.map {|item| GithubItem.new(item) } end |
#recent_items ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/gns/github_atom.rb', line 13 def recent_items get_atom_items.find_all {|item| item.updated > @last_updated }.tap {|items| @last_updated = items.first.updated if items.first } end |