Class: Lazylead::Task::ReporterAlert

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

Overview

A task that sends notifications about issues to their reporters.

The task supports the following features:

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

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) ⇒ ReporterAlert

Returns a new instance of ReporterAlert.



94
95
96
# File 'lib/lazylead/task/alert.rb', line 94

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

Instance Method Details

#run(sys, postman, opts) ⇒ Object



98
99
100
101
102
103
104
# File 'lib/lazylead/task/alert.rb', line 98

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