Class: Totalizer::EmailNotifier
Constant Summary
collapse
- DEFAULT_OPTIONS =
{ subject: '[Totalizer] Your important metrics', from: '[email protected]' }
Class Method Summary
collapse
Class Method Details
.call(message_groups, options) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/totalizer/notifier/email_notifier.rb', line 7
def self.call(message_groups, options)
body = ""
message_groups.each do |message_type, messages|
body += "\n#{message_type.to_s.capitalize}\n"
description = messages.map{ |message| message.description }.uniq.join("\n")
body += "#{description}\n"
text = messages.map{ |message| message.text }.join("\n")
body += "#{text}\n"
end
body += "\n— Totalizer"
self.send body, DEFAULT_OPTIONS.merge(options)
end
|