square.rb 24.0.0.20221019 → 26.0.0.20221214
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/booking_custom_attributes_api.rb +555 -0
- data/lib/square/api/catalog_api.rb +22 -2
- data/lib/square/api/customers_api.rb +17 -13
- data/lib/square/api/o_auth_api.rb +47 -0
- data/lib/square/api/order_custom_attributes_api.rb +601 -0
- data/lib/square/api/orders_api.rb +2 -2
- data/lib/square/client.rb +14 -2
- data/lib/square/configuration.rb +1 -1
- data/lib/square.rb +2 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc2a29582c2a6567415cc4454e30c46ce4bb02db1024c94a408388ccb65d8a22
|
4
|
+
data.tar.gz: 98bc7d48e63811198c6cd7382c817e4cd5bc3d56e973446ba3aaaab98b04a888
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 986453cdf69a944c572281510704456da9070a8546d52a092ae8e99430927ec70ebd8424b66c39e599e27c58a21858acbdab7dbf69f1a7268dc0bcaf765dbbfa
|
7
|
+
data.tar.gz: cfb8510ea05858ce8827689436357a8c98fcd3799b83f2eb188f1355aa1b10c0a848dd4181e518d797b85c704f24bd9976a49085994884644f2ad1e42cebd5a7
|
data/lib/square/api/base_api.rb
CHANGED
@@ -45,7 +45,7 @@ module Square
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def get_user_agent
|
48
|
-
user_agent = 'Square-Ruby-SDK/
|
48
|
+
user_agent = 'Square-Ruby-SDK/26.0.0.20221214 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
|
49
49
|
user_agent['{engine}'] = RUBY_ENGINE
|
50
50
|
user_agent['{engine-version}'] = RUBY_ENGINE_VERSION
|
51
51
|
user_agent['{os-info}'] = RUBY_PLATFORM
|
@@ -0,0 +1,555 @@
|
|
1
|
+
module Square
|
2
|
+
# BookingCustomAttributesApi
|
3
|
+
class BookingCustomAttributesApi < BaseApi
|
4
|
+
def initialize(config, http_call_back: nil)
|
5
|
+
super(config, http_call_back: http_call_back)
|
6
|
+
end
|
7
|
+
|
8
|
+
# Get all bookings custom attribute definitions.
|
9
|
+
# To call this endpoint with buyer-level permissions, set
|
10
|
+
# `APPOINTMENTS_READ` for the OAuth scope.
|
11
|
+
# To call this endpoint with seller-level permissions, set
|
12
|
+
# `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
|
13
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
14
|
+
# to return in a single paged response. This limit is advisory. The response
|
15
|
+
# might contain more or fewer results. The minimum value is 1 and the
|
16
|
+
# maximum value is 100. The default value is 20. For more information, see
|
17
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
18
|
+
# atterns/pagination).
|
19
|
+
# @param [String] cursor Optional parameter: The cursor returned in the
|
20
|
+
# paged response from the previous call to this endpoint. Provide this
|
21
|
+
# cursor to retrieve the next page of results for your original request. For
|
22
|
+
# more information, see
|
23
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
24
|
+
# atterns/pagination).
|
25
|
+
# @return [ListBookingCustomAttributeDefinitionsResponse Hash] response from the API call
|
26
|
+
def list_booking_custom_attribute_definitions(limit: nil,
|
27
|
+
cursor: nil)
|
28
|
+
# Prepare query url.
|
29
|
+
_query_builder = config.get_base_uri
|
30
|
+
_query_builder << '/v2/bookings/custom-attribute-definitions'
|
31
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
32
|
+
_query_builder,
|
33
|
+
'limit' => limit,
|
34
|
+
'cursor' => cursor
|
35
|
+
)
|
36
|
+
_query_url = APIHelper.clean_url _query_builder
|
37
|
+
|
38
|
+
# Prepare headers.
|
39
|
+
_headers = {
|
40
|
+
'accept' => 'application/json'
|
41
|
+
}
|
42
|
+
|
43
|
+
# Prepare and execute HttpRequest.
|
44
|
+
_request = config.http_client.get(
|
45
|
+
_query_url,
|
46
|
+
headers: _headers
|
47
|
+
)
|
48
|
+
OAuth2.apply(config, _request)
|
49
|
+
_response = execute_request(_request)
|
50
|
+
|
51
|
+
# Return appropriate response type.
|
52
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
53
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
54
|
+
ApiResponse.new(
|
55
|
+
_response, data: decoded, errors: _errors
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Creates a bookings custom attribute definition.
|
60
|
+
# To call this endpoint with buyer-level permissions, set
|
61
|
+
# `APPOINTMENTS_WRITE` for the OAuth scope.
|
62
|
+
# To call this endpoint with seller-level permissions, set
|
63
|
+
# `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
|
64
|
+
# For calls to this endpoint with seller-level permissions to succeed, the
|
65
|
+
# seller must have subscribed to *Appointments Plus*
|
66
|
+
# or *Appointments Premium*.
|
67
|
+
# @param [CreateBookingCustomAttributeDefinitionRequest] body Required
|
68
|
+
# parameter: An object containing the fields to POST for the request. See
|
69
|
+
# the corresponding object definition for field details.
|
70
|
+
# @return [CreateBookingCustomAttributeDefinitionResponse Hash] response from the API call
|
71
|
+
def create_booking_custom_attribute_definition(body:)
|
72
|
+
# Prepare query url.
|
73
|
+
_query_builder = config.get_base_uri
|
74
|
+
_query_builder << '/v2/bookings/custom-attribute-definitions'
|
75
|
+
_query_url = APIHelper.clean_url _query_builder
|
76
|
+
|
77
|
+
# Prepare headers.
|
78
|
+
_headers = {
|
79
|
+
'accept' => 'application/json',
|
80
|
+
'Content-Type' => 'application/json'
|
81
|
+
}
|
82
|
+
|
83
|
+
# Prepare and execute HttpRequest.
|
84
|
+
_request = config.http_client.post(
|
85
|
+
_query_url,
|
86
|
+
headers: _headers,
|
87
|
+
parameters: body.to_json
|
88
|
+
)
|
89
|
+
OAuth2.apply(config, _request)
|
90
|
+
_response = execute_request(_request)
|
91
|
+
|
92
|
+
# Return appropriate response type.
|
93
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
94
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
95
|
+
ApiResponse.new(
|
96
|
+
_response, data: decoded, errors: _errors
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Deletes a bookings custom attribute definition.
|
101
|
+
# To call this endpoint with buyer-level permissions, set
|
102
|
+
# `APPOINTMENTS_WRITE` for the OAuth scope.
|
103
|
+
# To call this endpoint with seller-level permissions, set
|
104
|
+
# `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
|
105
|
+
# For calls to this endpoint with seller-level permissions to succeed, the
|
106
|
+
# seller must have subscribed to *Appointments Plus*
|
107
|
+
# or *Appointments Premium*.
|
108
|
+
# @param [String] key Required parameter: The key of the custom attribute
|
109
|
+
# definition to delete.
|
110
|
+
# @return [DeleteBookingCustomAttributeDefinitionResponse Hash] response from the API call
|
111
|
+
def delete_booking_custom_attribute_definition(key:)
|
112
|
+
# Prepare query url.
|
113
|
+
_query_builder = config.get_base_uri
|
114
|
+
_query_builder << '/v2/bookings/custom-attribute-definitions/{key}'
|
115
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
116
|
+
_query_builder,
|
117
|
+
'key' => { 'value' => key, 'encode' => true }
|
118
|
+
)
|
119
|
+
_query_url = APIHelper.clean_url _query_builder
|
120
|
+
|
121
|
+
# Prepare headers.
|
122
|
+
_headers = {
|
123
|
+
'accept' => 'application/json'
|
124
|
+
}
|
125
|
+
|
126
|
+
# Prepare and execute HttpRequest.
|
127
|
+
_request = config.http_client.delete(
|
128
|
+
_query_url,
|
129
|
+
headers: _headers
|
130
|
+
)
|
131
|
+
OAuth2.apply(config, _request)
|
132
|
+
_response = execute_request(_request)
|
133
|
+
|
134
|
+
# Return appropriate response type.
|
135
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
136
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
137
|
+
ApiResponse.new(
|
138
|
+
_response, data: decoded, errors: _errors
|
139
|
+
)
|
140
|
+
end
|
141
|
+
|
142
|
+
# Retrieves a bookings custom attribute definition.
|
143
|
+
# To call this endpoint with buyer-level permissions, set
|
144
|
+
# `APPOINTMENTS_READ` for the OAuth scope.
|
145
|
+
# To call this endpoint with seller-level permissions, set
|
146
|
+
# `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
|
147
|
+
# @param [String] key Required parameter: The key of the custom attribute
|
148
|
+
# definition to retrieve. If the requesting application is not the
|
149
|
+
# definition owner, you must use the qualified key.
|
150
|
+
# @param [Integer] version Optional parameter: The current version of the
|
151
|
+
# custom attribute definition, which is used for strongly consistent reads
|
152
|
+
# to guarantee that you receive the most up-to-date data. When included in
|
153
|
+
# the request, Square returns the specified version or a higher version if
|
154
|
+
# one exists. If the specified version is higher than the current version,
|
155
|
+
# Square returns a `BAD_REQUEST` error.
|
156
|
+
# @return [RetrieveBookingCustomAttributeDefinitionResponse Hash] response from the API call
|
157
|
+
def retrieve_booking_custom_attribute_definition(key:,
|
158
|
+
version: nil)
|
159
|
+
# Prepare query url.
|
160
|
+
_query_builder = config.get_base_uri
|
161
|
+
_query_builder << '/v2/bookings/custom-attribute-definitions/{key}'
|
162
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
163
|
+
_query_builder,
|
164
|
+
'key' => { 'value' => key, 'encode' => true }
|
165
|
+
)
|
166
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
167
|
+
_query_builder,
|
168
|
+
'version' => version
|
169
|
+
)
|
170
|
+
_query_url = APIHelper.clean_url _query_builder
|
171
|
+
|
172
|
+
# Prepare headers.
|
173
|
+
_headers = {
|
174
|
+
'accept' => 'application/json'
|
175
|
+
}
|
176
|
+
|
177
|
+
# Prepare and execute HttpRequest.
|
178
|
+
_request = config.http_client.get(
|
179
|
+
_query_url,
|
180
|
+
headers: _headers
|
181
|
+
)
|
182
|
+
OAuth2.apply(config, _request)
|
183
|
+
_response = execute_request(_request)
|
184
|
+
|
185
|
+
# Return appropriate response type.
|
186
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
187
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
188
|
+
ApiResponse.new(
|
189
|
+
_response, data: decoded, errors: _errors
|
190
|
+
)
|
191
|
+
end
|
192
|
+
|
193
|
+
# Updates a bookings custom attribute definition.
|
194
|
+
# To call this endpoint with buyer-level permissions, set
|
195
|
+
# `APPOINTMENTS_WRITE` for the OAuth scope.
|
196
|
+
# To call this endpoint with seller-level permissions, set
|
197
|
+
# `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
|
198
|
+
# For calls to this endpoint with seller-level permissions to succeed, the
|
199
|
+
# seller must have subscribed to *Appointments Plus*
|
200
|
+
# or *Appointments Premium*.
|
201
|
+
# @param [String] key Required parameter: The key of the custom attribute
|
202
|
+
# definition to update.
|
203
|
+
# @param [UpdateBookingCustomAttributeDefinitionRequest] body Required
|
204
|
+
# parameter: An object containing the fields to POST for the request. See
|
205
|
+
# the corresponding object definition for field details.
|
206
|
+
# @return [UpdateBookingCustomAttributeDefinitionResponse Hash] response from the API call
|
207
|
+
def update_booking_custom_attribute_definition(key:,
|
208
|
+
body:)
|
209
|
+
# Prepare query url.
|
210
|
+
_query_builder = config.get_base_uri
|
211
|
+
_query_builder << '/v2/bookings/custom-attribute-definitions/{key}'
|
212
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
213
|
+
_query_builder,
|
214
|
+
'key' => { 'value' => key, 'encode' => true }
|
215
|
+
)
|
216
|
+
_query_url = APIHelper.clean_url _query_builder
|
217
|
+
|
218
|
+
# Prepare headers.
|
219
|
+
_headers = {
|
220
|
+
'accept' => 'application/json',
|
221
|
+
'Content-Type' => 'application/json'
|
222
|
+
}
|
223
|
+
|
224
|
+
# Prepare and execute HttpRequest.
|
225
|
+
_request = config.http_client.put(
|
226
|
+
_query_url,
|
227
|
+
headers: _headers,
|
228
|
+
parameters: body.to_json
|
229
|
+
)
|
230
|
+
OAuth2.apply(config, _request)
|
231
|
+
_response = execute_request(_request)
|
232
|
+
|
233
|
+
# Return appropriate response type.
|
234
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
235
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
236
|
+
ApiResponse.new(
|
237
|
+
_response, data: decoded, errors: _errors
|
238
|
+
)
|
239
|
+
end
|
240
|
+
|
241
|
+
# Bulk deletes bookings custom attributes.
|
242
|
+
# To call this endpoint with buyer-level permissions, set
|
243
|
+
# `APPOINTMENTS_WRITE` for the OAuth scope.
|
244
|
+
# To call this endpoint with seller-level permissions, set
|
245
|
+
# `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
|
246
|
+
# For calls to this endpoint with seller-level permissions to succeed, the
|
247
|
+
# seller must have subscribed to *Appointments Plus*
|
248
|
+
# or *Appointments Premium*.
|
249
|
+
# @param [BulkDeleteBookingCustomAttributesRequest] body Required parameter:
|
250
|
+
# An object containing the fields to POST for the request. See the
|
251
|
+
# corresponding object definition for field details.
|
252
|
+
# @return [BulkDeleteBookingCustomAttributesResponse Hash] response from the API call
|
253
|
+
def bulk_delete_booking_custom_attributes(body:)
|
254
|
+
# Prepare query url.
|
255
|
+
_query_builder = config.get_base_uri
|
256
|
+
_query_builder << '/v2/bookings/custom-attributes/bulk-delete'
|
257
|
+
_query_url = APIHelper.clean_url _query_builder
|
258
|
+
|
259
|
+
# Prepare headers.
|
260
|
+
_headers = {
|
261
|
+
'accept' => 'application/json',
|
262
|
+
'Content-Type' => 'application/json'
|
263
|
+
}
|
264
|
+
|
265
|
+
# Prepare and execute HttpRequest.
|
266
|
+
_request = config.http_client.post(
|
267
|
+
_query_url,
|
268
|
+
headers: _headers,
|
269
|
+
parameters: body.to_json
|
270
|
+
)
|
271
|
+
OAuth2.apply(config, _request)
|
272
|
+
_response = execute_request(_request)
|
273
|
+
|
274
|
+
# Return appropriate response type.
|
275
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
276
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
277
|
+
ApiResponse.new(
|
278
|
+
_response, data: decoded, errors: _errors
|
279
|
+
)
|
280
|
+
end
|
281
|
+
|
282
|
+
# Bulk upserts bookings custom attributes.
|
283
|
+
# To call this endpoint with buyer-level permissions, set
|
284
|
+
# `APPOINTMENTS_WRITE` for the OAuth scope.
|
285
|
+
# To call this endpoint with seller-level permissions, set
|
286
|
+
# `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
|
287
|
+
# For calls to this endpoint with seller-level permissions to succeed, the
|
288
|
+
# seller must have subscribed to *Appointments Plus*
|
289
|
+
# or *Appointments Premium*.
|
290
|
+
# @param [BulkUpsertBookingCustomAttributesRequest] body Required parameter:
|
291
|
+
# An object containing the fields to POST for the request. See the
|
292
|
+
# corresponding object definition for field details.
|
293
|
+
# @return [BulkUpsertBookingCustomAttributesResponse Hash] response from the API call
|
294
|
+
def bulk_upsert_booking_custom_attributes(body:)
|
295
|
+
# Prepare query url.
|
296
|
+
_query_builder = config.get_base_uri
|
297
|
+
_query_builder << '/v2/bookings/custom-attributes/bulk-upsert'
|
298
|
+
_query_url = APIHelper.clean_url _query_builder
|
299
|
+
|
300
|
+
# Prepare headers.
|
301
|
+
_headers = {
|
302
|
+
'accept' => 'application/json',
|
303
|
+
'Content-Type' => 'application/json'
|
304
|
+
}
|
305
|
+
|
306
|
+
# Prepare and execute HttpRequest.
|
307
|
+
_request = config.http_client.post(
|
308
|
+
_query_url,
|
309
|
+
headers: _headers,
|
310
|
+
parameters: body.to_json
|
311
|
+
)
|
312
|
+
OAuth2.apply(config, _request)
|
313
|
+
_response = execute_request(_request)
|
314
|
+
|
315
|
+
# Return appropriate response type.
|
316
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
317
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
318
|
+
ApiResponse.new(
|
319
|
+
_response, data: decoded, errors: _errors
|
320
|
+
)
|
321
|
+
end
|
322
|
+
|
323
|
+
# Lists a booking's custom attributes.
|
324
|
+
# To call this endpoint with buyer-level permissions, set
|
325
|
+
# `APPOINTMENTS_READ` for the OAuth scope.
|
326
|
+
# To call this endpoint with seller-level permissions, set
|
327
|
+
# `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
|
328
|
+
# @param [String] booking_id Required parameter: The ID of the target
|
329
|
+
# [booking]($m/Booking).
|
330
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
331
|
+
# to return in a single paged response. This limit is advisory. The response
|
332
|
+
# might contain more or fewer results. The minimum value is 1 and the
|
333
|
+
# maximum value is 100. The default value is 20. For more information, see
|
334
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
335
|
+
# atterns/pagination).
|
336
|
+
# @param [String] cursor Optional parameter: The cursor returned in the
|
337
|
+
# paged response from the previous call to this endpoint. Provide this
|
338
|
+
# cursor to retrieve the next page of results for your original request. For
|
339
|
+
# more information, see
|
340
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
341
|
+
# atterns/pagination).
|
342
|
+
# @param [TrueClass|FalseClass] with_definitions Optional parameter:
|
343
|
+
# Indicates whether to return the [custom attribute
|
344
|
+
# definition]($m/CustomAttributeDefinition) in the `definition` field of
|
345
|
+
# each custom attribute. Set this parameter to `true` to get the name and
|
346
|
+
# description of each custom attribute, information about the data type, or
|
347
|
+
# other definition details. The default value is `false`.
|
348
|
+
# @return [ListBookingCustomAttributesResponse Hash] response from the API call
|
349
|
+
def list_booking_custom_attributes(booking_id:,
|
350
|
+
limit: nil,
|
351
|
+
cursor: nil,
|
352
|
+
with_definitions: false)
|
353
|
+
# Prepare query url.
|
354
|
+
_query_builder = config.get_base_uri
|
355
|
+
_query_builder << '/v2/bookings/{booking_id}/custom-attributes'
|
356
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
357
|
+
_query_builder,
|
358
|
+
'booking_id' => { 'value' => booking_id, 'encode' => true }
|
359
|
+
)
|
360
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
361
|
+
_query_builder,
|
362
|
+
'limit' => limit,
|
363
|
+
'cursor' => cursor,
|
364
|
+
'with_definitions' => with_definitions
|
365
|
+
)
|
366
|
+
_query_url = APIHelper.clean_url _query_builder
|
367
|
+
|
368
|
+
# Prepare headers.
|
369
|
+
_headers = {
|
370
|
+
'accept' => 'application/json'
|
371
|
+
}
|
372
|
+
|
373
|
+
# Prepare and execute HttpRequest.
|
374
|
+
_request = config.http_client.get(
|
375
|
+
_query_url,
|
376
|
+
headers: _headers
|
377
|
+
)
|
378
|
+
OAuth2.apply(config, _request)
|
379
|
+
_response = execute_request(_request)
|
380
|
+
|
381
|
+
# Return appropriate response type.
|
382
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
383
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
384
|
+
ApiResponse.new(
|
385
|
+
_response, data: decoded, errors: _errors
|
386
|
+
)
|
387
|
+
end
|
388
|
+
|
389
|
+
# Deletes a bookings custom attribute.
|
390
|
+
# To call this endpoint with buyer-level permissions, set
|
391
|
+
# `APPOINTMENTS_WRITE` for the OAuth scope.
|
392
|
+
# To call this endpoint with seller-level permissions, set
|
393
|
+
# `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
|
394
|
+
# For calls to this endpoint with seller-level permissions to succeed, the
|
395
|
+
# seller must have subscribed to *Appointments Plus*
|
396
|
+
# or *Appointments Premium*.
|
397
|
+
# @param [String] booking_id Required parameter: The ID of the target
|
398
|
+
# [booking]($m/Booking).
|
399
|
+
# @param [String] key Required parameter: The key of the custom attribute to
|
400
|
+
# delete. This key must match the `key` of a custom attribute definition in
|
401
|
+
# the Square seller account. If the requesting application is not the
|
402
|
+
# definition owner, you must use the qualified key.
|
403
|
+
# @return [DeleteBookingCustomAttributeResponse Hash] response from the API call
|
404
|
+
def delete_booking_custom_attribute(booking_id:,
|
405
|
+
key:)
|
406
|
+
# Prepare query url.
|
407
|
+
_query_builder = config.get_base_uri
|
408
|
+
_query_builder << '/v2/bookings/{booking_id}/custom-attributes/{key}'
|
409
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
410
|
+
_query_builder,
|
411
|
+
'booking_id' => { 'value' => booking_id, 'encode' => true },
|
412
|
+
'key' => { 'value' => key, 'encode' => true }
|
413
|
+
)
|
414
|
+
_query_url = APIHelper.clean_url _query_builder
|
415
|
+
|
416
|
+
# Prepare headers.
|
417
|
+
_headers = {
|
418
|
+
'accept' => 'application/json'
|
419
|
+
}
|
420
|
+
|
421
|
+
# Prepare and execute HttpRequest.
|
422
|
+
_request = config.http_client.delete(
|
423
|
+
_query_url,
|
424
|
+
headers: _headers
|
425
|
+
)
|
426
|
+
OAuth2.apply(config, _request)
|
427
|
+
_response = execute_request(_request)
|
428
|
+
|
429
|
+
# Return appropriate response type.
|
430
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
431
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
432
|
+
ApiResponse.new(
|
433
|
+
_response, data: decoded, errors: _errors
|
434
|
+
)
|
435
|
+
end
|
436
|
+
|
437
|
+
# Retrieves a bookings custom attribute.
|
438
|
+
# To call this endpoint with buyer-level permissions, set
|
439
|
+
# `APPOINTMENTS_READ` for the OAuth scope.
|
440
|
+
# To call this endpoint with seller-level permissions, set
|
441
|
+
# `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
|
442
|
+
# @param [String] booking_id Required parameter: The ID of the target
|
443
|
+
# [booking]($m/Booking).
|
444
|
+
# @param [String] key Required parameter: The key of the custom attribute to
|
445
|
+
# retrieve. This key must match the `key` of a custom attribute definition
|
446
|
+
# in the Square seller account. If the requesting application is not the
|
447
|
+
# definition owner, you must use the qualified key.
|
448
|
+
# @param [TrueClass|FalseClass] with_definition Optional parameter:
|
449
|
+
# Indicates whether to return the [custom attribute
|
450
|
+
# definition]($m/CustomAttributeDefinition) in the `definition` field of the
|
451
|
+
# custom attribute. Set this parameter to `true` to get the name and
|
452
|
+
# description of the custom attribute, information about the data type, or
|
453
|
+
# other definition details. The default value is `false`.
|
454
|
+
# @param [Integer] version Optional parameter: The current version of the
|
455
|
+
# custom attribute, which is used for strongly consistent reads to guarantee
|
456
|
+
# that you receive the most up-to-date data. When included in the request,
|
457
|
+
# Square returns the specified version or a higher version if one exists. If
|
458
|
+
# the specified version is higher than the current version, Square returns a
|
459
|
+
# `BAD_REQUEST` error.
|
460
|
+
# @return [RetrieveBookingCustomAttributeResponse Hash] response from the API call
|
461
|
+
def retrieve_booking_custom_attribute(booking_id:,
|
462
|
+
key:,
|
463
|
+
with_definition: false,
|
464
|
+
version: nil)
|
465
|
+
# Prepare query url.
|
466
|
+
_query_builder = config.get_base_uri
|
467
|
+
_query_builder << '/v2/bookings/{booking_id}/custom-attributes/{key}'
|
468
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
469
|
+
_query_builder,
|
470
|
+
'booking_id' => { 'value' => booking_id, 'encode' => true },
|
471
|
+
'key' => { 'value' => key, 'encode' => true }
|
472
|
+
)
|
473
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
474
|
+
_query_builder,
|
475
|
+
'with_definition' => with_definition,
|
476
|
+
'version' => version
|
477
|
+
)
|
478
|
+
_query_url = APIHelper.clean_url _query_builder
|
479
|
+
|
480
|
+
# Prepare headers.
|
481
|
+
_headers = {
|
482
|
+
'accept' => 'application/json'
|
483
|
+
}
|
484
|
+
|
485
|
+
# Prepare and execute HttpRequest.
|
486
|
+
_request = config.http_client.get(
|
487
|
+
_query_url,
|
488
|
+
headers: _headers
|
489
|
+
)
|
490
|
+
OAuth2.apply(config, _request)
|
491
|
+
_response = execute_request(_request)
|
492
|
+
|
493
|
+
# Return appropriate response type.
|
494
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
495
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
496
|
+
ApiResponse.new(
|
497
|
+
_response, data: decoded, errors: _errors
|
498
|
+
)
|
499
|
+
end
|
500
|
+
|
501
|
+
# Upserts a bookings custom attribute.
|
502
|
+
# To call this endpoint with buyer-level permissions, set
|
503
|
+
# `APPOINTMENTS_WRITE` for the OAuth scope.
|
504
|
+
# To call this endpoint with seller-level permissions, set
|
505
|
+
# `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
|
506
|
+
# For calls to this endpoint with seller-level permissions to succeed, the
|
507
|
+
# seller must have subscribed to *Appointments Plus*
|
508
|
+
# or *Appointments Premium*.
|
509
|
+
# @param [String] booking_id Required parameter: The ID of the target
|
510
|
+
# [booking]($m/Booking).
|
511
|
+
# @param [String] key Required parameter: The key of the custom attribute to
|
512
|
+
# create or update. This key must match the `key` of a custom attribute
|
513
|
+
# definition in the Square seller account. If the requesting application is
|
514
|
+
# not the definition owner, you must use the qualified key.
|
515
|
+
# @param [UpsertBookingCustomAttributeRequest] body Required parameter: An
|
516
|
+
# object containing the fields to POST for the request. See the
|
517
|
+
# corresponding object definition for field details.
|
518
|
+
# @return [UpsertBookingCustomAttributeResponse Hash] response from the API call
|
519
|
+
def upsert_booking_custom_attribute(booking_id:,
|
520
|
+
key:,
|
521
|
+
body:)
|
522
|
+
# Prepare query url.
|
523
|
+
_query_builder = config.get_base_uri
|
524
|
+
_query_builder << '/v2/bookings/{booking_id}/custom-attributes/{key}'
|
525
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
526
|
+
_query_builder,
|
527
|
+
'booking_id' => { 'value' => booking_id, 'encode' => true },
|
528
|
+
'key' => { 'value' => key, 'encode' => true }
|
529
|
+
)
|
530
|
+
_query_url = APIHelper.clean_url _query_builder
|
531
|
+
|
532
|
+
# Prepare headers.
|
533
|
+
_headers = {
|
534
|
+
'accept' => 'application/json',
|
535
|
+
'Content-Type' => 'application/json'
|
536
|
+
}
|
537
|
+
|
538
|
+
# Prepare and execute HttpRequest.
|
539
|
+
_request = config.http_client.put(
|
540
|
+
_query_url,
|
541
|
+
headers: _headers,
|
542
|
+
parameters: body.to_json
|
543
|
+
)
|
544
|
+
OAuth2.apply(config, _request)
|
545
|
+
_response = execute_request(_request)
|
546
|
+
|
547
|
+
# Return appropriate response type.
|
548
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
549
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
550
|
+
ApiResponse.new(
|
551
|
+
_response, data: decoded, errors: _errors
|
552
|
+
)
|
553
|
+
end
|
554
|
+
end
|
555
|
+
end
|
@@ -16,6 +16,11 @@ module Square
|
|
16
16
|
# targeted
|
17
17
|
# IDs can be deleted. The response will only include IDs that were
|
18
18
|
# actually deleted.
|
19
|
+
# To ensure consistency, only one delete request is processed at a time per
|
20
|
+
# seller account.
|
21
|
+
# While one (batch or non-batch) delete request is being processed, other
|
22
|
+
# (batched and non-batched)
|
23
|
+
# delete requests are rejected with the `429` error code.
|
19
24
|
# @param [BatchDeleteCatalogObjectsRequest] body Required parameter: An
|
20
25
|
# object containing the fields to POST for the request. See the
|
21
26
|
# corresponding object definition for field details.
|
@@ -102,6 +107,11 @@ module Square
|
|
102
107
|
# request (items, variations, modifier lists, discounts, and taxes) is no
|
103
108
|
# more
|
104
109
|
# than 10,000.
|
110
|
+
# To ensure consistency, only one update request is processed at a time per
|
111
|
+
# seller account.
|
112
|
+
# While one (batch or non-batch) update request is being processed, other
|
113
|
+
# (batched and non-batched)
|
114
|
+
# update requests are rejected with the `429` error code.
|
105
115
|
# @param [BatchUpsertCatalogObjectsRequest] body Required parameter: An
|
106
116
|
# object containing the fields to POST for the request. See the
|
107
117
|
# corresponding object definition for field details.
|
@@ -320,7 +330,7 @@ module Square
|
|
320
330
|
# SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION,
|
321
331
|
# QUICK_AMOUNT_SETTINGS.
|
322
332
|
# @param [Integer] catalog_version Optional parameter: The specific version
|
323
|
-
# of the catalog objects to be included in the response.
|
333
|
+
# of the catalog objects to be included in the response. This allows you to
|
324
334
|
# retrieve historical versions of objects. The specified version value is
|
325
335
|
# matched against the [CatalogObject]($m/CatalogObject)s' `version`
|
326
336
|
# attribute. If not included, results will be from the current version of
|
@@ -361,7 +371,12 @@ module Square
|
|
361
371
|
)
|
362
372
|
end
|
363
373
|
|
364
|
-
# Creates or updates the
|
374
|
+
# Creates a new or updates the specified [CatalogObject]($m/CatalogObject).
|
375
|
+
# To ensure consistency, only one update request is processed at a time per
|
376
|
+
# seller account.
|
377
|
+
# While one (batch or non-batch) update request is being processed, other
|
378
|
+
# (batched and non-batched)
|
379
|
+
# update requests are rejected with the `429` error code.
|
365
380
|
# @param [UpsertCatalogObjectRequest] body Required parameter: An object
|
366
381
|
# containing the fields to POST for the request. See the corresponding
|
367
382
|
# object definition for field details.
|
@@ -403,6 +418,11 @@ module Square
|
|
403
418
|
# are also deleted. For example, deleting a [CatalogItem]($m/CatalogItem)
|
404
419
|
# will also delete all of its
|
405
420
|
# [CatalogItemVariation]($m/CatalogItemVariation) children.
|
421
|
+
# To ensure consistency, only one delete request is processed at a time per
|
422
|
+
# seller account.
|
423
|
+
# While one (batch or non-batch) delete request is being processed, other
|
424
|
+
# (batched and non-batched)
|
425
|
+
# delete requests are rejected with the `429` error code.
|
406
426
|
# @param [String] object_id Required parameter: The ID of the catalog object
|
407
427
|
# to be deleted. When an object is deleted, other objects in the graph that
|
408
428
|
# depend on that object will be deleted as well (for example, deleting a
|
@@ -156,11 +156,12 @@ module Square
|
|
156
156
|
|
157
157
|
# Deletes a customer profile from a business. This operation also unlinks
|
158
158
|
# any associated cards on file.
|
159
|
-
# As a best practice,
|
160
|
-
#
|
161
|
-
# concurrency](https://developer.squareup.com/docs/
|
162
|
-
#
|
163
|
-
# the customer
|
159
|
+
# As a best practice, include the `version` field in the request to enable
|
160
|
+
# [optimistic
|
161
|
+
# concurrency](https://developer.squareup.com/docs/build-basics/common-api-p
|
162
|
+
# atterns/optimistic-concurrency) control.
|
163
|
+
# If included, the value must be set to the current version of the customer
|
164
|
+
# profile.
|
164
165
|
# To delete a customer profile that was created by merging existing
|
165
166
|
# profiles, you must use the ID of the newly created profile.
|
166
167
|
# @param [String] customer_id Required parameter: The ID of the customer to
|
@@ -245,14 +246,17 @@ module Square
|
|
245
246
|
)
|
246
247
|
end
|
247
248
|
|
248
|
-
# Updates a customer profile.
|
249
|
-
#
|
250
|
-
#
|
251
|
-
#
|
252
|
-
#
|
253
|
-
#
|
254
|
-
#
|
255
|
-
#
|
249
|
+
# Updates a customer profile. This endpoint supports sparse updates, so only
|
250
|
+
# new or changed fields are required in the request.
|
251
|
+
# To add or update a field, specify the new value. To remove a field,
|
252
|
+
# specify `null` and include the `X-Clear-Null` header set to `true`
|
253
|
+
# (recommended) or specify an empty string (string fields only).
|
254
|
+
# As a best practice, include the `version` field in the request to enable
|
255
|
+
# [optimistic
|
256
|
+
# concurrency](https://developer.squareup.com/docs/build-basics/common-api-p
|
257
|
+
# atterns/optimistic-concurrency) control.
|
258
|
+
# If included, the value must be set to the current version of the customer
|
259
|
+
# profile.
|
256
260
|
# To update a customer profile that was created by merging existing
|
257
261
|
# profiles, you must use the ID of the newly created profile.
|
258
262
|
# You cannot use this endpoint to change cards on file. To make changes, use
|