Module: Booker::CustomerREST
Constant Summary
Constants included from CommonREST
Booker::CommonREST::DEFAULT_PAGINATION_PARAMS
Instance Method Summary collapse
- #calculate_appointment_cost(booker_location_id, appointment_id, appointment_date, appointment_treatments, coupon_code, options = {}) ⇒ Object
- #create_appointment(booker_location_id, start_time, treatment_ids, incomplete_appoinment_id, customer, credit_card, coupon_code = nil, notes = nil, custom_access_token = {}, options: {}) ⇒ Object
- #create_class_appointment(booker_location_id, class_instance_id, customer, options = {}) ⇒ Object
- #create_customer(booker_location_id, customer_data, options: {}) ⇒ Object
- #create_incomplete_appointment(booker_location_id, start_time, treatment_ids, options = {}) ⇒ Object
- #find_employees(booker_location_id) ⇒ Object
- #find_treatments(booker_location_id, category_id = nil) ⇒ Object
- #forgot_password(booker_location_id, email, first_name, base_url, options: {}) ⇒ Object
- #get_appointment(appointment_id, custom_access_token, options = {}) ⇒ Object
- #get_customer(customer_id, custom_access_token, options = {}) ⇒ Object
- #get_customer_appointments(customer_id, custom_access_token, options = {}) ⇒ Object
- #get_locations ⇒ Object
- #get_special_by_code(booker_location_id, coupon_code, validate, exclusivity, options: {}) ⇒ Object
- #get_treatment_categories(booker_location_id) ⇒ Object
- #login(booker_location_id, email, password, options: {}) ⇒ Object
- #reset_password(key, password, options: {}) ⇒ Object
- #run_class_availability(booker_location_id, from_start_date_time, to_start_date_time, options = {}) ⇒ Object
- #run_multi_service_availability(booker_location_id, treatment_ids, start_date_time, end_date_time, employee_id = nil, options = {}) ⇒ Object
- #run_multi_spa_multi_sub_category_availability(booker_location_ids, treatment_sub_category_ids, start_date_time, end_date_time, options = {}) ⇒ Object
- #update_customer(customer_id, customer_data, custom_access_token = {}) ⇒ Object
Methods included from CommonREST
#confirm_appointment, #get_location, #get_online_booking_settings
Instance Method Details
#calculate_appointment_cost(booker_location_id, appointment_id, appointment_date, appointment_treatments, coupon_code, options = {}) ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/booker/customer_rest.rb', line 60 def calculate_appointment_cost(booker_location_id, appointment_id, appointment_date, appointment_treatments, coupon_code, = {}) post '/appointment/prebooking/totalcost', build_params({ 'LocationID' => booker_location_id, 'AppointmentID' => appointment_id, 'CouponCode' => coupon_code, 'AppointmentDate' => appointment_date, 'AppointmentTreatmentDTO' => [] }, ) end |
#create_appointment(booker_location_id, start_time, treatment_ids, incomplete_appoinment_id, customer, credit_card, coupon_code = nil, notes = nil, custom_access_token = {}, options: {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/booker/customer_rest.rb', line 13 def create_appointment(booker_location_id, start_time, treatment_ids, incomplete_appoinment_id, customer, credit_card, coupon_code = nil, notes = nil, custom_access_token = {}, options: {}) post "/appointment/create", build_params({ "LocationID" => booker_location_id, "ItineraryTimeSlotList" => [ "StartDateTime" => start_time, "TreatmentTimeSlots" => treatment_ids.map { |id| { "StartDateTime" => start_time, "TreatmentID" => id } } ], "AppointmentPayment" => { "PaymentItem" => { # "CreditCard" => credit_card, # "Method" => { # "ID" => 1 # }, "CustomPaymentMethodID" => 1, "CustomPaymentMethodIDSpecified" => true }, "CouponCode" => coupon_code }, "Notes" => notes, "IncompleteAppointmentID" => incomplete_appoinment_id, "Customer" => customer }, custom_access_token.merge()), Booker::Models::Appointment end |
#create_class_appointment(booker_location_id, class_instance_id, customer, options = {}) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/booker/customer_rest.rb', line 52 def create_class_appointment(booker_location_id, class_instance_id, customer, = {}) post '/class_appointment/create', build_params({ 'LocationID' => booker_location_id, 'ClassInstanceID' => class_instance_id, 'Customer' => customer }, ), Booker::Models::Appointment end |
#create_customer(booker_location_id, customer_data, options: {}) ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/booker/customer_rest.rb', line 130 def create_customer(booker_location_id, customer_data, options: {}) post '/customer/account', build_params({ 'LocationID' => booker_location_id, 'Email' => customer_data[:email], 'Password' => customer_data[:password], 'FirstName' => customer_data[:first_name], 'LastName' => customer_data[:last_name], 'HomePhone' => customer_data[:HomePhone], 'CellPhone' => customer_data[:CellPhone], 'AllowReceiveEmails' => customer_data[:AllowReceiveEmails], 'AllowReceiveSMS' => customer_data[:AllowReceiveSMS] }, ) end |
#create_incomplete_appointment(booker_location_id, start_time, treatment_ids, options = {}) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/booker/customer_rest.rb', line 42 def create_incomplete_appointment(booker_location_id, start_time, treatment_ids, = {}) post '/appointment/createincomplete', build_params({ 'LocationID' => booker_location_id, 'ItineraryTimeSlot' => { 'StartDateTime' => start_time, 'TreatmentTimeSlots' => treatment_ids.map { |id| { 'StartDateTime' => start_time, 'TreatmentID' => id } } } }, ) end |
#find_employees(booker_location_id) ⇒ Object
120 121 122 123 124 |
# File 'lib/booker/customer_rest.rb', line 120 def find_employees(booker_location_id) post '/employees', build_params({ 'LocationID' => booker_location_id }) end |
#find_treatments(booker_location_id, category_id = nil) ⇒ Object
103 104 105 106 107 108 |
# File 'lib/booker/customer_rest.rb', line 103 def find_treatments(booker_location_id, category_id = nil) post '/treatments', build_params({ 'LocationID' => booker_location_id, 'CategoryID' => category_id }) end |
#forgot_password(booker_location_id, email, first_name, base_url, options: {}) ⇒ Object
159 160 161 162 163 164 165 166 |
# File 'lib/booker/customer_rest.rb', line 159 def forgot_password(booker_location_id, email, first_name, base_url, options: {}) post '/forgot_password/custom', build_params({ 'LocationID' => booker_location_id, 'Email' => email, 'Firstname' => first_name, 'BaseUrlOfHost' => base_url }, ) end |
#get_appointment(appointment_id, custom_access_token, options = {}) ⇒ Object
9 10 11 |
# File 'lib/booker/customer_rest.rb', line 9 def get_appointment(appointment_id, custom_access_token, = {}) get "/appointment/#{appointment_id}/", build_params(, custom_access_token) end |
#get_customer(customer_id, custom_access_token, options = {}) ⇒ Object
126 127 128 |
# File 'lib/booker/customer_rest.rb', line 126 def get_customer(customer_id, custom_access_token, = {}) get "/customer/#{customer_id}", build_params(, custom_access_token) end |
#get_customer_appointments(customer_id, custom_access_token, options = {}) ⇒ Object
5 6 7 |
# File 'lib/booker/customer_rest.rb', line 5 def get_customer_appointments(customer_id, custom_access_token, = {}) get "/customer/#{customer_id}/appointments", build_params(, custom_access_token) end |
#get_locations ⇒ Object
116 117 118 |
# File 'lib/booker/customer_rest.rb', line 116 def get_locations post '/locations', build_params end |
#get_special_by_code(booker_location_id, coupon_code, validate, exclusivity, options: {}) ⇒ Object
175 176 177 178 179 180 181 |
# File 'lib/booker/customer_rest.rb', line 175 def get_special_by_code(booker_location_id, coupon_code, validate, exclusivity, options: {}) get "/special/location/#{booker_location_id}", build_params({ 'CouponCode' => coupon_code, 'ValidateSpecial' => validate, 'IncludeExclusivityDetail' => exclusivity }, ) end |
#get_treatment_categories(booker_location_id) ⇒ Object
110 111 112 113 114 |
# File 'lib/booker/customer_rest.rb', line 110 def get_treatment_categories(booker_location_id) get '/treatment_categories', build_params({ 'location_id' => booker_location_id }) end |
#login(booker_location_id, email, password, options: {}) ⇒ Object
148 149 150 151 152 153 154 155 156 157 |
# File 'lib/booker/customer_rest.rb', line 148 def login(booker_location_id, email, password, options: {}) post '/customer/login', build_params({ 'LocationID' => booker_location_id, 'Email' => email, 'Password' => password }, .merge({ client_id: self.client_id, client_secret: self.client_secret })) end |
#reset_password(key, password, options: {}) ⇒ Object
168 169 170 171 172 173 |
# File 'lib/booker/customer_rest.rb', line 168 def reset_password(key, password, options: {}) post '/password/reset', build_params({ 'Key' => key, 'Password' => password }, ) end |
#run_class_availability(booker_location_id, from_start_date_time, to_start_date_time, options = {}) ⇒ Object
93 94 95 96 97 98 99 100 101 |
# File 'lib/booker/customer_rest.rb', line 93 def run_class_availability(booker_location_id, from_start_date_time, to_start_date_time, = {}) post '/availability/class', build_params({ 'FromStartDateTime' => from_start_date_time, 'LocationID' => booker_location_id, 'OnlyIfAvailable' => true, 'ToStartDateTime' => to_start_date_time, 'ExcludeClosedDates' => true }, ), Booker::Models::ClassInstance end |
#run_multi_service_availability(booker_location_id, treatment_ids, start_date_time, end_date_time, employee_id = nil, options = {}) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/booker/customer_rest.rb', line 80 def run_multi_service_availability(booker_location_id, treatment_ids, start_date_time, end_date_time, employee_id = nil, = {}) treatment_ids = [treatment_ids] unless treatment_ids.respond_to?(:map) post '/availability/multiservice', build_params( { 'LocationID' => booker_location_id, 'StartDateTime' => start_date_time, 'EndDateTime' => end_date_time, 'MaxTimesPerDay' => 100, 'Itineraries' => treatment_ids.map { |id| { 'Treatments' => [{ 'TreatmentID' => id, 'EmployeeID' => employee_id }] } } }, ), Booker::Models::MultiServiceAvailabilityResult end |
#run_multi_spa_multi_sub_category_availability(booker_location_ids, treatment_sub_category_ids, start_date_time, end_date_time, options = {}) ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'lib/booker/customer_rest.rb', line 70 def run_multi_spa_multi_sub_category_availability(booker_location_ids, treatment_sub_category_ids, start_date_time, end_date_time, = {}) post '/availability/multispamultisubcategory', build_params({ 'LocationIDs' => booker_location_ids, 'TreatmentSubCategoryIDs' => treatment_sub_category_ids, 'StartDateTime' => start_date_time, 'EndDateTime' => end_date_time, 'MaxTimesPerTreatment' => 1000 }, ), Booker::Models::SpaEmployeeAvailabilitySearchItem end |
#update_customer(customer_id, customer_data, custom_access_token = {}) ⇒ Object
144 145 146 |
# File 'lib/booker/customer_rest.rb', line 144 def update_customer(customer_id, customer_data, custom_access_token = {}) put "/customer/#{customer_id}", build_params(customer_data, custom_access_token) end |