lib/agig/session.rb in agig-0.1.4 vs lib/agig/session.rb in agig-0.1.5
- old
+ new
@@ -7,11 +7,11 @@
def server_name
"github"
end
def server_version
- "0.0.0"
+ Agig::VERSION
end
def channels
['#notification', '#watch']
end
@@ -20,11 +20,15 @@
super
@notification_last_retrieved = @watch_last_retrieved = Time.now.utc - 3600
end
def client
- @client ||= Octokit::Client.new(login: @nick, password: @pass)
+ @client ||= if @opts.oauth_token
+ Octokit::Client.new(oauth_token: @pass)
+ else
+ Octokit::Client.new(login: @nick, password: @pass)
+ end
end
def on_disconnected
@retrieve_thread.kill rescue nil
end
@@ -47,10 +51,10 @@
@retrieve_thread = Thread.start do
loop do
begin
@log.info 'retrieveing feed...'
- entries = client.notifications
+ entries = client.notifications(all: true)
entries.sort_by(&:updated_at).reverse_each do |entry|
updated_at = Time.parse(entry.updated_at).utc
next if updated_at <= @notification_last_retrieved
reachable_url = reachable_url_for(entry.subject.latest_comment_url)