Class: Square::BookingCustomAttributesApi
- Defined in:
- lib/square/api/booking_custom_attributes_api.rb
Overview
BookingCustomAttributesApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#bulk_delete_booking_custom_attributes(body:) ⇒ BulkDeleteBookingCustomAttributesResponse Hash
Bulk deletes bookings custom attributes.
-
#bulk_upsert_booking_custom_attributes(body:) ⇒ BulkUpsertBookingCustomAttributesResponse Hash
Bulk upserts bookings custom attributes.
-
#create_booking_custom_attribute_definition(body:) ⇒ CreateBookingCustomAttributeDefinitionResponse Hash
Creates a bookings custom attribute definition.
-
#delete_booking_custom_attribute(booking_id:, key:) ⇒ DeleteBookingCustomAttributeResponse Hash
Deletes a bookings custom attribute.
-
#delete_booking_custom_attribute_definition(key:) ⇒ DeleteBookingCustomAttributeDefinitionResponse Hash
Deletes a bookings custom attribute definition.
-
#initialize(config, http_call_back: nil) ⇒ BookingCustomAttributesApi
constructor
A new instance of BookingCustomAttributesApi.
-
#list_booking_custom_attribute_definitions(limit: nil, cursor: nil) ⇒ ListBookingCustomAttributeDefinitionsResponse Hash
Get all bookings custom attribute definitions.
-
#list_booking_custom_attributes(booking_id:, limit: nil, cursor: nil, with_definitions: false) ⇒ ListBookingCustomAttributesResponse Hash
Lists a booking's custom attributes.
-
#retrieve_booking_custom_attribute(booking_id:, key:, with_definition: false, version: nil) ⇒ RetrieveBookingCustomAttributeResponse Hash
Retrieves a bookings custom attribute.
-
#retrieve_booking_custom_attribute_definition(key:, version: nil) ⇒ RetrieveBookingCustomAttributeDefinitionResponse Hash
Retrieves a bookings custom attribute definition.
-
#update_booking_custom_attribute_definition(key:, body:) ⇒ UpdateBookingCustomAttributeDefinitionResponse Hash
Updates a bookings custom attribute definition.
-
#upsert_booking_custom_attribute(booking_id:, key:, body:) ⇒ UpsertBookingCustomAttributeResponse Hash
Upserts a bookings custom attribute.
Methods inherited from BaseApi
#execute_request, #get_user_agent, #validate_parameters, #validate_parameters_types
Constructor Details
#initialize(config, http_call_back: nil) ⇒ BookingCustomAttributesApi
Returns a new instance of BookingCustomAttributesApi.
4 5 6 |
# File 'lib/square/api/booking_custom_attributes_api.rb', line 4 def initialize(config, http_call_back: nil) super(config, http_call_back: http_call_back) end |
Instance Method Details
#bulk_delete_booking_custom_attributes(body:) ⇒ BulkDeleteBookingCustomAttributesResponse Hash
Bulk deletes bookings custom attributes. 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*. An object containing the fields to POST for the request. See the corresponding object definition for field details.
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/square/api/booking_custom_attributes_api.rb', line 253 def bulk_delete_booking_custom_attributes(body:) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bookings/custom-attributes/bulk-delete' _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json', 'Content-Type' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.post( _query_url, headers: _headers, parameters: body.to_json ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#bulk_upsert_booking_custom_attributes(body:) ⇒ BulkUpsertBookingCustomAttributesResponse Hash
Bulk upserts bookings custom attributes. 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*. An object containing the fields to POST for the request. See the corresponding object definition for field details.
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/square/api/booking_custom_attributes_api.rb', line 294 def bulk_upsert_booking_custom_attributes(body:) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bookings/custom-attributes/bulk-upsert' _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json', 'Content-Type' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.post( _query_url, headers: _headers, parameters: body.to_json ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#create_booking_custom_attribute_definition(body:) ⇒ CreateBookingCustomAttributeDefinitionResponse Hash
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*. parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/square/api/booking_custom_attributes_api.rb', line 71 def create_booking_custom_attribute_definition(body:) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bookings/custom-attribute-definitions' _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json', 'Content-Type' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.post( _query_url, headers: _headers, parameters: body.to_json ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#delete_booking_custom_attribute(booking_id:, key:) ⇒ DeleteBookingCustomAttributeResponse Hash
Deletes a bookings custom attribute. 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*. [booking]($m/Booking). delete. This key must match the `key` of a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
# File 'lib/square/api/booking_custom_attributes_api.rb', line 404 def delete_booking_custom_attribute(booking_id:, key:) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bookings/{booking_id}/custom-attributes/{key}' _query_builder = APIHelper.append_url_with_template_parameters( _query_builder, 'booking_id' => { 'value' => booking_id, 'encode' => true }, 'key' => { 'value' => key, 'encode' => true } ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.delete( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#delete_booking_custom_attribute_definition(key:) ⇒ DeleteBookingCustomAttributeDefinitionResponse Hash
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*. definition to delete.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/square/api/booking_custom_attributes_api.rb', line 111 def delete_booking_custom_attribute_definition(key:) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bookings/custom-attribute-definitions/{key}' _query_builder = APIHelper.append_url_with_template_parameters( _query_builder, 'key' => { 'value' => key, 'encode' => true } ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.delete( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#list_booking_custom_attribute_definitions(limit: nil, cursor: nil) ⇒ ListBookingCustomAttributeDefinitionsResponse Hash
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. to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see [Pagination](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination). paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see [Pagination](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination).
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/square/api/booking_custom_attributes_api.rb', line 26 def list_booking_custom_attribute_definitions(limit: nil, cursor: nil) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bookings/custom-attribute-definitions' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, 'limit' => limit, 'cursor' => cursor ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#list_booking_custom_attributes(booking_id:, limit: nil, cursor: nil, with_definitions: false) ⇒ ListBookingCustomAttributesResponse Hash
Lists a booking's custom attributes. 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. [booking]($m/Booking). to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see [Pagination](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination). paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see [Pagination](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination). Indicates whether to return the [custom attribute definition]($m/CustomAttributeDefinition) in the `definition` field of each custom attribute. Set this parameter to `true` to get the name and description of each custom attribute, information about the data type, or other definition details. The default value is `false`.
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/square/api/booking_custom_attributes_api.rb', line 349 def list_booking_custom_attributes(booking_id:, limit: nil, cursor: nil, with_definitions: false) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bookings/{booking_id}/custom-attributes' _query_builder = APIHelper.append_url_with_template_parameters( _query_builder, 'booking_id' => { 'value' => booking_id, 'encode' => true } ) _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, 'limit' => limit, 'cursor' => cursor, 'with_definitions' => with_definitions ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#retrieve_booking_custom_attribute(booking_id:, key:, with_definition: false, version: nil) ⇒ RetrieveBookingCustomAttributeResponse Hash
Retrieves a bookings custom attribute. 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. [booking]($m/Booking). retrieve. This key must match the `key` of a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key. Indicates whether to return the [custom attribute definition]($m/CustomAttributeDefinition) in the `definition` field of the custom attribute. Set this parameter to `true` to get the name and description of the custom attribute, information about the data type, or other definition details. The default value is `false`. custom attribute, which is used for strongly consistent reads to guarantee that you receive the most up-to-date data. When included in the request, Square returns the specified version or a higher version if one exists. If the specified version is higher than the current version, Square returns a `BAD_REQUEST` error.
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 |
# File 'lib/square/api/booking_custom_attributes_api.rb', line 461 def retrieve_booking_custom_attribute(booking_id:, key:, with_definition: false, version: nil) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bookings/{booking_id}/custom-attributes/{key}' _query_builder = APIHelper.append_url_with_template_parameters( _query_builder, 'booking_id' => { 'value' => booking_id, 'encode' => true }, 'key' => { 'value' => key, 'encode' => true } ) _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, 'with_definition' => with_definition, 'version' => version ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#retrieve_booking_custom_attribute_definition(key:, version: nil) ⇒ RetrieveBookingCustomAttributeDefinitionResponse Hash
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. definition to retrieve. If the requesting application is not the definition owner, you must use the qualified key. custom attribute definition, which is used for strongly consistent reads to guarantee that you receive the most up-to-date data. When included in the request, Square returns the specified version or a higher version if one exists. If the specified version is higher than the current version, Square returns a `BAD_REQUEST` error.
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/square/api/booking_custom_attributes_api.rb', line 157 def retrieve_booking_custom_attribute_definition(key:, version: nil) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bookings/custom-attribute-definitions/{key}' _query_builder = APIHelper.append_url_with_template_parameters( _query_builder, 'key' => { 'value' => key, 'encode' => true } ) _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, 'version' => version ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#update_booking_custom_attribute_definition(key:, body:) ⇒ UpdateBookingCustomAttributeDefinitionResponse Hash
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*. definition to update. parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details.
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/square/api/booking_custom_attributes_api.rb', line 207 def update_booking_custom_attribute_definition(key:, body:) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bookings/custom-attribute-definitions/{key}' _query_builder = APIHelper.append_url_with_template_parameters( _query_builder, 'key' => { 'value' => key, 'encode' => true } ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json', 'Content-Type' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.put( _query_url, headers: _headers, parameters: body.to_json ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#upsert_booking_custom_attribute(booking_id:, key:, body:) ⇒ UpsertBookingCustomAttributeResponse Hash
Upserts a bookings custom attribute. 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*. [booking]($m/Booking). create or update. This key must match the `key` of a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key. object containing the fields to POST for the request. See the corresponding object definition for field details.
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 |
# File 'lib/square/api/booking_custom_attributes_api.rb', line 519 def upsert_booking_custom_attribute(booking_id:, key:, body:) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bookings/{booking_id}/custom-attributes/{key}' _query_builder = APIHelper.append_url_with_template_parameters( _query_builder, 'booking_id' => { 'value' => booking_id, 'encode' => true }, 'key' => { 'value' => key, 'encode' => true } ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json', 'Content-Type' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.put( _query_url, headers: _headers, parameters: body.to_json ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |