Module: Booker::BusinessREST
Constant Summary
Constants included from CommonREST
CommonREST::DEFAULT_PAGINATION_PARAMS
Instance Method Summary collapse
- #create_special(booker_location_id:, start_date:, end_date:, coupon_code:, name:, params: {}) ⇒ Object
- #find_appointments(booker_location_id:, start_at:, end_at:, fetch_all: true, params: {}) ⇒ Object
- #find_customers(booker_location_id:, fetch_all: true, params: {}) ⇒ Object
- #find_employees(booker_location_id:, fetch_all: true, params: {}) ⇒ Object
- #find_locations(params: {}) ⇒ Object
- #find_treatments(booker_location_id:, fetch_all: true, params: {}) ⇒ Object
- #get_location(booker_location_id:) ⇒ Object
- #get_logged_in_user ⇒ Object
Methods included from CommonREST
#confirm_appointment, #get_online_booking_settings
Instance Method Details
#create_special(booker_location_id:, start_date:, end_date:, coupon_code:, name:, params: {}) ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'lib/booker/business_rest.rb', line 79 def create_special(booker_location_id:, start_date:, end_date:, coupon_code:, name:, params: {}) post('/special', build_params({ 'LocationID' => booker_location_id, 'ApplicableStartDate' => start_date.in_time_zone, 'ApplicableEndDate' => end_date.in_time_zone, 'CouponCode' => coupon_code, 'Name' => name }, params)) end |
#find_appointments(booker_location_id:, start_at:, end_at:, fetch_all: true, params: {}) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/booker/business_rest.rb', line 63 def find_appointments(booker_location_id:, start_at:, end_at:, fetch_all: true, params: {}) additional_params = { 'LocationID' => booker_location_id, 'FromStartDate' => start_at, 'ToStartDate' => end_at } paginated_request( method: :post, path: '/appointments', params: build_params(additional_params, params, true), model: Booker::Models::Appointment, fetch_all: fetch_all ) end |
#find_customers(booker_location_id:, fetch_all: true, params: {}) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/booker/business_rest.rb', line 47 def find_customers(booker_location_id:, fetch_all: true, params: {}) additional_params = { 'FilterByExactLocationID' => true, 'LocationID' => booker_location_id, 'CustomerRecordType' => 1, } paginated_request( method: :post, path: '/customers', params: build_params(additional_params, params, true), model: Booker::Models::Customer, fetch_all: fetch_all ) end |
#find_employees(booker_location_id:, fetch_all: true, params: {}) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/booker/business_rest.rb', line 27 def find_employees(booker_location_id:, fetch_all: true, params: {}) paginated_request( method: :post, path: '/employees', params: build_params({'LocationID' => booker_location_id}, params, true), model: Booker::Models::Employee, fetch_all: fetch_all ) end |
#find_locations(params: {}) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/booker/business_rest.rb', line 18 def find_locations(params: {}) paginated_request( method: :post, path: '/locations', params: build_params({}, params, true), model: Booker::Models::Location ) end |
#find_treatments(booker_location_id:, fetch_all: true, params: {}) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/booker/business_rest.rb', line 37 def find_treatments(booker_location_id:, fetch_all: true, params: {}) paginated_request( method: :post, path: '/treatments', params: build_params({'LocationID' => booker_location_id}, params, true), model: Booker::Models::Treatment, fetch_all: fetch_all ) end |
#get_location(booker_location_id:) ⇒ Object
13 14 15 16 |
# File 'lib/booker/business_rest.rb', line 13 def get_location(booker_location_id:) response = get("/location/#{booker_location_id}", build_params) Booker::Models::Location.from_hash(response) end |
#get_logged_in_user ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/booker/business_rest.rb', line 5 def get_logged_in_user response = get('/user', build_params) result = Booker::Models::User.from_hash(response['User']) result.LocationID = response['LocationID'] result.BrandID = response['BrandID'] result end |