Class: Agig::Session
- Inherits:
-
Net::IRC::Server::Session
- Object
- Net::IRC::Server::Session
- Agig::Session
- Defined in:
- lib/agig/session.rb
Instance Method Summary collapse
- #channels ⇒ Object
- #client ⇒ Object
-
#initialize(*args) ⇒ Session
constructor
A new instance of Session.
- #on_disconnected ⇒ Object
- #on_user(m) ⇒ Object
- #server_name ⇒ Object
- #server_version ⇒ Object
Constructor Details
#initialize(*args) ⇒ Session
Returns a new instance of Session.
20 21 22 23 |
# File 'lib/agig/session.rb', line 20 def initialize(*args) super @notification_last_retrieved = @watch_last_retrieved = Time.now.utc - 3600 end |
Instance Method Details
#channels ⇒ Object
16 17 18 |
# File 'lib/agig/session.rb', line 16 def channels ['#notification', '#watch'] end |
#client ⇒ Object
25 26 27 |
# File 'lib/agig/session.rb', line 25 def client @client ||= Octokit::Client.new(access_token: @pass) end |
#on_disconnected ⇒ Object
29 30 31 |
# File 'lib/agig/session.rb', line 29 def on_disconnected @retrieve_thread.kill rescue nil end |
#on_user(m) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/agig/session.rb', line 33 def on_user(m) super channels.each{|channel| post @nick, JOIN, channel } @retrieve_thread = Thread.start do loop do retrieve @opts.interval end end end |
#server_name ⇒ Object
8 9 10 |
# File 'lib/agig/session.rb', line 8 def server_name "github" end |