class Martilla::EmailNotifier

Private Instance Methods

error_html(msg, data) click to toggle source
# File lib/martilla/notifiers/email_notifier.rb, line 26
    def error_html(msg, data)
      data_list = data.map { |d| "<li>#{d}</li>" }.join("\n")
      <<~HTML
        <h2>The backup attempt failed with the following error</h2>
        <p><strong>#{msg}</strong></p>
        <ul>
          #{data_list}
        </ul>
      HTML
    end
error_txt(msg, data) click to toggle source
# File lib/martilla/notifiers/email_notifier.rb, line 37
    def error_txt(msg, data)
      data_list = data.map { |d| "- #{d}" }.join("\n")
      <<~TXT
        The backup attempt failed with the following error:
        #{msg}

        #{data_list}
      TXT
    end
failure_subject() click to toggle source
# File lib/martilla/notifiers/email_notifier.rb, line 61
def failure_subject
  @options['failure_subject'] || '[FAILURE] Backup failed'
end
from_email() click to toggle source
# File lib/martilla/notifiers/email_notifier.rb, line 53
def from_email
  @options['from'] || 'martilla@no-reply.com'
end
success_html(data) click to toggle source
# File lib/martilla/notifiers/email_notifier.rb, line 7
    def success_html(data)
      data_list = data.map { |d| "<li>#{d}</li>" }.join("\n")
      <<~HTML
        <h2>The backup was created successfully</h2>
        <ul>
          #{data_list}
        </ul>
      HTML
    end
success_subject() click to toggle source
# File lib/martilla/notifiers/email_notifier.rb, line 57
def success_subject
  @options['success_subject'] || '[SUCCESS] Backup created'
end
success_txt(data) click to toggle source
# File lib/martilla/notifiers/email_notifier.rb, line 17
    def success_txt(data)
      data_list = data.map { |d| "- #{d}" }.join("\n")
      <<~TXT
        The backup was created successfully

        #{data_list}
      TXT
    end
to_email() click to toggle source
# File lib/martilla/notifiers/email_notifier.rb, line 47
def to_email
  email = @options['to']
  raise config_error('to') if email.nil?
  email
end