Class: Lazylead::Task::Loading

Inherits:
Object
  • Object
show all
Defined in:
lib/lazylead/task/loading.rb

Overview

Notification about team loading

Instance Method Summary collapse

Constructor Details

#initialize(log = Log.new) ⇒ Loading

Returns a new instance of Loading.



34
35
36
# File 'lib/lazylead/task/loading.rb', line 34

def initialize(log = Log.new)
  @log = log
end

Instance Method Details

#run(sys, postman, opts) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# File 'lib/lazylead/task/loading.rb', line 38

def run(sys, postman, opts)
  assignments = sys.issues(opts["jql"], opts.jira_defaults)
                   .group_by(&:assignee)
                   .to_h { |user, tasks| [user.id, Teammate.new(user, tasks)] }
  opts.slice("team", ",")
      .map { |m| m.split(":") }
      .each { |id, name| assignments[id] = Free.new(id, name) unless assignments.key? id }
  return if assignments.empty?
  postman.send opts.merge(assignments: assignments)
end