Class: SchedulerBookingMailer

Inherits:
ApplicationMailer show all
Defined in:
app/mailers/scheduler_booking_mailer.rb

Instance Method Summary collapse

Methods inherited from ApplicationMailer

#null_mail

Instance Method Details

#cancellation(booking) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
# File 'app/mailers/scheduler_booking_mailer.rb', line 53

def cancellation(booking)
  @booking = booking
  @employee = booking.employee
  @booking_page = booking.scheduler_booking_page

  attach_ical(booking, method: :cancel)

  mail(
    to: booking.guest_email,
    subject: "Cancelled: #{@booking_page.name} with #{@employee.full_name}"
  )
end

#confirmation(booking) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/mailers/scheduler_booking_mailer.rb', line 10

def confirmation(booking)
  @booking = booking
  @employee = booking.employee
  @booking_page = booking.scheduler_booking_page

  attach_ical(booking, method: :request)

  mail(
    to: booking.guest_email,
    subject: "Confirmed: #{@booking_page.name} with #{@employee.full_name}"
  )
end

#default_url_optionsObject



6
7
8
# File 'app/mailers/scheduler_booking_mailer.rb', line 6

def default_url_options
  { host: WEB_HOSTNAME, protocol: 'https' }
end

#reminder(booking, hours_before:) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/mailers/scheduler_booking_mailer.rb', line 23

def reminder(booking, hours_before:)
  @booking = booking
  @employee = booking.employee
  @booking_page = booking.scheduler_booking_page
  @hours_before = hours_before

  attach_ical(booking, method: :publish)

  time_label = hours_before == 24 ? 'tomorrow' : 'in 1 hour'
  mail(
    to: booking.guest_email,
    subject: "Reminder: #{@booking_page.name} with #{@employee.full_name} #{time_label}"
  )
end

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



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'app/mailers/scheduler_booking_mailer.rb', line 38

def reschedule(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(old_timezone)
  @old_timezone = old_timezone

  attach_ical(booking, method: :request)

  mail(
    to: booking.guest_email,
    subject: "Rescheduled: #{@booking_page.name} with #{@employee.full_name}"
  )
end