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, 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_customer(customer_id, custom_access_token, options = {}) ⇒ Object
- #get_customer_appointments(customer_id, custom_access_token, options = {}) ⇒ Object
- #get_locations ⇒ 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, coupon_code, options = {}) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/booker/customer_rest.rb', line 54 def calculate_appointment_cost(booker_location_id, appointment_id, coupon_code, = {}) post '/appointment/prebooking/totalcost', build_params({ 'LocationID' => booker_location_id, 'AppointmentID' => appointment_id, 'CouponCode' => coupon_code, 'AppointmentDate' => DateTime.now, 'AppointmentTreatmentDTOs' => [] }, ) 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
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/booker/customer_rest.rb', line 9 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
46 47 48 49 50 51 52 |
# File 'lib/booker/customer_rest.rb', line 46 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
124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/booker/customer_rest.rb', line 124 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
36 37 38 39 40 41 42 43 44 |
# File 'lib/booker/customer_rest.rb', line 36 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
114 115 116 117 118 |
# File 'lib/booker/customer_rest.rb', line 114 def find_employees(booker_location_id) post '/employees', build_params({ 'LocationID' => booker_location_id }) end |
#find_treatments(booker_location_id, category_id = nil) ⇒ Object
97 98 99 100 101 102 |
# File 'lib/booker/customer_rest.rb', line 97 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
153 154 155 156 157 158 159 160 |
# File 'lib/booker/customer_rest.rb', line 153 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_customer(customer_id, custom_access_token, options = {}) ⇒ Object
120 121 122 |
# File 'lib/booker/customer_rest.rb', line 120 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
110 111 112 |
# File 'lib/booker/customer_rest.rb', line 110 def get_locations post '/locations', build_params end |
#get_treatment_categories(booker_location_id) ⇒ Object
104 105 106 107 108 |
# File 'lib/booker/customer_rest.rb', line 104 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
142 143 144 145 146 147 148 149 150 151 |
# File 'lib/booker/customer_rest.rb', line 142 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
162 163 164 165 166 167 |
# File 'lib/booker/customer_rest.rb', line 162 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
87 88 89 90 91 92 93 94 95 |
# File 'lib/booker/customer_rest.rb', line 87 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
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/booker/customer_rest.rb', line 74 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
64 65 66 67 68 69 70 71 72 |
# File 'lib/booker/customer_rest.rb', line 64 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
138 139 140 |
# File 'lib/booker/customer_rest.rb', line 138 def update_customer(customer_id, customer_data, custom_access_token = {}) put "/customer/#{customer_id}", build_params(customer_data, custom_access_token) end |