Class: Booker::V41::Customer
Constant Summary
collapse
- V41_PREFIX =
'/v4.1/customer'
- V41_APPOINTMENTS_PREFIX =
"#{V41_PREFIX}/appointment"
- API_METHODS =
{
appointment: "#{V41_APPOINTMENTS_PREFIX}".freeze,
cancel_appointment: "#{V41_APPOINTMENTS_PREFIX}/cancel".freeze,
create_appointment: "#{V41_APPOINTMENTS_PREFIX}/create".freeze,
create_class_appointment: "#{V41_PREFIX}/class_appointment/create".freeze,
employees: "#{V41_PREFIX}/employees".freeze,
treatments: "#{V41_PREFIX}/treatments".freeze,
location: "#{V41_PREFIX}/location".freeze,
locations: "#{V41_PREFIX}/locations".freeze,
class_availability: "#{V41_PREFIX}/availability/class".freeze
}.freeze
RequestHelper::DEFAULT_PAGINATION_PARAMS
Constants inherited
from Client
Client::API_GATEWAY_ERRORS, Client::BOOKER_SERVER_TIMEZONE, Client::CLIENT_CREDENTIALS_GRANT_TYPE, Client::CREATE_TOKEN_CONTENT_TYPE, Client::CREATE_TOKEN_PATH, Client::DEFAULT_AUTH_BASE_URL, Client::DEFAULT_BASE_URL, Client::DEFAULT_CONTENT_TYPE, Client::ENV_BASE_URL_KEY, Client::REFRESH_TOKEN_GRANT_TYPE, Client::UPDATE_TOKEN_CONTEXT_PATH, Client::VALID_ACCESS_TOKEN_SCOPES
Instance Attribute Summary
Attributes inherited from Client
#access_token_scope, #api_subscription_key, #auth_base_url, #auth_with_client_credentials, #base_url, #client_id, #client_secret, #location_id, #refresh_token, #temp_access_token, #temp_access_token_expires_at, #token_store, #token_store_callback_method
Instance Method Summary
collapse
-
#appointment(id:) ⇒ Object
-
#cancel_appointment(id:, params: {}) ⇒ Object
-
#class_availability(location_id:, from_start_date_time:, to_start_date_time:, params: {}) ⇒ Object
-
#create_appointment(location_id:, available_time:, customer:, params: {}) ⇒ Object
-
#create_class_appointment(location_id:, class_instance_id:, customer:, params: {}) ⇒ Object
-
#employees(location_id:, fetch_all: true, params: {}) ⇒ Object
-
#location(id:) ⇒ Object
-
#locations(params: {}) ⇒ Object
-
#treatments(location_id:, fetch_all: true, params: {}) ⇒ Object
#build_params
Methods inherited from Client
#access_token, #access_token_response, #delete, #full_url, #get, #get_access_token, #get_base_url, #get_booker_resources, #get_location_access_token, #handle_errors!, #initialize, #paginated_request, #patch, #post, #put, #update_token_store
Constructor Details
This class inherits a constructor from Booker::Client
Instance Method Details
#appointment(id:) ⇒ Object
#cancel_appointment(id:, params: {}) ⇒ Object
24
25
26
|
# File 'lib/booker/v4.1/customer.rb', line 24
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: {}) ⇒ Object
80
81
82
83
84
85
86
87
88
|
# File 'lib/booker/v4.1/customer.rb', line 80
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: {}) ⇒ Object
36
37
38
39
40
41
42
43
44
|
# File 'lib/booker/v4.1/customer.rb', line 36
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: {}) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/booker/v4.1/customer.rb', line 28
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: {}) ⇒ Object
46
47
48
49
50
51
52
53
54
|
# File 'lib/booker/v4.1/customer.rb', line 46
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
|
#locations(params: {}) ⇒ Object
71
72
73
74
75
76
77
78
|
# File 'lib/booker/v4.1/customer.rb', line 71
def locations(params: {})
paginated_request(
method: :post,
path: API_METHODS[:locations],
params: build_params({}, params, true),
model: Booker::V4::Models::Location
)
end
|
#treatments(location_id:, fetch_all: true, params: {}) ⇒ Object
56
57
58
59
60
61
62
63
64
|
# File 'lib/booker/v4.1/customer.rb', line 56
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
|