Class: Spree::Api::Chatrace::CheckInsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/chatrace/check_ins_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#validate_token_client

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
# File 'app/controllers/spree/api/chatrace/check_ins_controller.rb', line 9

def create
  context = SpreeCmCommissioner::CheckInBulkCreator.call(check_ins_attributes: [{ guest_id: guest.id }])

  if context.success?
    render json: { checked_in_at: context.check_ins[0].confirmed_at }, status: :ok
  else
    render_error_payload(context.message)
  end
end

#guestObject



5
6
7
# File 'app/controllers/spree/api/chatrace/check_ins_controller.rb', line 5

def guest
  @guest ||= SpreeCmCommissioner::Guest.complete.find_by!(token: params[:guest_token])
end