Sha256: c5c2d019ffa2d5d7691cabb7f01e415f8bc73b14cb9ac86192b1522d155325b3

Contents?: true

Size: 1.46 KB

Versions: 11

Compression:

Stored size: 1.46 KB

Contents

class ErrorReportMailer < ActionMailer::Base
  default to: 'devteam@annarbortees.com'

  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:     'unknown-user@annarbortees.com',
          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 ? 'customer-report@softwearcrm.com' : @user.email,
      reply_to: @user.email,
      to:       'devteam@annarbortees.com',
      subject:  "Softwear CRM Error Report From #{@user.full_name}"
    )
  end

  def auth_server_down(at)
    mail(
      from:    'noreply@softwearcrm.com',
      subject: 'Authentication server is down!',
      body:    at.strftime("Lost contact on %m/%d/%Y at %I:%M%p. We're running on cache!")
    )
  end

  def auth_server_up(at)
    mail(
      from:    'noreply@softwearcrm.com',
      subject: 'Authentication server back up!',
      body:    at.strftime("Just got a response at %I:%M%p")
    )
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
softwear-lib-2.0.4 app/mailers/error_report_mailer.rb
softwear-lib-2.0.3 app/mailers/error_report_mailer.rb
softwear-lib-2.0.2 app/mailers/error_report_mailer.rb
softwear-lib-2.0.1 app/mailers/error_report_mailer.rb
softwear-lib-2.0.0 app/mailers/error_report_mailer.rb
softwear-2.0.7 app/mailers/error_report_mailer.rb
softwear-2.0.6 app/mailers/error_report_mailer.rb
softwear-2.0.5 app/mailers/error_report_mailer.rb
softwear-2.0.4 app/mailers/error_report_mailer.rb
softwear-2.0.3 app/mailers/error_report_mailer.rb
softwear-2.0.0 app/mailers/error_report_mailer.rb