Class: Agents::UpdateAsNoShow

Inherits:
Update show all
Defined in:
app/my_lib/agents/update_as_no_show.rb

Constant Summary

Constants inherited from Base

Base::WORKER_DELAY_TIME

Instance Attribute Summary

Attributes inherited from Base

#audit_comment, #errors, #executor, #force_update, #owner, #reservation, #reservation_params, #restaurant, #user, #vendor_booking_id

Instance Method Summary collapse

Methods inherited from Update

#execute!, #initialize, #update_booking

Methods included from ErrorType

#fatal_error?, #inventory_error?, #normal_error?, #overwrite_error_type!

Methods inherited from Base

#error_message, #hotline, #inventory_available?, #save_reservation!, #status=

Methods included from SharedJobs

#give_campaign_reward, #send_rating_email

Constructor Details

This class inherits a constructor from Agents::Update

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Agents::Base

Instance Method Details

#after_initializeObject



7
8
9
10
# File 'app/my_lib/agents/update_as_no_show.rb', line 7

def after_initialize
  reservation.audit_comment = 'Updated as no show by owner'
  reservation.no_show = true
end

#update_booking!Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/my_lib/agents/update_as_no_show.rb', line 12

def update_booking!
  check_no_show!

  save_reservation! validate: false
  reservation.run_callbacks :update

  # Trigger sync for no-show update (context-aware based on caller)
  if reservation.created_by_admin_staff_or_owner?
    reservation.trigger_immediate_sync
  else
    reservation.trigger_priority_sync
  end

  unless reservation.dummy?
    send_notification_to_error_staff
  end
  reservation.reload
  Netcore::EventWorker.perform_in(Netcore::EventWorker::DELAY, :reservation_event, reservation.id)

  true
end