Class: Lazylead::Task::AssigneeAlert

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

Overview

A task that sends notifications about issues to their assignees.

The task supports the following features:

- fetch issues from remote ticketing system by query
- group all issues by assignee
- prepare email based on predefined template (*.erb)
- send the required notifications to each assignee

The email message is sending to the assignee regarding all his/her issues,

not like one email per each issue.

Instance Method Summary collapse

Constructor Details

#initialize(log = Log.new) ⇒ AssigneeAlert

Returns a new instance of AssigneeAlert.



69
70
71
# File 'lib/lazylead/task/alert/alert.rb', line 69

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

Instance Method Details

#run(sys, postman, opts) ⇒ Object



73
74
75
76
77
78
79
# File 'lib/lazylead/task/alert/alert.rb', line 73

def run(sys, postman, opts)
  sys.issues(opts["sql"], opts.jira_defaults)
     .group_by(&:assignee)
     .each do |a, t|
    postman.send opts.merge(to: a.email, addressee: a.name, tickets: t)
  end
end