Class: Square::Bookings::CustomAttributeDefinitions::Client
- Inherits:
-
Object
- Object
- Square::Bookings::CustomAttributeDefinitions::Client
- Defined in:
- lib/square/bookings/custom_attribute_definitions/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Square::Types::CreateBookingCustomAttributeDefinitionResponse
Creates a bookings custom attribute definition.
-
#delete(request_options: {}, **params) ⇒ Square::Types::DeleteBookingCustomAttributeDefinitionResponse
Deletes a bookings custom attribute definition.
-
#get(request_options: {}, **params) ⇒ Square::Types::RetrieveBookingCustomAttributeDefinitionResponse
Retrieves a bookings custom attribute definition.
- #initialize(client:) ⇒ Square::Bookings::CustomAttributeDefinitions::Client constructor
-
#list(request_options: {}, **params) ⇒ Square::Types::ListBookingCustomAttributeDefinitionsResponse
Get all bookings custom attribute definitions.
-
#update(request_options: {}, **params) ⇒ Square::Types::UpdateBookingCustomAttributeDefinitionResponse
Updates a bookings custom attribute definition.
Constructor Details
#initialize(client:) ⇒ Square::Bookings::CustomAttributeDefinitions::Client
8 9 10 |
# File 'lib/square/bookings/custom_attribute_definitions/client.rb', line 8 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Square::Types::CreateBookingCustomAttributeDefinitionResponse
Creates a bookings custom attribute definition.
To call this endpoint with buyer-level permissions, set ‘APPOINTMENTS_WRITE` for the OAuth scope. To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* or *Appointments Premium*.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/square/bookings/custom_attribute_definitions/client.rb', line 46 def create(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "POST", path: "v2/bookings/custom-attribute-definitions", body: params ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::CreateBookingCustomAttributeDefinitionResponse.load(_response.body) end raise _response.body end |
#delete(request_options: {}, **params) ⇒ Square::Types::DeleteBookingCustomAttributeDefinitionResponse
Deletes a bookings custom attribute definition.
To call this endpoint with buyer-level permissions, set ‘APPOINTMENTS_WRITE` for the OAuth scope. To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* or *Appointments Premium*.
121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/square/bookings/custom_attribute_definitions/client.rb', line 121 def delete(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "DELETE", path: "v2/bookings/custom-attribute-definitions/#{params[:key]}" ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::DeleteBookingCustomAttributeDefinitionResponse.load(_response.body) end raise _response.body end |
#get(request_options: {}, **params) ⇒ Square::Types::RetrieveBookingCustomAttributeDefinitionResponse
Retrieves a bookings custom attribute definition.
To call this endpoint with buyer-level permissions, set ‘APPOINTMENTS_READ` for the OAuth scope. To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/square/bookings/custom_attribute_definitions/client.rb', line 67 def get(request_options: {}, **params) _query_param_names = ["version"] _query = params.slice(*_query_param_names) params = params.except(*_query_param_names) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "GET", path: "v2/bookings/custom-attribute-definitions/#{params[:key]}", query: _query ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::RetrieveBookingCustomAttributeDefinitionResponse.load(_response.body) end raise _response.body end |
#list(request_options: {}, **params) ⇒ Square::Types::ListBookingCustomAttributeDefinitionsResponse
Get all bookings custom attribute definitions.
To call this endpoint with buyer-level permissions, set ‘APPOINTMENTS_READ` for the OAuth scope. To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/square/bookings/custom_attribute_definitions/client.rb', line 18 def list(request_options: {}, **params) _query_param_names = %w[limit cursor] _query = params.slice(*_query_param_names) params.except(*_query_param_names) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "GET", path: "v2/bookings/custom-attribute-definitions", query: _query ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::ListBookingCustomAttributeDefinitionsResponse.load(_response.body) end raise _response.body end |
#update(request_options: {}, **params) ⇒ Square::Types::UpdateBookingCustomAttributeDefinitionResponse
Updates a bookings custom attribute definition.
To call this endpoint with buyer-level permissions, set ‘APPOINTMENTS_WRITE` for the OAuth scope. To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* or *Appointments Premium*.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/square/bookings/custom_attribute_definitions/client.rb', line 95 def update(request_options: {}, **params) _path_param_names = ["key"] _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "PUT", path: "v2/bookings/custom-attribute-definitions/#{params[:key]}", body: params.except(*_path_param_names) ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::UpdateBookingCustomAttributeDefinitionResponse.load(_response.body) end raise _response.body end |