Class: Square::BookingCustomAttributesApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/square/api/booking_custom_attributes_api.rb

Overview

BookingCustomAttributesApi

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from Square::BaseApi

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.

Parameters:

  • body (BulkDeleteBookingCustomAttributesRequest)

    Required parameter:

Returns:

  • (BulkDeleteBookingCustomAttributesResponse Hash)

    response from the API call



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/square/api/booking_custom_attributes_api.rb', line 174

def bulk_delete_booking_custom_attributes(body:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v2/bookings/custom-attributes/bulk-delete',
                                 'default')
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
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.

Parameters:

  • body (BulkUpsertBookingCustomAttributesRequest)

    Required parameter:

Returns:

  • (BulkUpsertBookingCustomAttributesResponse Hash)

    response from the API call



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/square/api/booking_custom_attributes_api.rb', line 203

def bulk_upsert_booking_custom_attributes(body:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v2/bookings/custom-attributes/bulk-upsert',
                                 'default')
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
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.

Parameters:

  • body (CreateBookingCustomAttributeDefinitionRequest)

    Required

Returns:

  • (CreateBookingCustomAttributeDefinitionResponse Hash)

    response from the API call



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/square/api/booking_custom_attributes_api.rb', line 51

def create_booking_custom_attribute_definition(body:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v2/bookings/custom-attribute-definitions',
                                 'default')
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
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](entity: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.

Parameters:

  • booking_id (String)

    Required parameter: The ID of the target

  • key (String)

    Required parameter: The key of the custom attribute to

Returns:

  • (DeleteBookingCustomAttributeResponse Hash)

    response from the API call



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/square/api/booking_custom_attributes_api.rb', line 283

def delete_booking_custom_attribute(booking_id:,
                                    key:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/v2/bookings/{booking_id}/custom-attributes/{key}',
                                 'default')
               .template_param(new_parameter(booking_id, key: 'booking_id')
                                .should_encode(true))
               .template_param(new_parameter(key, key: 'key')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
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.

Parameters:

  • key (String)

    Required parameter: The key of the custom attribute

Returns:

  • (DeleteBookingCustomAttributeDefinitionResponse Hash)

    response from the API call



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/square/api/booking_custom_attributes_api.rb', line 79

def delete_booking_custom_attribute_definition(key:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/v2/bookings/custom-attribute-definitions/{key}',
                                 'default')
               .template_param(new_parameter(key, key: 'key')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
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).

Parameters:

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of results

  • cursor (String) (defaults to: nil)

    Optional parameter: The cursor returned in the

Returns:

  • (ListBookingCustomAttributeDefinitionsResponse Hash)

    response from the API call



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/square/api/booking_custom_attributes_api.rb', line 22

def list_booking_custom_attribute_definitions(limit: nil,
                                              cursor: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/bookings/custom-attribute-definitions',
                                 'default')
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
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](entity: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](entity: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`.

Parameters:

  • booking_id (String)

    Required parameter: The ID of the target

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of results

  • cursor (String) (defaults to: nil)

    Optional parameter: The cursor returned in the

  • with_definitions (TrueClass | FalseClass) (defaults to: false)

    Optional parameter:

Returns:

  • (ListBookingCustomAttributesResponse Hash)

    response from the API call



246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/square/api/booking_custom_attributes_api.rb', line 246

def list_booking_custom_attributes(booking_id:,
                                   limit: nil,
                                   cursor: nil,
                                   with_definitions: false)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/bookings/{booking_id}/custom-attributes',
                                 'default')
               .template_param(new_parameter(booking_id, key: 'booking_id')
                                .should_encode(true))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .query_param(new_parameter(with_definitions, key: 'with_definitions'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
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](entity: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](entity: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.

Parameters:

  • booking_id (String)

    Required parameter: The ID of the target

  • key (String)

    Required parameter: The key of the custom attribute to

  • with_definition (TrueClass | FalseClass) (defaults to: false)

    Optional parameter:

  • version (Integer) (defaults to: nil)

    Optional parameter: The current version of the

Returns:

  • (RetrieveBookingCustomAttributeResponse Hash)

    response from the API call



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/square/api/booking_custom_attributes_api.rb', line 326

def retrieve_booking_custom_attribute(booking_id:,
                                      key:,
                                      with_definition: false,
                                      version: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/bookings/{booking_id}/custom-attributes/{key}',
                                 'default')
               .template_param(new_parameter(booking_id, key: 'booking_id')
                                .should_encode(true))
               .template_param(new_parameter(key, key: 'key')
                                .should_encode(true))
               .query_param(new_parameter(with_definition, key: 'with_definition'))
               .query_param(new_parameter(version, key: 'version'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
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.

Parameters:

  • key (String)

    Required parameter: The key of the custom attribute

  • version (Integer) (defaults to: nil)

    Optional parameter: The current version of the

Returns:

  • (RetrieveBookingCustomAttributeDefinitionResponse Hash)

    response from the API call



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/square/api/booking_custom_attributes_api.rb', line 110

def retrieve_booking_custom_attribute_definition(key:,
                                                 version: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/bookings/custom-attribute-definitions/{key}',
                                 'default')
               .template_param(new_parameter(key, key: 'key')
                                .should_encode(true))
               .query_param(new_parameter(version, key: 'version'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
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.

Parameters:

  • key (String)

    Required parameter: The key of the custom attribute

  • body (UpdateBookingCustomAttributeDefinitionRequest)

    Required

Returns:

  • (UpdateBookingCustomAttributeDefinitionResponse Hash)

    response from the API call



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/square/api/booking_custom_attributes_api.rb', line 142

def update_booking_custom_attribute_definition(key:,
                                               body:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/v2/bookings/custom-attribute-definitions/{key}',
                                 'default')
               .template_param(new_parameter(key, key: 'key')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
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](entity: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.

Parameters:

  • booking_id (String)

    Required parameter: The ID of the target

  • key (String)

    Required parameter: The key of the custom attribute to

  • body (UpsertBookingCustomAttributeRequest)

    Required parameter: An

Returns:

  • (UpsertBookingCustomAttributeResponse Hash)

    response from the API call



367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/square/api/booking_custom_attributes_api.rb', line 367

def upsert_booking_custom_attribute(booking_id:,
                                    key:,
                                    body:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/v2/bookings/{booking_id}/custom-attributes/{key}',
                                 'default')
               .template_param(new_parameter(booking_id, key: 'booking_id')
                                .should_encode(true))
               .template_param(new_parameter(key, key: 'key')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end