class Booker::V41::Customer

Constants

API_METHODS
V41_APPOINTMENTS_PREFIX
V41_PREFIX

Public Instance Methods

appointment(id:) click to toggle source
# File lib/booker/v4.1/customer.rb, line 23
def appointment(id:)
  get "#{API_METHODS[:appointment]}/#{id}", build_params, Booker::V4::Models::Appointment
end
cancel_appointment(id:, params: {}) click to toggle source
# File lib/booker/v4.1/customer.rb, line 27
def cancel_appointment(id:, params: {})
  put API_METHODS[:cancel_appointment], build_params({ID: id}, params), Booker::V4::Models::Appointment
end
class_availability(location_id:, from_start_date_time:, to_start_date_time:, params: {}) click to toggle source
# File lib/booker/v4.1/customer.rb, line 109
def class_availability(location_id:, from_start_date_time:, to_start_date_time:, params: {})
  post API_METHODS[:class_availability], build_params({
    FromStartDateTime: from_start_date_time,
    LocationID: location_id,
    OnlyIfAvailable: true,
    ToStartDateTime: to_start_date_time,
    ExcludeClosedDates: true
  }, params), Booker::V4::Models::ClassInstance
end
create_appointment(location_id:, available_time:, customer:, params: {}) click to toggle source
# File lib/booker/v4.1/customer.rb, line 39
def create_appointment(location_id:, available_time:, customer:, params: {})
  post API_METHODS[:create_appointment], build_params({
    LocationID: location_id,
    ItineraryTimeSlotList: [
      TreatmentTimeSlots: [available_time]
    ],
    Customer: customer
  }, params), Booker::V4::Models::Appointment
end
create_class_appointment(location_id:, class_instance_id:, customer:, params: {}) click to toggle source
# File lib/booker/v4.1/customer.rb, line 31
def create_class_appointment(location_id:, class_instance_id:, customer:, params: {})
  post API_METHODS[:create_class_appointment], build_params({
                                                   LocationID: location_id,
                                                   ClassInstanceID: class_instance_id,
                                                   Customer: customer
                                                 }, params), Booker::V4::Models::Appointment
end
employees(location_id:, fetch_all: true, params: {}) click to toggle source
# File lib/booker/v4.1/customer.rb, line 49
def employees(location_id:, fetch_all: true, params: {})
  paginated_request(
    method: :post,
    path: API_METHODS[:employees],
    params: build_params({LocationID: location_id}, params, true),
    model: Booker::V4::Models::Employee,
    fetch_all: fetch_all
  )
end
location(id:) click to toggle source
# File lib/booker/v4.1/customer.rb, line 95
def location(id:)
  response = get("#{API_METHODS[:location]}/#{id}", build_params)
  Booker::V4::Models::Location.from_hash(response)
end
locations(params: {}) click to toggle source
# File lib/booker/v4.1/customer.rb, line 100
def locations(params: {})
  paginated_request(
    method: :post,
    path: API_METHODS[:locations],
    params: build_params({}, params, true),
    model: Booker::V4::Models::Location
  )
end
specials(location_id:, fetch_all: true, params: {}) click to toggle source
# File lib/booker/v4.1/customer.rb, line 85
def specials(location_id:, fetch_all: true, params: {})
  paginated_request(
    method: :post,
    path: API_METHODS[:specials],
    params: build_params({ LocationID: location_id }, params, true),
    model: Booker::V4::Models::Special,
    fetch_all: fetch_all
  )
end
treatment(id:, includeEmployeeTreatment: false) click to toggle source
# File lib/booker/v4.1/customer.rb, line 59
def treatment(id:, includeEmployeeTreatment: false)
  get "#{API_METHODS[:treatment]}/#{id}", build_params({
                                                         includeEmployeeTreatment: includeEmployeeTreatment
                                                       }), Booker::V4::Models::TreatmentVerifiedBookableOnline
end
treatments(location_id:, fetch_all: true, params: {}) click to toggle source
# File lib/booker/v4.1/customer.rb, line 65
def treatments(location_id:, fetch_all: true, params: {})
  paginated_request(
    method: :post,
    path: API_METHODS[:treatments],
    params: build_params({LocationID: location_id}, params, true),
    model: Booker::V4::Models::Treatment,
    fetch_all: fetch_all
  )
end
treatments_verified_bookable_online(location_id:, fetch_all: true, params: {}) click to toggle source
# File lib/booker/v4.1/customer.rb, line 75
def treatments_verified_bookable_online(location_id:, fetch_all: true, params: {})
  paginated_request(
    method: :post,
    path: API_METHODS[:treatments_verified_bookable_online],
    params: build_params({LocationID: location_id}, params, true),
    model: Booker::V4::Models::TreatmentVerifiedBookableOnline,
    fetch_all: fetch_all
  )
end