Class: CheckerJobs::Notifiers::Email

Inherits:
Base
  • Object
show all
Defined in:
lib/checker_jobs/notifiers/email.rb

Defined Under Namespace

Classes: Mailer

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(check, count, entries) ⇒ Email

Returns a new instance of Email.



4
5
6
7
8
9
10
11
# File 'lib/checker_jobs/notifiers/email.rb', line 4

def initialize(check, count, entries)
  super

  @formatter = formatter_class.new(check, count, entries)
  @defaults = { subject: @formatter.subject }

  raise CheckerJobs::InvalidNotifierOptions unless valid?
end

Class Method Details

.default_optionsObject



17
18
19
20
21
22
# File 'lib/checker_jobs/notifiers/email.rb', line 17

def self.default_options
  {
    formatter_class: CheckerJobs::Notifiers::EmailDefaultFormatter,
    email_options: {},
  }
end

Instance Method Details

#notifyObject



13
14
15
# File 'lib/checker_jobs/notifiers/email.rb', line 13

def notify
  Mailer.notify(@formatter.body, mailer_options).deliver!
end