class Ruboty::Handlers::GithubAssignor
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/ruboty/handlers/github_assignor.rb, line 10 def initialize(*args) super start_watching end
Private Instance Methods
start_watching()
click to toggle source
# File lib/ruboty/handlers/github_assignor.rb, line 18 def start_watching octokit = Octokit::Client.new(access_token: ENV['GITHUB_TOKEN']) data = JSON.parse(ENV['GITHUB_ASSIGNOR_REPOS']) Ruboty::GithubAssignor.log(data) data.each do |datum| repo = datum['repo'] to = datum['to'] messages = datum['messages'] || [] assignees = datum['assignees'].map {|assignee| Hash[assignee.map {|k, v| [k.to_sym, v] }] } assignor = Ruboty::GithubAssignor::Assignor.new(assignees) watcher = Ruboty::GithubAssignor::RepoWatcher.new( robot: robot, repo: repo, octokit: octokit, assignor: assignor, to: to, messages: messages, ) watcher.start((ENV['GITHUB_ASSIGNOR_INTERVAL'] || 60).to_i) end end