Class: BookingReminder::SmsReminderWorker

Inherits:
ApplicationWorker show all
Defined in:
app/workers/booking_reminder/sms_reminder_worker.rb

Overview

Worker for send SMS reminder

Instance Method Summary collapse

Methods inherited from ApplicationWorker

unlimited_retry

Instance Method Details

#perform(reservation_id) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'app/workers/booking_reminder/sms_reminder_worker.rb', line 8

def perform(reservation_id)
  reservation = Reservation.find_by id: reservation_id
  return false if reservation.blank? || !reservation.active?

  link = MyUrlShortener.customer_modify_booking_link(reservation.id)

  msg = "วันนี้คุณได้ทำการจองร้าน Arno's Booking ID #{reservation.id} กรุณามาตามเวลาจอง หากต้องการยกเลิกกดลิงค์นี้ > #{link}"
  phones = reservation.phone

  ::SmsWorker.perform_async(msg, phones, reservation_id)
end