Class: LogMaster::Notifier

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
lib/log_master/notifier.rb

Instance Method Summary collapse

Instance Method Details

#create_subjectObject



20
21
22
# File 'lib/log_master/notifier.rb', line 20

def create_subject
  @configuration.title + (@status ? " SUCCESSFUL" : " FAILED")
end

#determine_recipientsObject



24
25
26
# File 'lib/log_master/notifier.rb', line 24

def determine_recipients
  @status ? @configuration.recipients[:success] : @configuration.recipients[:failure]
end

#update_notification(status, reports, logs) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/log_master/notifier.rb', line 7

def update_notification(status, reports, logs)
  @status = status
  @configuration = Configuration.instance
  
  subject       create_subject
  recipients    determine_recipients
  reply_to      @configuration.reply_to || @configuration.from
  from          @configuration.from
  content_type  "text/html"
  sent_on       Time.now
  body          :title => @configuration.title, :logs => logs, :reports => reports
end