Class: StreamGrabber::Github
- Inherits:
-
Object
- Object
- StreamGrabber::Github
- Defined in:
- lib/stream_grabber/github.rb
Instance Method Summary collapse
-
#initialize(user_name, api_key) ⇒ Github
constructor
A new instance of Github.
- #last_five ⇒ Object
- #message_from(link, title) ⇒ Object
Constructor Details
#initialize(user_name, api_key) ⇒ Github
Returns a new instance of Github.
7 8 9 |
# File 'lib/stream_grabber/github.rb', line 7 def initialize(user_name, api_key) @doc = SimpleRSS.parse(open("https://github.com/#{user_name}.private.actor.atom?token=#{api_key}")) end |
Instance Method Details
#last_five ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/stream_grabber/github.rb', line 11 def last_five commits = {} @doc.items.first(5).each do |item| date = Time.parse(item[:updated].to_s).to_i commits[date] = [:github, (item[:link], item[:title])] end commits end |
#message_from(link, title) ⇒ Object
20 21 22 |
# File 'lib/stream_grabber/github.rb', line 20 def (link, title) %Q{<a href="#{link}">#{title}</a>} end |