Class: Booker::V41::Merchant
- Includes:
- Booker::V4::RequestHelper
- Defined in:
- lib/booker/v4.1/merchant.rb
Constant Summary collapse
- API_METHODS =
{ appointments: '/v4.1/merchant/appointments'.freeze, customers: '/v4.1/merchant/customers'.freeze, create_special: '/v4.1/merchant/special'.freeze }.freeze
Constants included from Booker::V4::RequestHelper
Booker::V4::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
- #appointments(location_id:, start_date:, end_date:, fetch_all: true, options: {}) ⇒ Object
- #create_special(location_id:, start_date:, end_date:, coupon_code:, name:, options: {}) ⇒ Object
- #customers(location_id:, fetch_all: true, options: {}) ⇒ Object
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, #post, #put, #update_token_store
Constructor Details
This class inherits a constructor from Booker::Client
Instance Method Details
#appointments(location_id:, start_date:, end_date:, fetch_all: true, options: {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/booker/v4.1/merchant.rb', line 12 def appointments(location_id:, start_date:, end_date:, fetch_all: true, options: {}) additional_params = { LocationID: location_id, FromStartDate: start_date.to_date, ToStartDate: end_date.to_date } paginated_request( method: :post, path: API_METHODS[:appointments], params: build_params(additional_params, , true), model: Booker::V4::Models::Appointment, fetch_all: fetch_all ) end |
#create_special(location_id:, start_date:, end_date:, coupon_code:, name:, options: {}) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/booker/v4.1/merchant.rb', line 44 def create_special(location_id:, start_date:, end_date:, coupon_code:, name:, options: {}) post(API_METHODS[:create_special], build_params({ LocationID: location_id, ApplicableStartDate: start_date.in_time_zone, ApplicableEndDate: end_date.in_time_zone, CouponCode: coupon_code, Name: name }, )) end |
#customers(location_id:, fetch_all: true, options: {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/booker/v4.1/merchant.rb', line 28 def customers(location_id:, fetch_all: true, options: {}) additional_params = { FilterByExactLocationID: true, LocationID: location_id, CustomerRecordType: 1, } paginated_request( method: :post, path: API_METHODS[:customers], params: build_params(additional_params, , true), model: Booker::V4::Models::Customer, fetch_all: fetch_all ) end |