Class: Gns::GithubAtom

Inherits:
Object
  • Object
show all
Defined in:
lib/gns/github_atom.rb

Instance Method Summary collapse

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_atomObject



27
28
29
# File 'lib/gns/github_atom.rb', line 27

def get_atom
  @client.get_content(@url)
end

#get_atom_itemsObject



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_itemsObject



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