Class: TrainingMailer
- Inherits:
-
InternalNotificationMailer
- Object
- ActionMailer::Base
- ApplicationMailer
- InternalNotificationMailer
- TrainingMailer
- Defined in:
- app/mailers/training_mailer.rb
Overview
Training: courses, certifications, liability insurance, room design.
Extracted from the former InternalMailer god object.
Instance Method Summary collapse
- #certification_expired(certification) ⇒ Object
- #certification_without_liability_insurance(certification) ⇒ Object
- #course_enrollment_exam(enrollment, passed) ⇒ Object
- #expired_liability_insurance_card(insurance) ⇒ Object
- #new_certification_request(certification) ⇒ Object
- #new_course_enrollment(enrollment) ⇒ Object
- #new_liability_insurance_card(insurance) ⇒ Object
- #plans_ready_to_be_relased(room_plans) ⇒ Object
- #same_day_design_complete(room_configuration) ⇒ Object
- #same_day_design_request(room_configuration) ⇒ Object
Methods inherited from InternalNotificationMailer
Methods included from SendgridSmtpApi::InternalMailerHeaders
Methods inherited from ApplicationMailer
Instance Method Details
#certification_expired(certification) ⇒ Object
96 97 98 99 100 101 102 |
# File 'app/mailers/training_mailer.rb', line 96 def certification_expired(certification) @certification = certification rep = @certification.party&.primary_rep mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}", subject: "Certification expired for user #{@certification.party.full_name}") end |
#certification_without_liability_insurance(certification) ⇒ Object
80 81 82 83 84 85 86 |
# File 'app/mailers/training_mailer.rb', line 80 def certification_without_liability_insurance(certification) @certification = certification rep = @certification.customer&.primary_rep mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}, ap@warmlyyours.com", subject: "Issue with an active certification. Customer #{@certification.customer.reference_number}") end |
#course_enrollment_exam(enrollment, passed) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/mailers/training_mailer.rb', line 48 def course_enrollment_exam(enrollment, passed) @course_enrollment = enrollment @status = (passed ? 'passed' : 'failed') if @course_enrollment.party.is_a?(Contact) rep = @course_enrollment.party.customer.primary_rep elsif @course_enrollment.party.is_a?(Customer) rep = @course_enrollment.party.primary_rep else # This shouldn't happen. Investigate. ErrorReporting.error("Course exam email error. Expecting contact or customer. Got #{@course_enrollment.party.class}") end mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}", subject: "New course exam taken and #{@status}. Enrollment #{@course_enrollment.id}") end |
#expired_liability_insurance_card(insurance) ⇒ Object
72 73 74 75 76 77 78 |
# File 'app/mailers/training_mailer.rb', line 72 def expired_liability_insurance_card(insurance) @liability_insurance = insurance rep = @liability_insurance.party&.primary_rep mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}, ap@warmlyyours.com", subject: "Expired Liability Insurance card. Customer #{@liability_insurance.customer.reference_number}") end |
#new_certification_request(certification) ⇒ Object
88 89 90 91 92 93 94 |
# File 'app/mailers/training_mailer.rb', line 88 def new_certification_request(certification) @certification = certification rep = @certification.party&.primary_rep mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}", subject: "New Certification request for user #{@certification.party.full_name}") end |
#new_course_enrollment(enrollment) ⇒ Object
40 41 42 43 44 45 46 |
# File 'app/mailers/training_mailer.rb', line 40 def new_course_enrollment(enrollment) @course_enrollment = enrollment rep = @course_enrollment.party&.primary_rep mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}", subject: "New Course Enrollment #{@course_enrollment.id}") end |
#new_liability_insurance_card(insurance) ⇒ Object
64 65 66 67 68 69 70 |
# File 'app/mailers/training_mailer.rb', line 64 def new_liability_insurance_card(insurance) @liability_insurance = insurance rep = @liability_insurance.party&.primary_rep mail(from: ADMINISTRATOR_EMAIL, to: "epasek@warmlyyours.com, rmatejacabello@warmlyyours.com, #{rep&.email}, ap@warmlyyours.com", subject: "New Liability Insurance card uploaded. Customer #{@liability_insurance.customer.reference_number}") end |
#plans_ready_to_be_relased(room_plans) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'app/mailers/training_mailer.rb', line 29 def plans_ready_to_be_relased(room_plans) return null_mail if room_plans.blank? @room_plans = room_plans mail(from: ADMINISTRATOR_EMAIL, to: 'aisayenko@warmlyyours.com', cc: 'techteam@warmlyyours.com', subject: "#{@room_plans.size} plans in Awaiting QC ready to be released.") end |
#same_day_design_complete(room_configuration) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'app/mailers/training_mailer.rb', line 18 def same_day_design_complete(room_configuration) @room_configuration = room_configuration @customer = @room_configuration.customer @rep = @customer.primary_sales_rep || @customer.sales_manager recipient = @rep&.email || ADMINISTRATOR_EMAIL mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: recipient, subject: "Same Day Plan Completed for Room #{@room_configuration.reference_number}") end |
#same_day_design_request(room_configuration) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'app/mailers/training_mailer.rb', line 9 def same_day_design_request(room_configuration) @room_configuration = room_configuration @customer = @room_configuration.customer mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'hyderabadstaff@warmlyyours.com', subject: "Same Day Design Request for #{@room_configuration.reference_number}") end |