Class: ErrorReportMailer
- Inherits:
-
ActionMailer::Base
- Object
- ActionMailer::Base
- ErrorReportMailer
- Defined in:
- app/mailers/error_report_mailer.rb
Instance Method Summary collapse
Instance Method Details
#auth_server_down(at) ⇒ Object
38 39 40 41 42 43 44 |
# File 'app/mailers/error_report_mailer.rb', line 38 def auth_server_down(at) mail( from: '[email protected]', subject: 'Authentication server is down!', body: at.strftime("Lost contact on %m/%d/%Y at %I:%M%p. We're running on cache!") ) end |
#auth_server_up(at) ⇒ Object
46 47 48 49 50 51 52 |
# File 'app/mailers/error_report_mailer.rb', line 46 def auth_server_up(at) mail( from: '[email protected]', subject: 'Authentication server back up!', body: at.strftime("Just got a response at %I:%M%p") ) end |
#send_report(user, params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/mailers/error_report_mailer.rb', line 4 def send_report(user, params) @order = Order.find_by(id: params[:order_id]) @user = user || User.find_by(id: params[:user_id]) if @user.nil? from_customer = true if @order.nil? @user = OpenStruct.new( email: '[email protected]', full_name: 'Unknown Customer' ) else @user = OpenStruct.new( email: @order.email, full_name: "(Customer) #{@order.full_name}" ) end end @error_class = params[:error_class] @error_message = params[:error_message] @backtrace = params[:backtrace] @user_message = params[:user_message] @additional_info = params[:additional_info] mail( from: from_customer ? '[email protected]' : @user.email, reply_to: @user.email, to: '[email protected]', subject: "Softwear CRM Error Report From #{@user.full_name}" ) end |