Class: Pike13::CLI::Commands::Front::Appointment

Inherits:
Base
  • Object
show all
Defined in:
lib/pike13/cli/commands/front/appointment.rb

Instance Method Summary collapse

Methods inherited from Base

base_usage, format_options, handle_argument_error, printable_commands

Methods included from ThorNestedSubcommand

included

Instance Method Details

#available(service_id) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pike13/cli/commands/front/appointment.rb', line 13

def available(service_id)
  validate_date_format(options[:date], "date")

  handle_error do
    params = { date: options[:date] }
    params[:location_ids] = options[:location_ids] if options[:location_ids]
    params[:staff_member_ids] = options[:staff_member_ids] if options[:staff_member_ids]

    result = with_progress("Fetching available slots") do
      Pike13::Front::Appointment.find_available_slots(service_id: service_id, **params)
    end
    output(result)
  end
end