Class: Workers::Reservations::RatingReservationWorker
- Inherits:
-
ApplicationWorker
- Object
- ApplicationWorker
- Workers::Reservations::RatingReservationWorker
- Defined in:
- app/workers/workers/reservations/rating_reservation_worker.rb
Overview
Ask customer to give a rating to restaurant system sends sms and email to customer
Instance Attribute Summary collapse
-
#restaurant ⇒ Object
readonly
Returns the value of attribute restaurant.
Instance Method Summary collapse
- #ask_rating_by_email(reservation) ⇒ Object
- #ask_rating_by_sms(reservation) ⇒ Object
- #perform(reservation_id) ⇒ Object
Methods inherited from ApplicationWorker
Instance Attribute Details
#restaurant ⇒ Object (readonly)
Returns the value of attribute restaurant.
9 10 11 |
# File 'app/workers/workers/reservations/rating_reservation_worker.rb', line 9 def restaurant @restaurant end |
Instance Method Details
#ask_rating_by_email(reservation) ⇒ Object
28 29 30 |
# File 'app/workers/workers/reservations/rating_reservation_worker.rb', line 28 def (reservation) UserMailer.(reservation.id).deliver_later! end |
#ask_rating_by_sms(reservation) ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/workers/workers/reservations/rating_reservation_worker.rb', line 32 def (reservation) NotificationService::Sms.new( phones: reservation.phone, reservation: reservation, default_locale: :en, ).send_review_msg_to_user end |
#perform(reservation_id) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/workers/workers/reservations/rating_reservation_worker.rb', line 13 def perform(reservation_id) reservation = Reservation.fetch(reservation_id) return unless reservation.active? return if reservation.no_show? return unless reservation.ack? return if reservation.review.present? && reservation.review.persisted? return if reservation&.booking_channel&.skip_send_notifications?(actor: 'user') @restaurant = reservation.restaurant (reservation) return unless restaurant.any_offers? (reservation) end |