Class: Lazylead::Task::AssigneeAlert

Inherits:
Object
  • Object
show all
Defined in:
lib/lazylead/task/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::NOTHING) ⇒ AssigneeAlert

Returns a new instance of AssigneeAlert.



67
68
69
# File 'lib/lazylead/task/alert.rb', line 67

def initialize(log = Log::NOTHING)
  @log = log
end

Instance Method Details

#run(sys, postman, opts) ⇒ Object



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

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