8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/workers/scheduler_booking_mailer_worker.rb', line 8
def perform(booking_id, email_type, *)
booking = SchedulerBooking.find_by(id: booking_id)
return unless booking
case email_type
when 'confirmation'
InternalMailer.scheduler_booking_host_notification(booking).deliver_now
SchedulerBookingMailer.confirmation(booking).deliver_now
when 'reschedule'
old_starts_at = Time.zone.parse([0])
old_timezone = [1] || booking.timezone
InternalMailer.scheduler_booking_rescheduled(booking, old_starts_at: old_starts_at, old_timezone: old_timezone).deliver_now
SchedulerBookingMailer.reschedule(booking, old_starts_at: old_starts_at, old_timezone: old_timezone).deliver_now
when 'cancellation'
InternalMailer.scheduler_booking_cancelled(booking).deliver_now
SchedulerBookingMailer.cancellation(booking).deliver_now
end
end
|