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
- #cancel_appointment(appointment_id, 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
64 65 66 67 68 69 70 71 72 |
# File 'lib/booker/customer_rest.rb', line 64 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 |
#cancel_appointment(appointment_id, options: {}) ⇒ Object
58 59 60 61 62 |
# File 'lib/booker/customer_rest.rb', line 58 def cancel_appointment(appointment_id, options: {}) put '/appointment/cancel', build_params({ 'ID' => appointment_id }, ) 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 |
# 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 } }, "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
50 51 52 53 54 55 56 |
# File 'lib/booker/customer_rest.rb', line 50 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
134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/booker/customer_rest.rb', line 134 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
40 41 42 43 44 45 46 47 48 |
# File 'lib/booker/customer_rest.rb', line 40 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
124 125 126 127 128 |
# File 'lib/booker/customer_rest.rb', line 124 def find_employees(booker_location_id) post '/employees', build_params({ 'LocationID' => booker_location_id }) end |
#find_treatments(booker_location_id, category_id = nil) ⇒ Object
107 108 109 110 111 112 |
# File 'lib/booker/customer_rest.rb', line 107 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
163 164 165 166 167 168 169 170 |
# File 'lib/booker/customer_rest.rb', line 163 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
130 131 132 |
# File 'lib/booker/customer_rest.rb', line 130 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
120 121 122 |
# File 'lib/booker/customer_rest.rb', line 120 def get_locations post '/locations', build_params end |
#get_special_by_code(booker_location_id, coupon_code, validate, exclusivity, options: {}) ⇒ Object
179 180 181 182 183 184 185 |
# File 'lib/booker/customer_rest.rb', line 179 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
114 115 116 117 118 |
# File 'lib/booker/customer_rest.rb', line 114 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
152 153 154 155 156 157 158 159 160 161 |
# File 'lib/booker/customer_rest.rb', line 152 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
172 173 174 175 176 177 |
# File 'lib/booker/customer_rest.rb', line 172 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
97 98 99 100 101 102 103 104 105 |
# File 'lib/booker/customer_rest.rb', line 97 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
84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/booker/customer_rest.rb', line 84 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
74 75 76 77 78 79 80 81 82 |
# File 'lib/booker/customer_rest.rb', line 74 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
148 149 150 |
# File 'lib/booker/customer_rest.rb', line 148 def update_customer(customer_id, customer_data, custom_access_token = {}) put "/customer/#{customer_id}", build_params(customer_data, custom_access_token) end |