Class: SchedulerAdminMailer

Inherits:
InternalNotificationMailer show all
Defined in:
app/mailers/scheduler_admin_mailer.rb

Overview

Scheduler host/admin side: booking lifecycle + auth expiry.

Extracted from the former InternalMailer god object.

See Also:

  • InternalNotificationMailer
  • doc/tasks/202606131218_INTERNAL_MAILER_DECOMPOSITIONdoc/tasks/202606131218_INTERNAL_MAILER_DECOMPOSITION.md

Instance Method Summary collapse

Methods inherited from InternalNotificationMailer

#default_url_options

Methods included from SendgridSmtpApi::InternalMailerHeaders

#mail

Methods inherited from ApplicationMailer

#null_mail

Instance Method Details

#scheduler_auth_expired(employee, issues) ⇒ Object



49
50
51
52
53
54
55
# File 'app/mailers/scheduler_admin_mailer.rb', line 49

def scheduler_auth_expired(employee, issues)
  @employee = employee
  @issues = issues
  mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>',
       to: employee.email,
       subject: 'Action Required: Your scheduler integrations need reconnecting')
end

#scheduler_booking_cancelled(booking) ⇒ Object



18
19
20
21
22
23
24
25
# File 'app/mailers/scheduler_admin_mailer.rb', line 18

def scheduler_booking_cancelled(booking)
  @booking = booking
  @employee = booking.employee
  @booking_page = booking.scheduler_booking_page
  mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>',
       to: @employee.email,
       subject: "Booking Cancelled: #{@booking_page.name} with #{@booking.guest_name}")
end

#scheduler_booking_host_notification(booking) ⇒ Object



9
10
11
12
13
14
15
16
# File 'app/mailers/scheduler_admin_mailer.rb', line 9

def scheduler_booking_host_notification(booking)
  @booking = booking
  @employee = booking.employee
  @booking_page = booking.scheduler_booking_page
  mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>',
       to: @employee.email,
       subject: "New Booking: #{@booking_page.name} with #{@booking.guest_name}")
end

#scheduler_booking_reminder(booking, hours_before:) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# File 'app/mailers/scheduler_admin_mailer.rb', line 38

def scheduler_booking_reminder(booking, hours_before:)
  @booking = booking
  @employee = booking.employee
  @booking_page = booking.scheduler_booking_page
  @hours_before = hours_before
  time_label = hours_before == 24 ? 'tomorrow' : 'in 1 hour'
  mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>',
       to: @employee.email,
       subject: "Reminder: #{@booking_page.name} with #{@booking.guest_name} #{time_label}")
end

#scheduler_booking_rescheduled(booking, old_starts_at:, old_timezone:) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'app/mailers/scheduler_admin_mailer.rb', line 27

def scheduler_booking_rescheduled(booking, old_starts_at:, old_timezone:)
  @booking = booking
  @employee = booking.employee
  @booking_page = booking.scheduler_booking_page
  @old_starts_at = old_starts_at.in_time_zone('America/Chicago')
  @old_timezone = old_timezone
  mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>',
       to: @employee.email,
       subject: "Booking Rescheduled: #{@booking_page.name} with #{@booking.guest_name}")
end