check_mailer.rb 843 B

123456789101112131415161718192021222324252627
  1. module Blazer
  2. class CheckMailer < ActionMailer::Base
  3. include ActionView::Helpers::TextHelper
  4. default from: Blazer.from_email if Blazer.from_email
  5. layout false
  6. def state_change(check, state, state_was, rows_count, error, columns, rows, column_types, check_type)
  7. @check = check
  8. @state = state
  9. @state_was = state_was
  10. @rows_count = rows_count
  11. @error = error
  12. @columns = columns
  13. @rows = rows
  14. @column_types = column_types
  15. @check_type = check_type
  16. mail to: check.emails, reply_to: check.emails, subject: "Check #{state.titleize}: #{check.query.name}"
  17. end
  18. def failing_checks(email, checks)
  19. @checks = checks
  20. # add reply_to for mailing lists
  21. mail to: email, reply_to: email, subject: "#{pluralize(checks.size, "Check")} Failing"
  22. end
  23. end
  24. end