check_mailer.rb 595 B

123456789101112131415161718192021
  1. module Blazer
  2. class CheckMailer < ActionMailer::Base
  3. include ActionView::Helpers::TextHelper
  4. default from: Blazer.from_email if Blazer.from_email
  5. def state_change(check, state, state_was, rows_count, error)
  6. @check = check
  7. @state = state
  8. @state_was = state_was
  9. @rows_count = rows_count
  10. @error = error
  11. mail to: check.emails, subject: "Check #{state.titleize}: #{check.query.name}"
  12. end
  13. def failing_checks(email, checks)
  14. @checks = checks
  15. mail to: email, subject: "#{pluralize(checks.size, "Check")} Failing"
  16. end
  17. end
  18. end