square.rb 8.1.0.20210121 → 18.1.0.20220316

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +59 -213
  4. data/lib/square/api/apple_pay_api.rb +9 -8
  5. data/lib/square/api/bank_accounts_api.rb +5 -5
  6. data/lib/square/api/base_api.rb +20 -9
  7. data/lib/square/api/bookings_api.rb +95 -12
  8. data/lib/square/api/cards_api.rb +170 -0
  9. data/lib/square/api/cash_drawers_api.rb +2 -2
  10. data/lib/square/api/catalog_api.rb +140 -66
  11. data/lib/square/api/checkout_api.rb +3 -3
  12. data/lib/square/api/customer_groups_api.rb +17 -8
  13. data/lib/square/api/customer_segments_api.rb +15 -6
  14. data/lib/square/api/customers_api.rb +61 -31
  15. data/lib/square/api/devices_api.rb +3 -2
  16. data/lib/square/api/disputes_api.rb +101 -92
  17. data/lib/square/api/gift_card_activities_api.rb +133 -0
  18. data/lib/square/api/gift_cards_api.rb +297 -0
  19. data/lib/square/api/inventory_api.rb +263 -24
  20. data/lib/square/api/invoices_api.rb +19 -19
  21. data/lib/square/api/labor_api.rb +70 -68
  22. data/lib/square/api/locations_api.rb +22 -14
  23. data/lib/square/api/loyalty_api.rb +86 -32
  24. data/lib/square/api/merchants_api.rb +11 -9
  25. data/lib/square/api/mobile_authorization_api.rb +4 -4
  26. data/lib/square/api/o_auth_api.rb +31 -25
  27. data/lib/square/api/orders_api.rb +78 -39
  28. data/lib/square/api/payments_api.rb +71 -23
  29. data/lib/square/api/refunds_api.rb +18 -7
  30. data/lib/square/api/sites_api.rb +43 -0
  31. data/lib/square/api/snippets_api.rb +146 -0
  32. data/lib/square/api/subscriptions_api.rb +190 -12
  33. data/lib/square/api/team_api.rb +46 -46
  34. data/lib/square/api/terminal_api.rb +19 -18
  35. data/lib/square/api/transactions_api.rb +15 -191
  36. data/lib/square/api/v1_transactions_api.rb +13 -85
  37. data/lib/square/api/vendors_api.rb +257 -0
  38. data/lib/square/api_helper.rb +45 -57
  39. data/lib/square/client.rb +54 -18
  40. data/lib/square/configuration.rb +59 -20
  41. data/lib/square/http/api_response.rb +1 -1
  42. data/lib/square/http/faraday_client.rb +24 -4
  43. data/lib/square/utilities/date_time_helper.rb +151 -0
  44. data/lib/square/utilities/file_wrapper.rb +1 -2
  45. data/lib/square.rb +49 -44
  46. data/test/api/test_locations_api.rb +2 -5
  47. data/test/test_helper.rb +1 -1
  48. metadata +11 -6
  49. data/lib/square/api/v1_employees_api.rb +0 -749
  50. data/lib/square/api/v1_items_api.rb +0 -1766
@@ -1,1766 +0,0 @@
1
- module Square
2
- # V1ItemsApi
3
- class V1ItemsApi < BaseApi
4
- def initialize(config, http_call_back: nil)
5
- super(config, http_call_back: http_call_back)
6
- end
7
-
8
- # Lists all the item categories for a given location.
9
- # @param [String] location_id Required parameter: The ID of the location to
10
- # list categories for.
11
- # @return [List of V1Category Hash] response from the API call
12
- def list_categories(location_id:)
13
- warn 'Endpoint list_categories in V1ItemsApi is deprecated'
14
- # Prepare query url.
15
- _query_builder = config.get_base_uri
16
- _query_builder << '/v1/{location_id}/categories'
17
- _query_builder = APIHelper.append_url_with_template_parameters(
18
- _query_builder,
19
- 'location_id' => { 'value' => location_id, 'encode' => true }
20
- )
21
- _query_url = APIHelper.clean_url _query_builder
22
-
23
- # Prepare headers.
24
- _headers = {
25
- 'accept' => 'application/json'
26
- }
27
-
28
- # Prepare and execute HttpRequest.
29
- _request = config.http_client.get(
30
- _query_url,
31
- headers: _headers
32
- )
33
- OAuth2.apply(config, _request)
34
- _response = execute_request(_request)
35
-
36
- # Return appropriate response type.
37
- decoded = APIHelper.json_deserialize(_response.raw_body)
38
- _errors = APIHelper.map_response(decoded, ['errors'])
39
- ApiResponse.new(
40
- _response, data: decoded, errors: _errors
41
- )
42
- end
43
-
44
- # Creates an item category.
45
- # @param [String] location_id Required parameter: The ID of the location to
46
- # create an item for.
47
- # @param [V1Category] body Required parameter: An object containing the
48
- # fields to POST for the request. See the corresponding object definition
49
- # for field details.
50
- # @return [V1Category Hash] response from the API call
51
- def create_category(location_id:,
52
- body:)
53
- warn 'Endpoint create_category in V1ItemsApi is deprecated'
54
- # Prepare query url.
55
- _query_builder = config.get_base_uri
56
- _query_builder << '/v1/{location_id}/categories'
57
- _query_builder = APIHelper.append_url_with_template_parameters(
58
- _query_builder,
59
- 'location_id' => { 'value' => location_id, 'encode' => true }
60
- )
61
- _query_url = APIHelper.clean_url _query_builder
62
-
63
- # Prepare headers.
64
- _headers = {
65
- 'accept' => 'application/json',
66
- 'content-type' => 'application/json; charset=utf-8'
67
- }
68
-
69
- # Prepare and execute HttpRequest.
70
- _request = config.http_client.post(
71
- _query_url,
72
- headers: _headers,
73
- parameters: body.to_json
74
- )
75
- OAuth2.apply(config, _request)
76
- _response = execute_request(_request)
77
-
78
- # Return appropriate response type.
79
- decoded = APIHelper.json_deserialize(_response.raw_body)
80
- _errors = APIHelper.map_response(decoded, ['errors'])
81
- ApiResponse.new(
82
- _response, data: decoded, errors: _errors
83
- )
84
- end
85
-
86
- # Deletes an existing item category.
87
- # __DeleteCategory__ returns nothing on success but Connect SDKs
88
- # map the empty response to an empty `V1DeleteCategoryRequest` object
89
- # as documented below.
90
- # @param [String] location_id Required parameter: The ID of the item's
91
- # associated location.
92
- # @param [String] category_id Required parameter: The ID of the category to
93
- # delete.
94
- # @return [V1Category Hash] response from the API call
95
- def delete_category(location_id:,
96
- category_id:)
97
- warn 'Endpoint delete_category in V1ItemsApi is deprecated'
98
- # Prepare query url.
99
- _query_builder = config.get_base_uri
100
- _query_builder << '/v1/{location_id}/categories/{category_id}'
101
- _query_builder = APIHelper.append_url_with_template_parameters(
102
- _query_builder,
103
- 'location_id' => { 'value' => location_id, 'encode' => true },
104
- 'category_id' => { 'value' => category_id, 'encode' => true }
105
- )
106
- _query_url = APIHelper.clean_url _query_builder
107
-
108
- # Prepare headers.
109
- _headers = {
110
- 'accept' => 'application/json'
111
- }
112
-
113
- # Prepare and execute HttpRequest.
114
- _request = config.http_client.delete(
115
- _query_url,
116
- headers: _headers
117
- )
118
- OAuth2.apply(config, _request)
119
- _response = execute_request(_request)
120
-
121
- # Return appropriate response type.
122
- decoded = APIHelper.json_deserialize(_response.raw_body)
123
- _errors = APIHelper.map_response(decoded, ['errors'])
124
- ApiResponse.new(
125
- _response, data: decoded, errors: _errors
126
- )
127
- end
128
-
129
- # Modifies the details of an existing item category.
130
- # @param [String] location_id Required parameter: The ID of the category's
131
- # associated location.
132
- # @param [String] category_id Required parameter: The ID of the category to
133
- # edit.
134
- # @param [V1Category] body Required parameter: An object containing the
135
- # fields to POST for the request. See the corresponding object definition
136
- # for field details.
137
- # @return [V1Category Hash] response from the API call
138
- def update_category(location_id:,
139
- category_id:,
140
- body:)
141
- warn 'Endpoint update_category in V1ItemsApi is deprecated'
142
- # Prepare query url.
143
- _query_builder = config.get_base_uri
144
- _query_builder << '/v1/{location_id}/categories/{category_id}'
145
- _query_builder = APIHelper.append_url_with_template_parameters(
146
- _query_builder,
147
- 'location_id' => { 'value' => location_id, 'encode' => true },
148
- 'category_id' => { 'value' => category_id, 'encode' => true }
149
- )
150
- _query_url = APIHelper.clean_url _query_builder
151
-
152
- # Prepare headers.
153
- _headers = {
154
- 'accept' => 'application/json',
155
- 'content-type' => 'application/json; charset=utf-8'
156
- }
157
-
158
- # Prepare and execute HttpRequest.
159
- _request = config.http_client.put(
160
- _query_url,
161
- headers: _headers,
162
- parameters: body.to_json
163
- )
164
- OAuth2.apply(config, _request)
165
- _response = execute_request(_request)
166
-
167
- # Return appropriate response type.
168
- decoded = APIHelper.json_deserialize(_response.raw_body)
169
- _errors = APIHelper.map_response(decoded, ['errors'])
170
- ApiResponse.new(
171
- _response, data: decoded, errors: _errors
172
- )
173
- end
174
-
175
- # Lists all the discounts for a given location.
176
- # @param [String] location_id Required parameter: The ID of the location to
177
- # list categories for.
178
- # @return [List of V1Discount Hash] response from the API call
179
- def list_discounts(location_id:)
180
- warn 'Endpoint list_discounts in V1ItemsApi is deprecated'
181
- # Prepare query url.
182
- _query_builder = config.get_base_uri
183
- _query_builder << '/v1/{location_id}/discounts'
184
- _query_builder = APIHelper.append_url_with_template_parameters(
185
- _query_builder,
186
- 'location_id' => { 'value' => location_id, 'encode' => true }
187
- )
188
- _query_url = APIHelper.clean_url _query_builder
189
-
190
- # Prepare headers.
191
- _headers = {
192
- 'accept' => 'application/json'
193
- }
194
-
195
- # Prepare and execute HttpRequest.
196
- _request = config.http_client.get(
197
- _query_url,
198
- headers: _headers
199
- )
200
- OAuth2.apply(config, _request)
201
- _response = execute_request(_request)
202
-
203
- # Return appropriate response type.
204
- decoded = APIHelper.json_deserialize(_response.raw_body)
205
- _errors = APIHelper.map_response(decoded, ['errors'])
206
- ApiResponse.new(
207
- _response, data: decoded, errors: _errors
208
- )
209
- end
210
-
211
- # Creates a discount.
212
- # @param [String] location_id Required parameter: The ID of the location to
213
- # create an item for.
214
- # @param [V1Discount] body Required parameter: An object containing the
215
- # fields to POST for the request. See the corresponding object definition
216
- # for field details.
217
- # @return [V1Discount Hash] response from the API call
218
- def create_discount(location_id:,
219
- body:)
220
- warn 'Endpoint create_discount in V1ItemsApi is deprecated'
221
- # Prepare query url.
222
- _query_builder = config.get_base_uri
223
- _query_builder << '/v1/{location_id}/discounts'
224
- _query_builder = APIHelper.append_url_with_template_parameters(
225
- _query_builder,
226
- 'location_id' => { 'value' => location_id, 'encode' => true }
227
- )
228
- _query_url = APIHelper.clean_url _query_builder
229
-
230
- # Prepare headers.
231
- _headers = {
232
- 'accept' => 'application/json',
233
- 'content-type' => 'application/json; charset=utf-8'
234
- }
235
-
236
- # Prepare and execute HttpRequest.
237
- _request = config.http_client.post(
238
- _query_url,
239
- headers: _headers,
240
- parameters: body.to_json
241
- )
242
- OAuth2.apply(config, _request)
243
- _response = execute_request(_request)
244
-
245
- # Return appropriate response type.
246
- decoded = APIHelper.json_deserialize(_response.raw_body)
247
- _errors = APIHelper.map_response(decoded, ['errors'])
248
- ApiResponse.new(
249
- _response, data: decoded, errors: _errors
250
- )
251
- end
252
-
253
- # Deletes an existing discount.
254
- # __DeleteDiscount__ returns nothing on success but Connect SDKs
255
- # map the empty response to an empty `V1DeleteDiscountRequest` object
256
- # as documented below.
257
- # @param [String] location_id Required parameter: The ID of the item's
258
- # associated location.
259
- # @param [String] discount_id Required parameter: The ID of the discount to
260
- # delete.
261
- # @return [V1Discount Hash] response from the API call
262
- def delete_discount(location_id:,
263
- discount_id:)
264
- warn 'Endpoint delete_discount in V1ItemsApi is deprecated'
265
- # Prepare query url.
266
- _query_builder = config.get_base_uri
267
- _query_builder << '/v1/{location_id}/discounts/{discount_id}'
268
- _query_builder = APIHelper.append_url_with_template_parameters(
269
- _query_builder,
270
- 'location_id' => { 'value' => location_id, 'encode' => true },
271
- 'discount_id' => { 'value' => discount_id, 'encode' => true }
272
- )
273
- _query_url = APIHelper.clean_url _query_builder
274
-
275
- # Prepare headers.
276
- _headers = {
277
- 'accept' => 'application/json'
278
- }
279
-
280
- # Prepare and execute HttpRequest.
281
- _request = config.http_client.delete(
282
- _query_url,
283
- headers: _headers
284
- )
285
- OAuth2.apply(config, _request)
286
- _response = execute_request(_request)
287
-
288
- # Return appropriate response type.
289
- decoded = APIHelper.json_deserialize(_response.raw_body)
290
- _errors = APIHelper.map_response(decoded, ['errors'])
291
- ApiResponse.new(
292
- _response, data: decoded, errors: _errors
293
- )
294
- end
295
-
296
- # Modifies the details of an existing discount.
297
- # @param [String] location_id Required parameter: The ID of the category's
298
- # associated location.
299
- # @param [String] discount_id Required parameter: The ID of the discount to
300
- # edit.
301
- # @param [V1Discount] body Required parameter: An object containing the
302
- # fields to POST for the request. See the corresponding object definition
303
- # for field details.
304
- # @return [V1Discount Hash] response from the API call
305
- def update_discount(location_id:,
306
- discount_id:,
307
- body:)
308
- warn 'Endpoint update_discount in V1ItemsApi is deprecated'
309
- # Prepare query url.
310
- _query_builder = config.get_base_uri
311
- _query_builder << '/v1/{location_id}/discounts/{discount_id}'
312
- _query_builder = APIHelper.append_url_with_template_parameters(
313
- _query_builder,
314
- 'location_id' => { 'value' => location_id, 'encode' => true },
315
- 'discount_id' => { 'value' => discount_id, 'encode' => true }
316
- )
317
- _query_url = APIHelper.clean_url _query_builder
318
-
319
- # Prepare headers.
320
- _headers = {
321
- 'accept' => 'application/json',
322
- 'content-type' => 'application/json; charset=utf-8'
323
- }
324
-
325
- # Prepare and execute HttpRequest.
326
- _request = config.http_client.put(
327
- _query_url,
328
- headers: _headers,
329
- parameters: body.to_json
330
- )
331
- OAuth2.apply(config, _request)
332
- _response = execute_request(_request)
333
-
334
- # Return appropriate response type.
335
- decoded = APIHelper.json_deserialize(_response.raw_body)
336
- _errors = APIHelper.map_response(decoded, ['errors'])
337
- ApiResponse.new(
338
- _response, data: decoded, errors: _errors
339
- )
340
- end
341
-
342
- # Lists all the fees (taxes) for a given location.
343
- # @param [String] location_id Required parameter: The ID of the location to
344
- # list fees for.
345
- # @return [List of V1Fee Hash] response from the API call
346
- def list_fees(location_id:)
347
- warn 'Endpoint list_fees in V1ItemsApi is deprecated'
348
- # Prepare query url.
349
- _query_builder = config.get_base_uri
350
- _query_builder << '/v1/{location_id}/fees'
351
- _query_builder = APIHelper.append_url_with_template_parameters(
352
- _query_builder,
353
- 'location_id' => { 'value' => location_id, 'encode' => true }
354
- )
355
- _query_url = APIHelper.clean_url _query_builder
356
-
357
- # Prepare headers.
358
- _headers = {
359
- 'accept' => 'application/json'
360
- }
361
-
362
- # Prepare and execute HttpRequest.
363
- _request = config.http_client.get(
364
- _query_url,
365
- headers: _headers
366
- )
367
- OAuth2.apply(config, _request)
368
- _response = execute_request(_request)
369
-
370
- # Return appropriate response type.
371
- decoded = APIHelper.json_deserialize(_response.raw_body)
372
- _errors = APIHelper.map_response(decoded, ['errors'])
373
- ApiResponse.new(
374
- _response, data: decoded, errors: _errors
375
- )
376
- end
377
-
378
- # Creates a fee (tax).
379
- # @param [String] location_id Required parameter: The ID of the location to
380
- # create a fee for.
381
- # @param [V1Fee] body Required parameter: An object containing the fields to
382
- # POST for the request. See the corresponding object definition for field
383
- # details.
384
- # @return [V1Fee Hash] response from the API call
385
- def create_fee(location_id:,
386
- body:)
387
- warn 'Endpoint create_fee in V1ItemsApi is deprecated'
388
- # Prepare query url.
389
- _query_builder = config.get_base_uri
390
- _query_builder << '/v1/{location_id}/fees'
391
- _query_builder = APIHelper.append_url_with_template_parameters(
392
- _query_builder,
393
- 'location_id' => { 'value' => location_id, 'encode' => true }
394
- )
395
- _query_url = APIHelper.clean_url _query_builder
396
-
397
- # Prepare headers.
398
- _headers = {
399
- 'accept' => 'application/json',
400
- 'content-type' => 'application/json; charset=utf-8'
401
- }
402
-
403
- # Prepare and execute HttpRequest.
404
- _request = config.http_client.post(
405
- _query_url,
406
- headers: _headers,
407
- parameters: body.to_json
408
- )
409
- OAuth2.apply(config, _request)
410
- _response = execute_request(_request)
411
-
412
- # Return appropriate response type.
413
- decoded = APIHelper.json_deserialize(_response.raw_body)
414
- _errors = APIHelper.map_response(decoded, ['errors'])
415
- ApiResponse.new(
416
- _response, data: decoded, errors: _errors
417
- )
418
- end
419
-
420
- # Deletes an existing fee (tax).
421
- # __DeleteFee__ returns nothing on success but Connect SDKs
422
- # map the empty response to an empty `V1DeleteFeeRequest` object
423
- # as documented below.
424
- # @param [String] location_id Required parameter: The ID of the fee's
425
- # associated location.
426
- # @param [String] fee_id Required parameter: The ID of the fee to delete.
427
- # @return [V1Fee Hash] response from the API call
428
- def delete_fee(location_id:,
429
- fee_id:)
430
- warn 'Endpoint delete_fee in V1ItemsApi is deprecated'
431
- # Prepare query url.
432
- _query_builder = config.get_base_uri
433
- _query_builder << '/v1/{location_id}/fees/{fee_id}'
434
- _query_builder = APIHelper.append_url_with_template_parameters(
435
- _query_builder,
436
- 'location_id' => { 'value' => location_id, 'encode' => true },
437
- 'fee_id' => { 'value' => fee_id, 'encode' => true }
438
- )
439
- _query_url = APIHelper.clean_url _query_builder
440
-
441
- # Prepare headers.
442
- _headers = {
443
- 'accept' => 'application/json'
444
- }
445
-
446
- # Prepare and execute HttpRequest.
447
- _request = config.http_client.delete(
448
- _query_url,
449
- headers: _headers
450
- )
451
- OAuth2.apply(config, _request)
452
- _response = execute_request(_request)
453
-
454
- # Return appropriate response type.
455
- decoded = APIHelper.json_deserialize(_response.raw_body)
456
- _errors = APIHelper.map_response(decoded, ['errors'])
457
- ApiResponse.new(
458
- _response, data: decoded, errors: _errors
459
- )
460
- end
461
-
462
- # Modifies the details of an existing fee (tax).
463
- # @param [String] location_id Required parameter: The ID of the fee's
464
- # associated location.
465
- # @param [String] fee_id Required parameter: The ID of the fee to edit.
466
- # @param [V1Fee] body Required parameter: An object containing the fields to
467
- # POST for the request. See the corresponding object definition for field
468
- # details.
469
- # @return [V1Fee Hash] response from the API call
470
- def update_fee(location_id:,
471
- fee_id:,
472
- body:)
473
- warn 'Endpoint update_fee in V1ItemsApi is deprecated'
474
- # Prepare query url.
475
- _query_builder = config.get_base_uri
476
- _query_builder << '/v1/{location_id}/fees/{fee_id}'
477
- _query_builder = APIHelper.append_url_with_template_parameters(
478
- _query_builder,
479
- 'location_id' => { 'value' => location_id, 'encode' => true },
480
- 'fee_id' => { 'value' => fee_id, 'encode' => true }
481
- )
482
- _query_url = APIHelper.clean_url _query_builder
483
-
484
- # Prepare headers.
485
- _headers = {
486
- 'accept' => 'application/json',
487
- 'content-type' => 'application/json; charset=utf-8'
488
- }
489
-
490
- # Prepare and execute HttpRequest.
491
- _request = config.http_client.put(
492
- _query_url,
493
- headers: _headers,
494
- parameters: body.to_json
495
- )
496
- OAuth2.apply(config, _request)
497
- _response = execute_request(_request)
498
-
499
- # Return appropriate response type.
500
- decoded = APIHelper.json_deserialize(_response.raw_body)
501
- _errors = APIHelper.map_response(decoded, ['errors'])
502
- ApiResponse.new(
503
- _response, data: decoded, errors: _errors
504
- )
505
- end
506
-
507
- # Provides inventory information for all inventory-enabled item
508
- # variations.
509
- # @param [String] location_id Required parameter: The ID of the item's
510
- # associated location.
511
- # @param [Integer] limit Optional parameter: The maximum number of inventory
512
- # entries to return in a single response. This value cannot exceed 1000.
513
- # @param [String] batch_token Optional parameter: A pagination cursor to
514
- # retrieve the next set of results for your original query to the
515
- # endpoint.
516
- # @return [List of V1InventoryEntry Hash] response from the API call
517
- def list_inventory(location_id:,
518
- limit: nil,
519
- batch_token: nil)
520
- warn 'Endpoint list_inventory in V1ItemsApi is deprecated'
521
- # Prepare query url.
522
- _query_builder = config.get_base_uri
523
- _query_builder << '/v1/{location_id}/inventory'
524
- _query_builder = APIHelper.append_url_with_template_parameters(
525
- _query_builder,
526
- 'location_id' => { 'value' => location_id, 'encode' => true }
527
- )
528
- _query_builder = APIHelper.append_url_with_query_parameters(
529
- _query_builder,
530
- 'limit' => limit,
531
- 'batch_token' => batch_token
532
- )
533
- _query_url = APIHelper.clean_url _query_builder
534
-
535
- # Prepare headers.
536
- _headers = {
537
- 'accept' => 'application/json'
538
- }
539
-
540
- # Prepare and execute HttpRequest.
541
- _request = config.http_client.get(
542
- _query_url,
543
- headers: _headers
544
- )
545
- OAuth2.apply(config, _request)
546
- _response = execute_request(_request)
547
-
548
- # Return appropriate response type.
549
- decoded = APIHelper.json_deserialize(_response.raw_body)
550
- _errors = APIHelper.map_response(decoded, ['errors'])
551
- ApiResponse.new(
552
- _response, data: decoded, errors: _errors
553
- )
554
- end
555
-
556
- # Adjusts the current available inventory of an item variation.
557
- # @param [String] location_id Required parameter: The ID of the item's
558
- # associated location.
559
- # @param [String] variation_id Required parameter: The ID of the variation
560
- # to adjust inventory information for.
561
- # @param [V1AdjustInventoryRequest] body Required parameter: An object
562
- # containing the fields to POST for the request. See the corresponding
563
- # object definition for field details.
564
- # @return [V1InventoryEntry Hash] response from the API call
565
- def adjust_inventory(location_id:,
566
- variation_id:,
567
- body:)
568
- warn 'Endpoint adjust_inventory in V1ItemsApi is deprecated'
569
- # Prepare query url.
570
- _query_builder = config.get_base_uri
571
- _query_builder << '/v1/{location_id}/inventory/{variation_id}'
572
- _query_builder = APIHelper.append_url_with_template_parameters(
573
- _query_builder,
574
- 'location_id' => { 'value' => location_id, 'encode' => true },
575
- 'variation_id' => { 'value' => variation_id, 'encode' => true }
576
- )
577
- _query_url = APIHelper.clean_url _query_builder
578
-
579
- # Prepare headers.
580
- _headers = {
581
- 'accept' => 'application/json',
582
- 'content-type' => 'application/json; charset=utf-8'
583
- }
584
-
585
- # Prepare and execute HttpRequest.
586
- _request = config.http_client.post(
587
- _query_url,
588
- headers: _headers,
589
- parameters: body.to_json
590
- )
591
- OAuth2.apply(config, _request)
592
- _response = execute_request(_request)
593
-
594
- # Return appropriate response type.
595
- decoded = APIHelper.json_deserialize(_response.raw_body)
596
- _errors = APIHelper.map_response(decoded, ['errors'])
597
- ApiResponse.new(
598
- _response, data: decoded, errors: _errors
599
- )
600
- end
601
-
602
- # Provides summary information of all items for a given location.
603
- # @param [String] location_id Required parameter: The ID of the location to
604
- # list items for.
605
- # @param [String] batch_token Optional parameter: A pagination cursor to
606
- # retrieve the next set of results for your original query to the
607
- # endpoint.
608
- # @return [List of V1Item Hash] response from the API call
609
- def list_items(location_id:,
610
- batch_token: nil)
611
- warn 'Endpoint list_items in V1ItemsApi is deprecated'
612
- # Prepare query url.
613
- _query_builder = config.get_base_uri
614
- _query_builder << '/v1/{location_id}/items'
615
- _query_builder = APIHelper.append_url_with_template_parameters(
616
- _query_builder,
617
- 'location_id' => { 'value' => location_id, 'encode' => true }
618
- )
619
- _query_builder = APIHelper.append_url_with_query_parameters(
620
- _query_builder,
621
- 'batch_token' => batch_token
622
- )
623
- _query_url = APIHelper.clean_url _query_builder
624
-
625
- # Prepare headers.
626
- _headers = {
627
- 'accept' => 'application/json'
628
- }
629
-
630
- # Prepare and execute HttpRequest.
631
- _request = config.http_client.get(
632
- _query_url,
633
- headers: _headers
634
- )
635
- OAuth2.apply(config, _request)
636
- _response = execute_request(_request)
637
-
638
- # Return appropriate response type.
639
- decoded = APIHelper.json_deserialize(_response.raw_body)
640
- _errors = APIHelper.map_response(decoded, ['errors'])
641
- ApiResponse.new(
642
- _response, data: decoded, errors: _errors
643
- )
644
- end
645
-
646
- # Creates an item and at least one variation for it.
647
- # Item-related entities include fields you can use to associate them with
648
- # entities in a non-Square system.
649
- # When you create an item-related entity, you can optionally specify `id`.
650
- # This value must be unique among all IDs ever specified for the account,
651
- # including those specified by other applications. You can never reuse an
652
- # entity ID. If you do not specify an ID, Square generates one for the
653
- # entity.
654
- # Item variations have a `user_data` string that lets you associate
655
- # arbitrary
656
- # metadata with the variation. The string cannot exceed 255 characters.
657
- # @param [String] location_id Required parameter: The ID of the location to
658
- # create an item for.
659
- # @param [V1Item] body Required parameter: An object containing the fields
660
- # to POST for the request. See the corresponding object definition for
661
- # field details.
662
- # @return [V1Item Hash] response from the API call
663
- def create_item(location_id:,
664
- body:)
665
- warn 'Endpoint create_item in V1ItemsApi is deprecated'
666
- # Prepare query url.
667
- _query_builder = config.get_base_uri
668
- _query_builder << '/v1/{location_id}/items'
669
- _query_builder = APIHelper.append_url_with_template_parameters(
670
- _query_builder,
671
- 'location_id' => { 'value' => location_id, 'encode' => true }
672
- )
673
- _query_url = APIHelper.clean_url _query_builder
674
-
675
- # Prepare headers.
676
- _headers = {
677
- 'accept' => 'application/json',
678
- 'content-type' => 'application/json; charset=utf-8'
679
- }
680
-
681
- # Prepare and execute HttpRequest.
682
- _request = config.http_client.post(
683
- _query_url,
684
- headers: _headers,
685
- parameters: body.to_json
686
- )
687
- OAuth2.apply(config, _request)
688
- _response = execute_request(_request)
689
-
690
- # Return appropriate response type.
691
- decoded = APIHelper.json_deserialize(_response.raw_body)
692
- _errors = APIHelper.map_response(decoded, ['errors'])
693
- ApiResponse.new(
694
- _response, data: decoded, errors: _errors
695
- )
696
- end
697
-
698
- # Deletes an existing item and all item variations associated with it.
699
- # __DeleteItem__ returns nothing on success but Connect SDKs
700
- # map the empty response to an empty `V1DeleteItemRequest` object
701
- # as documented below.
702
- # @param [String] location_id Required parameter: The ID of the item's
703
- # associated location.
704
- # @param [String] item_id Required parameter: The ID of the item to
705
- # modify.
706
- # @return [V1Item Hash] response from the API call
707
- def delete_item(location_id:,
708
- item_id:)
709
- warn 'Endpoint delete_item in V1ItemsApi is deprecated'
710
- # Prepare query url.
711
- _query_builder = config.get_base_uri
712
- _query_builder << '/v1/{location_id}/items/{item_id}'
713
- _query_builder = APIHelper.append_url_with_template_parameters(
714
- _query_builder,
715
- 'location_id' => { 'value' => location_id, 'encode' => true },
716
- 'item_id' => { 'value' => item_id, 'encode' => true }
717
- )
718
- _query_url = APIHelper.clean_url _query_builder
719
-
720
- # Prepare headers.
721
- _headers = {
722
- 'accept' => 'application/json'
723
- }
724
-
725
- # Prepare and execute HttpRequest.
726
- _request = config.http_client.delete(
727
- _query_url,
728
- headers: _headers
729
- )
730
- OAuth2.apply(config, _request)
731
- _response = execute_request(_request)
732
-
733
- # Return appropriate response type.
734
- decoded = APIHelper.json_deserialize(_response.raw_body)
735
- _errors = APIHelper.map_response(decoded, ['errors'])
736
- ApiResponse.new(
737
- _response, data: decoded, errors: _errors
738
- )
739
- end
740
-
741
- # Provides the details for a single item, including associated modifier
742
- # lists and fees.
743
- # @param [String] location_id Required parameter: The ID of the item's
744
- # associated location.
745
- # @param [String] item_id Required parameter: The item's ID.
746
- # @return [V1Item Hash] response from the API call
747
- def retrieve_item(location_id:,
748
- item_id:)
749
- warn 'Endpoint retrieve_item in V1ItemsApi is deprecated'
750
- # Prepare query url.
751
- _query_builder = config.get_base_uri
752
- _query_builder << '/v1/{location_id}/items/{item_id}'
753
- _query_builder = APIHelper.append_url_with_template_parameters(
754
- _query_builder,
755
- 'location_id' => { 'value' => location_id, 'encode' => true },
756
- 'item_id' => { 'value' => item_id, 'encode' => true }
757
- )
758
- _query_url = APIHelper.clean_url _query_builder
759
-
760
- # Prepare headers.
761
- _headers = {
762
- 'accept' => 'application/json'
763
- }
764
-
765
- # Prepare and execute HttpRequest.
766
- _request = config.http_client.get(
767
- _query_url,
768
- headers: _headers
769
- )
770
- OAuth2.apply(config, _request)
771
- _response = execute_request(_request)
772
-
773
- # Return appropriate response type.
774
- decoded = APIHelper.json_deserialize(_response.raw_body)
775
- _errors = APIHelper.map_response(decoded, ['errors'])
776
- ApiResponse.new(
777
- _response, data: decoded, errors: _errors
778
- )
779
- end
780
-
781
- # Modifies the core details of an existing item.
782
- # @param [String] location_id Required parameter: The ID of the item's
783
- # associated location.
784
- # @param [String] item_id Required parameter: The ID of the item to
785
- # modify.
786
- # @param [V1Item] body Required parameter: An object containing the fields
787
- # to POST for the request. See the corresponding object definition for
788
- # field details.
789
- # @return [V1Item Hash] response from the API call
790
- def update_item(location_id:,
791
- item_id:,
792
- body:)
793
- warn 'Endpoint update_item in V1ItemsApi is deprecated'
794
- # Prepare query url.
795
- _query_builder = config.get_base_uri
796
- _query_builder << '/v1/{location_id}/items/{item_id}'
797
- _query_builder = APIHelper.append_url_with_template_parameters(
798
- _query_builder,
799
- 'location_id' => { 'value' => location_id, 'encode' => true },
800
- 'item_id' => { 'value' => item_id, 'encode' => true }
801
- )
802
- _query_url = APIHelper.clean_url _query_builder
803
-
804
- # Prepare headers.
805
- _headers = {
806
- 'accept' => 'application/json',
807
- 'content-type' => 'application/json; charset=utf-8'
808
- }
809
-
810
- # Prepare and execute HttpRequest.
811
- _request = config.http_client.put(
812
- _query_url,
813
- headers: _headers,
814
- parameters: body.to_json
815
- )
816
- OAuth2.apply(config, _request)
817
- _response = execute_request(_request)
818
-
819
- # Return appropriate response type.
820
- decoded = APIHelper.json_deserialize(_response.raw_body)
821
- _errors = APIHelper.map_response(decoded, ['errors'])
822
- ApiResponse.new(
823
- _response, data: decoded, errors: _errors
824
- )
825
- end
826
-
827
- # Removes a fee assocation from an item so the fee is no longer
828
- # automatically applied to the item in Square Point of Sale.
829
- # @param [String] location_id Required parameter: The ID of the fee's
830
- # associated location.
831
- # @param [String] item_id Required parameter: The ID of the item to add the
832
- # fee to.
833
- # @param [String] fee_id Required parameter: The ID of the fee to apply.
834
- # @return [V1Item Hash] response from the API call
835
- def remove_fee(location_id:,
836
- item_id:,
837
- fee_id:)
838
- warn 'Endpoint remove_fee in V1ItemsApi is deprecated'
839
- # Prepare query url.
840
- _query_builder = config.get_base_uri
841
- _query_builder << '/v1/{location_id}/items/{item_id}/fees/{fee_id}'
842
- _query_builder = APIHelper.append_url_with_template_parameters(
843
- _query_builder,
844
- 'location_id' => { 'value' => location_id, 'encode' => true },
845
- 'item_id' => { 'value' => item_id, 'encode' => true },
846
- 'fee_id' => { 'value' => fee_id, 'encode' => true }
847
- )
848
- _query_url = APIHelper.clean_url _query_builder
849
-
850
- # Prepare headers.
851
- _headers = {
852
- 'accept' => 'application/json'
853
- }
854
-
855
- # Prepare and execute HttpRequest.
856
- _request = config.http_client.delete(
857
- _query_url,
858
- headers: _headers
859
- )
860
- OAuth2.apply(config, _request)
861
- _response = execute_request(_request)
862
-
863
- # Return appropriate response type.
864
- decoded = APIHelper.json_deserialize(_response.raw_body)
865
- _errors = APIHelper.map_response(decoded, ['errors'])
866
- ApiResponse.new(
867
- _response, data: decoded, errors: _errors
868
- )
869
- end
870
-
871
- # Associates a fee with an item so the fee is automatically applied to
872
- # the item in Square Point of Sale.
873
- # @param [String] location_id Required parameter: The ID of the fee's
874
- # associated location.
875
- # @param [String] item_id Required parameter: The ID of the item to add the
876
- # fee to.
877
- # @param [String] fee_id Required parameter: The ID of the fee to apply.
878
- # @return [V1Item Hash] response from the API call
879
- def apply_fee(location_id:,
880
- item_id:,
881
- fee_id:)
882
- warn 'Endpoint apply_fee in V1ItemsApi is deprecated'
883
- # Prepare query url.
884
- _query_builder = config.get_base_uri
885
- _query_builder << '/v1/{location_id}/items/{item_id}/fees/{fee_id}'
886
- _query_builder = APIHelper.append_url_with_template_parameters(
887
- _query_builder,
888
- 'location_id' => { 'value' => location_id, 'encode' => true },
889
- 'item_id' => { 'value' => item_id, 'encode' => true },
890
- 'fee_id' => { 'value' => fee_id, 'encode' => true }
891
- )
892
- _query_url = APIHelper.clean_url _query_builder
893
-
894
- # Prepare headers.
895
- _headers = {
896
- 'accept' => 'application/json'
897
- }
898
-
899
- # Prepare and execute HttpRequest.
900
- _request = config.http_client.put(
901
- _query_url,
902
- headers: _headers
903
- )
904
- OAuth2.apply(config, _request)
905
- _response = execute_request(_request)
906
-
907
- # Return appropriate response type.
908
- decoded = APIHelper.json_deserialize(_response.raw_body)
909
- _errors = APIHelper.map_response(decoded, ['errors'])
910
- ApiResponse.new(
911
- _response, data: decoded, errors: _errors
912
- )
913
- end
914
-
915
- # Removes a modifier list association from an item so the modifier
916
- # options from the list can no longer be applied to the item.
917
- # @param [String] location_id Required parameter: The ID of the item's
918
- # associated location.
919
- # @param [String] modifier_list_id Required parameter: The ID of the
920
- # modifier list to remove.
921
- # @param [String] item_id Required parameter: The ID of the item to remove
922
- # the modifier list from.
923
- # @return [V1Item Hash] response from the API call
924
- def remove_modifier_list(location_id:,
925
- modifier_list_id:,
926
- item_id:)
927
- warn 'Endpoint remove_modifier_list in V1ItemsApi is deprecated'
928
- # Prepare query url.
929
- _query_builder = config.get_base_uri
930
- _query_builder << '/v1/{location_id}/items/{item_id}/modifier-lists/{modifier_list_id}'
931
- _query_builder = APIHelper.append_url_with_template_parameters(
932
- _query_builder,
933
- 'location_id' => { 'value' => location_id, 'encode' => true },
934
- 'modifier_list_id' => { 'value' => modifier_list_id, 'encode' => true },
935
- 'item_id' => { 'value' => item_id, 'encode' => true }
936
- )
937
- _query_url = APIHelper.clean_url _query_builder
938
-
939
- # Prepare headers.
940
- _headers = {
941
- 'accept' => 'application/json'
942
- }
943
-
944
- # Prepare and execute HttpRequest.
945
- _request = config.http_client.delete(
946
- _query_url,
947
- headers: _headers
948
- )
949
- OAuth2.apply(config, _request)
950
- _response = execute_request(_request)
951
-
952
- # Return appropriate response type.
953
- decoded = APIHelper.json_deserialize(_response.raw_body)
954
- _errors = APIHelper.map_response(decoded, ['errors'])
955
- ApiResponse.new(
956
- _response, data: decoded, errors: _errors
957
- )
958
- end
959
-
960
- # Associates a modifier list with an item so the associated modifier
961
- # options can be applied to the item.
962
- # @param [String] location_id Required parameter: The ID of the item's
963
- # associated location.
964
- # @param [String] modifier_list_id Required parameter: The ID of the
965
- # modifier list to apply.
966
- # @param [String] item_id Required parameter: The ID of the item to add the
967
- # modifier list to.
968
- # @return [V1Item Hash] response from the API call
969
- def apply_modifier_list(location_id:,
970
- modifier_list_id:,
971
- item_id:)
972
- warn 'Endpoint apply_modifier_list in V1ItemsApi is deprecated'
973
- # Prepare query url.
974
- _query_builder = config.get_base_uri
975
- _query_builder << '/v1/{location_id}/items/{item_id}/modifier-lists/{modifier_list_id}'
976
- _query_builder = APIHelper.append_url_with_template_parameters(
977
- _query_builder,
978
- 'location_id' => { 'value' => location_id, 'encode' => true },
979
- 'modifier_list_id' => { 'value' => modifier_list_id, 'encode' => true },
980
- 'item_id' => { 'value' => item_id, 'encode' => true }
981
- )
982
- _query_url = APIHelper.clean_url _query_builder
983
-
984
- # Prepare headers.
985
- _headers = {
986
- 'accept' => 'application/json'
987
- }
988
-
989
- # Prepare and execute HttpRequest.
990
- _request = config.http_client.put(
991
- _query_url,
992
- headers: _headers
993
- )
994
- OAuth2.apply(config, _request)
995
- _response = execute_request(_request)
996
-
997
- # Return appropriate response type.
998
- decoded = APIHelper.json_deserialize(_response.raw_body)
999
- _errors = APIHelper.map_response(decoded, ['errors'])
1000
- ApiResponse.new(
1001
- _response, data: decoded, errors: _errors
1002
- )
1003
- end
1004
-
1005
- # Creates an item variation for an existing item.
1006
- # @param [String] location_id Required parameter: The ID of the item's
1007
- # associated location.
1008
- # @param [String] item_id Required parameter: The item's ID.
1009
- # @param [V1Variation] body Required parameter: An object containing the
1010
- # fields to POST for the request. See the corresponding object definition
1011
- # for field details.
1012
- # @return [V1Variation Hash] response from the API call
1013
- def create_variation(location_id:,
1014
- item_id:,
1015
- body:)
1016
- warn 'Endpoint create_variation in V1ItemsApi is deprecated'
1017
- # Prepare query url.
1018
- _query_builder = config.get_base_uri
1019
- _query_builder << '/v1/{location_id}/items/{item_id}/variations'
1020
- _query_builder = APIHelper.append_url_with_template_parameters(
1021
- _query_builder,
1022
- 'location_id' => { 'value' => location_id, 'encode' => true },
1023
- 'item_id' => { 'value' => item_id, 'encode' => true }
1024
- )
1025
- _query_url = APIHelper.clean_url _query_builder
1026
-
1027
- # Prepare headers.
1028
- _headers = {
1029
- 'accept' => 'application/json',
1030
- 'content-type' => 'application/json; charset=utf-8'
1031
- }
1032
-
1033
- # Prepare and execute HttpRequest.
1034
- _request = config.http_client.post(
1035
- _query_url,
1036
- headers: _headers,
1037
- parameters: body.to_json
1038
- )
1039
- OAuth2.apply(config, _request)
1040
- _response = execute_request(_request)
1041
-
1042
- # Return appropriate response type.
1043
- decoded = APIHelper.json_deserialize(_response.raw_body)
1044
- _errors = APIHelper.map_response(decoded, ['errors'])
1045
- ApiResponse.new(
1046
- _response, data: decoded, errors: _errors
1047
- )
1048
- end
1049
-
1050
- # Deletes an existing item variation from an item.
1051
- # __DeleteVariation__ returns nothing on success but Connect SDKs
1052
- # map the empty response to an empty `V1DeleteVariationRequest` object
1053
- # as documented below.
1054
- # @param [String] location_id Required parameter: The ID of the item's
1055
- # associated location.
1056
- # @param [String] item_id Required parameter: The ID of the item to
1057
- # delete.
1058
- # @param [String] variation_id Required parameter: The ID of the variation
1059
- # to delete.
1060
- # @return [V1Variation Hash] response from the API call
1061
- def delete_variation(location_id:,
1062
- item_id:,
1063
- variation_id:)
1064
- warn 'Endpoint delete_variation in V1ItemsApi is deprecated'
1065
- # Prepare query url.
1066
- _query_builder = config.get_base_uri
1067
- _query_builder << '/v1/{location_id}/items/{item_id}/variations/{variation_id}'
1068
- _query_builder = APIHelper.append_url_with_template_parameters(
1069
- _query_builder,
1070
- 'location_id' => { 'value' => location_id, 'encode' => true },
1071
- 'item_id' => { 'value' => item_id, 'encode' => true },
1072
- 'variation_id' => { 'value' => variation_id, 'encode' => true }
1073
- )
1074
- _query_url = APIHelper.clean_url _query_builder
1075
-
1076
- # Prepare headers.
1077
- _headers = {
1078
- 'accept' => 'application/json'
1079
- }
1080
-
1081
- # Prepare and execute HttpRequest.
1082
- _request = config.http_client.delete(
1083
- _query_url,
1084
- headers: _headers
1085
- )
1086
- OAuth2.apply(config, _request)
1087
- _response = execute_request(_request)
1088
-
1089
- # Return appropriate response type.
1090
- decoded = APIHelper.json_deserialize(_response.raw_body)
1091
- _errors = APIHelper.map_response(decoded, ['errors'])
1092
- ApiResponse.new(
1093
- _response, data: decoded, errors: _errors
1094
- )
1095
- end
1096
-
1097
- # Modifies the details of an existing item variation.
1098
- # @param [String] location_id Required parameter: The ID of the item's
1099
- # associated location.
1100
- # @param [String] item_id Required parameter: The ID of the item to
1101
- # modify.
1102
- # @param [String] variation_id Required parameter: The ID of the variation
1103
- # to modify.
1104
- # @param [V1Variation] body Required parameter: An object containing the
1105
- # fields to POST for the request. See the corresponding object definition
1106
- # for field details.
1107
- # @return [V1Variation Hash] response from the API call
1108
- def update_variation(location_id:,
1109
- item_id:,
1110
- variation_id:,
1111
- body:)
1112
- warn 'Endpoint update_variation in V1ItemsApi is deprecated'
1113
- # Prepare query url.
1114
- _query_builder = config.get_base_uri
1115
- _query_builder << '/v1/{location_id}/items/{item_id}/variations/{variation_id}'
1116
- _query_builder = APIHelper.append_url_with_template_parameters(
1117
- _query_builder,
1118
- 'location_id' => { 'value' => location_id, 'encode' => true },
1119
- 'item_id' => { 'value' => item_id, 'encode' => true },
1120
- 'variation_id' => { 'value' => variation_id, 'encode' => true }
1121
- )
1122
- _query_url = APIHelper.clean_url _query_builder
1123
-
1124
- # Prepare headers.
1125
- _headers = {
1126
- 'accept' => 'application/json',
1127
- 'content-type' => 'application/json; charset=utf-8'
1128
- }
1129
-
1130
- # Prepare and execute HttpRequest.
1131
- _request = config.http_client.put(
1132
- _query_url,
1133
- headers: _headers,
1134
- parameters: body.to_json
1135
- )
1136
- OAuth2.apply(config, _request)
1137
- _response = execute_request(_request)
1138
-
1139
- # Return appropriate response type.
1140
- decoded = APIHelper.json_deserialize(_response.raw_body)
1141
- _errors = APIHelper.map_response(decoded, ['errors'])
1142
- ApiResponse.new(
1143
- _response, data: decoded, errors: _errors
1144
- )
1145
- end
1146
-
1147
- # Lists all the modifier lists for a given location.
1148
- # @param [String] location_id Required parameter: The ID of the location to
1149
- # list modifier lists for.
1150
- # @return [List of V1ModifierList Hash] response from the API call
1151
- def list_modifier_lists(location_id:)
1152
- warn 'Endpoint list_modifier_lists in V1ItemsApi is deprecated'
1153
- # Prepare query url.
1154
- _query_builder = config.get_base_uri
1155
- _query_builder << '/v1/{location_id}/modifier-lists'
1156
- _query_builder = APIHelper.append_url_with_template_parameters(
1157
- _query_builder,
1158
- 'location_id' => { 'value' => location_id, 'encode' => true }
1159
- )
1160
- _query_url = APIHelper.clean_url _query_builder
1161
-
1162
- # Prepare headers.
1163
- _headers = {
1164
- 'accept' => 'application/json'
1165
- }
1166
-
1167
- # Prepare and execute HttpRequest.
1168
- _request = config.http_client.get(
1169
- _query_url,
1170
- headers: _headers
1171
- )
1172
- OAuth2.apply(config, _request)
1173
- _response = execute_request(_request)
1174
-
1175
- # Return appropriate response type.
1176
- decoded = APIHelper.json_deserialize(_response.raw_body)
1177
- _errors = APIHelper.map_response(decoded, ['errors'])
1178
- ApiResponse.new(
1179
- _response, data: decoded, errors: _errors
1180
- )
1181
- end
1182
-
1183
- # Creates an item modifier list and at least 1 modifier option for it.
1184
- # @param [String] location_id Required parameter: The ID of the location to
1185
- # create a modifier list for.
1186
- # @param [V1ModifierList] body Required parameter: An object containing the
1187
- # fields to POST for the request. See the corresponding object definition
1188
- # for field details.
1189
- # @return [V1ModifierList Hash] response from the API call
1190
- def create_modifier_list(location_id:,
1191
- body:)
1192
- warn 'Endpoint create_modifier_list in V1ItemsApi is deprecated'
1193
- # Prepare query url.
1194
- _query_builder = config.get_base_uri
1195
- _query_builder << '/v1/{location_id}/modifier-lists'
1196
- _query_builder = APIHelper.append_url_with_template_parameters(
1197
- _query_builder,
1198
- 'location_id' => { 'value' => location_id, 'encode' => true }
1199
- )
1200
- _query_url = APIHelper.clean_url _query_builder
1201
-
1202
- # Prepare headers.
1203
- _headers = {
1204
- 'accept' => 'application/json',
1205
- 'content-type' => 'application/json; charset=utf-8'
1206
- }
1207
-
1208
- # Prepare and execute HttpRequest.
1209
- _request = config.http_client.post(
1210
- _query_url,
1211
- headers: _headers,
1212
- parameters: body.to_json
1213
- )
1214
- OAuth2.apply(config, _request)
1215
- _response = execute_request(_request)
1216
-
1217
- # Return appropriate response type.
1218
- decoded = APIHelper.json_deserialize(_response.raw_body)
1219
- _errors = APIHelper.map_response(decoded, ['errors'])
1220
- ApiResponse.new(
1221
- _response, data: decoded, errors: _errors
1222
- )
1223
- end
1224
-
1225
- # Deletes an existing item modifier list and all modifier options
1226
- # associated with it.
1227
- # __DeleteModifierList__ returns nothing on success but Connect SDKs
1228
- # map the empty response to an empty `V1DeleteModifierListRequest` object
1229
- # as documented below.
1230
- # @param [String] location_id Required parameter: The ID of the item's
1231
- # associated location.
1232
- # @param [String] modifier_list_id Required parameter: The ID of the
1233
- # modifier list to delete.
1234
- # @return [V1ModifierList Hash] response from the API call
1235
- def delete_modifier_list(location_id:,
1236
- modifier_list_id:)
1237
- warn 'Endpoint delete_modifier_list in V1ItemsApi is deprecated'
1238
- # Prepare query url.
1239
- _query_builder = config.get_base_uri
1240
- _query_builder << '/v1/{location_id}/modifier-lists/{modifier_list_id}'
1241
- _query_builder = APIHelper.append_url_with_template_parameters(
1242
- _query_builder,
1243
- 'location_id' => { 'value' => location_id, 'encode' => true },
1244
- 'modifier_list_id' => { 'value' => modifier_list_id, 'encode' => true }
1245
- )
1246
- _query_url = APIHelper.clean_url _query_builder
1247
-
1248
- # Prepare headers.
1249
- _headers = {
1250
- 'accept' => 'application/json'
1251
- }
1252
-
1253
- # Prepare and execute HttpRequest.
1254
- _request = config.http_client.delete(
1255
- _query_url,
1256
- headers: _headers
1257
- )
1258
- OAuth2.apply(config, _request)
1259
- _response = execute_request(_request)
1260
-
1261
- # Return appropriate response type.
1262
- decoded = APIHelper.json_deserialize(_response.raw_body)
1263
- _errors = APIHelper.map_response(decoded, ['errors'])
1264
- ApiResponse.new(
1265
- _response, data: decoded, errors: _errors
1266
- )
1267
- end
1268
-
1269
- # Provides the details for a single modifier list.
1270
- # @param [String] location_id Required parameter: The ID of the item's
1271
- # associated location.
1272
- # @param [String] modifier_list_id Required parameter: The modifier list's
1273
- # ID.
1274
- # @return [V1ModifierList Hash] response from the API call
1275
- def retrieve_modifier_list(location_id:,
1276
- modifier_list_id:)
1277
- warn 'Endpoint retrieve_modifier_list in V1ItemsApi is deprecated'
1278
- # Prepare query url.
1279
- _query_builder = config.get_base_uri
1280
- _query_builder << '/v1/{location_id}/modifier-lists/{modifier_list_id}'
1281
- _query_builder = APIHelper.append_url_with_template_parameters(
1282
- _query_builder,
1283
- 'location_id' => { 'value' => location_id, 'encode' => true },
1284
- 'modifier_list_id' => { 'value' => modifier_list_id, 'encode' => true }
1285
- )
1286
- _query_url = APIHelper.clean_url _query_builder
1287
-
1288
- # Prepare headers.
1289
- _headers = {
1290
- 'accept' => 'application/json'
1291
- }
1292
-
1293
- # Prepare and execute HttpRequest.
1294
- _request = config.http_client.get(
1295
- _query_url,
1296
- headers: _headers
1297
- )
1298
- OAuth2.apply(config, _request)
1299
- _response = execute_request(_request)
1300
-
1301
- # Return appropriate response type.
1302
- decoded = APIHelper.json_deserialize(_response.raw_body)
1303
- _errors = APIHelper.map_response(decoded, ['errors'])
1304
- ApiResponse.new(
1305
- _response, data: decoded, errors: _errors
1306
- )
1307
- end
1308
-
1309
- # Modifies the details of an existing item modifier list.
1310
- # @param [String] location_id Required parameter: The ID of the item's
1311
- # associated location.
1312
- # @param [String] modifier_list_id Required parameter: The ID of the
1313
- # modifier list to edit.
1314
- # @param [V1UpdateModifierListRequest] body Required parameter: An object
1315
- # containing the fields to POST for the request. See the corresponding
1316
- # object definition for field details.
1317
- # @return [V1ModifierList Hash] response from the API call
1318
- def update_modifier_list(location_id:,
1319
- modifier_list_id:,
1320
- body:)
1321
- warn 'Endpoint update_modifier_list in V1ItemsApi is deprecated'
1322
- # Prepare query url.
1323
- _query_builder = config.get_base_uri
1324
- _query_builder << '/v1/{location_id}/modifier-lists/{modifier_list_id}'
1325
- _query_builder = APIHelper.append_url_with_template_parameters(
1326
- _query_builder,
1327
- 'location_id' => { 'value' => location_id, 'encode' => true },
1328
- 'modifier_list_id' => { 'value' => modifier_list_id, 'encode' => true }
1329
- )
1330
- _query_url = APIHelper.clean_url _query_builder
1331
-
1332
- # Prepare headers.
1333
- _headers = {
1334
- 'accept' => 'application/json',
1335
- 'content-type' => 'application/json; charset=utf-8'
1336
- }
1337
-
1338
- # Prepare and execute HttpRequest.
1339
- _request = config.http_client.put(
1340
- _query_url,
1341
- headers: _headers,
1342
- parameters: body.to_json
1343
- )
1344
- OAuth2.apply(config, _request)
1345
- _response = execute_request(_request)
1346
-
1347
- # Return appropriate response type.
1348
- decoded = APIHelper.json_deserialize(_response.raw_body)
1349
- _errors = APIHelper.map_response(decoded, ['errors'])
1350
- ApiResponse.new(
1351
- _response, data: decoded, errors: _errors
1352
- )
1353
- end
1354
-
1355
- # Creates an item modifier option and adds it to a modifier list.
1356
- # @param [String] location_id Required parameter: The ID of the item's
1357
- # associated location.
1358
- # @param [String] modifier_list_id Required parameter: The ID of the
1359
- # modifier list to edit.
1360
- # @param [V1ModifierOption] body Required parameter: An object containing
1361
- # the fields to POST for the request. See the corresponding object
1362
- # definition for field details.
1363
- # @return [V1ModifierOption Hash] response from the API call
1364
- def create_modifier_option(location_id:,
1365
- modifier_list_id:,
1366
- body:)
1367
- warn 'Endpoint create_modifier_option in V1ItemsApi is deprecated'
1368
- # Prepare query url.
1369
- _query_builder = config.get_base_uri
1370
- _query_builder << '/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options'
1371
- _query_builder = APIHelper.append_url_with_template_parameters(
1372
- _query_builder,
1373
- 'location_id' => { 'value' => location_id, 'encode' => true },
1374
- 'modifier_list_id' => { 'value' => modifier_list_id, 'encode' => true }
1375
- )
1376
- _query_url = APIHelper.clean_url _query_builder
1377
-
1378
- # Prepare headers.
1379
- _headers = {
1380
- 'accept' => 'application/json',
1381
- 'content-type' => 'application/json; charset=utf-8'
1382
- }
1383
-
1384
- # Prepare and execute HttpRequest.
1385
- _request = config.http_client.post(
1386
- _query_url,
1387
- headers: _headers,
1388
- parameters: body.to_json
1389
- )
1390
- OAuth2.apply(config, _request)
1391
- _response = execute_request(_request)
1392
-
1393
- # Return appropriate response type.
1394
- decoded = APIHelper.json_deserialize(_response.raw_body)
1395
- _errors = APIHelper.map_response(decoded, ['errors'])
1396
- ApiResponse.new(
1397
- _response, data: decoded, errors: _errors
1398
- )
1399
- end
1400
-
1401
- # Deletes an existing item modifier option from a modifier list.
1402
- # __DeleteModifierOption__ returns nothing on success but Connect
1403
- # SDKs map the empty response to an empty `V1DeleteModifierOptionRequest`
1404
- # object.
1405
- # @param [String] location_id Required parameter: The ID of the item's
1406
- # associated location.
1407
- # @param [String] modifier_list_id Required parameter: The ID of the
1408
- # modifier list to delete.
1409
- # @param [String] modifier_option_id Required parameter: The ID of the
1410
- # modifier list to edit.
1411
- # @return [V1ModifierOption Hash] response from the API call
1412
- def delete_modifier_option(location_id:,
1413
- modifier_list_id:,
1414
- modifier_option_id:)
1415
- warn 'Endpoint delete_modifier_option in V1ItemsApi is deprecated'
1416
- # Prepare query url.
1417
- _query_builder = config.get_base_uri
1418
- _query_builder << '/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options/{modifier_option_id}'
1419
- _query_builder = APIHelper.append_url_with_template_parameters(
1420
- _query_builder,
1421
- 'location_id' => { 'value' => location_id, 'encode' => true },
1422
- 'modifier_list_id' => { 'value' => modifier_list_id, 'encode' => true },
1423
- 'modifier_option_id' => { 'value' => modifier_option_id, 'encode' => true }
1424
- )
1425
- _query_url = APIHelper.clean_url _query_builder
1426
-
1427
- # Prepare headers.
1428
- _headers = {
1429
- 'accept' => 'application/json'
1430
- }
1431
-
1432
- # Prepare and execute HttpRequest.
1433
- _request = config.http_client.delete(
1434
- _query_url,
1435
- headers: _headers
1436
- )
1437
- OAuth2.apply(config, _request)
1438
- _response = execute_request(_request)
1439
-
1440
- # Return appropriate response type.
1441
- decoded = APIHelper.json_deserialize(_response.raw_body)
1442
- _errors = APIHelper.map_response(decoded, ['errors'])
1443
- ApiResponse.new(
1444
- _response, data: decoded, errors: _errors
1445
- )
1446
- end
1447
-
1448
- # Modifies the details of an existing item modifier option.
1449
- # @param [String] location_id Required parameter: The ID of the item's
1450
- # associated location.
1451
- # @param [String] modifier_list_id Required parameter: The ID of the
1452
- # modifier list to edit.
1453
- # @param [String] modifier_option_id Required parameter: The ID of the
1454
- # modifier list to edit.
1455
- # @param [V1ModifierOption] body Required parameter: An object containing
1456
- # the fields to POST for the request. See the corresponding object
1457
- # definition for field details.
1458
- # @return [V1ModifierOption Hash] response from the API call
1459
- def update_modifier_option(location_id:,
1460
- modifier_list_id:,
1461
- modifier_option_id:,
1462
- body:)
1463
- warn 'Endpoint update_modifier_option in V1ItemsApi is deprecated'
1464
- # Prepare query url.
1465
- _query_builder = config.get_base_uri
1466
- _query_builder << '/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options/{modifier_option_id}'
1467
- _query_builder = APIHelper.append_url_with_template_parameters(
1468
- _query_builder,
1469
- 'location_id' => { 'value' => location_id, 'encode' => true },
1470
- 'modifier_list_id' => { 'value' => modifier_list_id, 'encode' => true },
1471
- 'modifier_option_id' => { 'value' => modifier_option_id, 'encode' => true }
1472
- )
1473
- _query_url = APIHelper.clean_url _query_builder
1474
-
1475
- # Prepare headers.
1476
- _headers = {
1477
- 'accept' => 'application/json',
1478
- 'content-type' => 'application/json; charset=utf-8'
1479
- }
1480
-
1481
- # Prepare and execute HttpRequest.
1482
- _request = config.http_client.put(
1483
- _query_url,
1484
- headers: _headers,
1485
- parameters: body.to_json
1486
- )
1487
- OAuth2.apply(config, _request)
1488
- _response = execute_request(_request)
1489
-
1490
- # Return appropriate response type.
1491
- decoded = APIHelper.json_deserialize(_response.raw_body)
1492
- _errors = APIHelper.map_response(decoded, ['errors'])
1493
- ApiResponse.new(
1494
- _response, data: decoded, errors: _errors
1495
- )
1496
- end
1497
-
1498
- # Lists all Favorites pages (in Square Point of Sale) for a given
1499
- # location.
1500
- # @param [String] location_id Required parameter: The ID of the location to
1501
- # list Favorites pages for.
1502
- # @return [List of V1Page Hash] response from the API call
1503
- def list_pages(location_id:)
1504
- warn 'Endpoint list_pages in V1ItemsApi is deprecated'
1505
- # Prepare query url.
1506
- _query_builder = config.get_base_uri
1507
- _query_builder << '/v1/{location_id}/pages'
1508
- _query_builder = APIHelper.append_url_with_template_parameters(
1509
- _query_builder,
1510
- 'location_id' => { 'value' => location_id, 'encode' => true }
1511
- )
1512
- _query_url = APIHelper.clean_url _query_builder
1513
-
1514
- # Prepare headers.
1515
- _headers = {
1516
- 'accept' => 'application/json'
1517
- }
1518
-
1519
- # Prepare and execute HttpRequest.
1520
- _request = config.http_client.get(
1521
- _query_url,
1522
- headers: _headers
1523
- )
1524
- OAuth2.apply(config, _request)
1525
- _response = execute_request(_request)
1526
-
1527
- # Return appropriate response type.
1528
- decoded = APIHelper.json_deserialize(_response.raw_body)
1529
- _errors = APIHelper.map_response(decoded, ['errors'])
1530
- ApiResponse.new(
1531
- _response, data: decoded, errors: _errors
1532
- )
1533
- end
1534
-
1535
- # Creates a Favorites page in Square Point of Sale.
1536
- # @param [String] location_id Required parameter: The ID of the location to
1537
- # create an item for.
1538
- # @param [V1Page] body Required parameter: An object containing the fields
1539
- # to POST for the request. See the corresponding object definition for
1540
- # field details.
1541
- # @return [V1Page Hash] response from the API call
1542
- def create_page(location_id:,
1543
- body:)
1544
- warn 'Endpoint create_page in V1ItemsApi is deprecated'
1545
- # Prepare query url.
1546
- _query_builder = config.get_base_uri
1547
- _query_builder << '/v1/{location_id}/pages'
1548
- _query_builder = APIHelper.append_url_with_template_parameters(
1549
- _query_builder,
1550
- 'location_id' => { 'value' => location_id, 'encode' => true }
1551
- )
1552
- _query_url = APIHelper.clean_url _query_builder
1553
-
1554
- # Prepare headers.
1555
- _headers = {
1556
- 'accept' => 'application/json',
1557
- 'content-type' => 'application/json; charset=utf-8'
1558
- }
1559
-
1560
- # Prepare and execute HttpRequest.
1561
- _request = config.http_client.post(
1562
- _query_url,
1563
- headers: _headers,
1564
- parameters: body.to_json
1565
- )
1566
- OAuth2.apply(config, _request)
1567
- _response = execute_request(_request)
1568
-
1569
- # Return appropriate response type.
1570
- decoded = APIHelper.json_deserialize(_response.raw_body)
1571
- _errors = APIHelper.map_response(decoded, ['errors'])
1572
- ApiResponse.new(
1573
- _response, data: decoded, errors: _errors
1574
- )
1575
- end
1576
-
1577
- # Deletes an existing Favorites page and all of its cells.
1578
- # __DeletePage__ returns nothing on success but Connect SDKs
1579
- # map the empty response to an empty `V1DeletePageRequest` object.
1580
- # @param [String] location_id Required parameter: The ID of the Favorites
1581
- # page's associated location.
1582
- # @param [String] page_id Required parameter: The ID of the page to
1583
- # delete.
1584
- # @return [V1Page Hash] response from the API call
1585
- def delete_page(location_id:,
1586
- page_id:)
1587
- warn 'Endpoint delete_page in V1ItemsApi is deprecated'
1588
- # Prepare query url.
1589
- _query_builder = config.get_base_uri
1590
- _query_builder << '/v1/{location_id}/pages/{page_id}'
1591
- _query_builder = APIHelper.append_url_with_template_parameters(
1592
- _query_builder,
1593
- 'location_id' => { 'value' => location_id, 'encode' => true },
1594
- 'page_id' => { 'value' => page_id, 'encode' => true }
1595
- )
1596
- _query_url = APIHelper.clean_url _query_builder
1597
-
1598
- # Prepare headers.
1599
- _headers = {
1600
- 'accept' => 'application/json'
1601
- }
1602
-
1603
- # Prepare and execute HttpRequest.
1604
- _request = config.http_client.delete(
1605
- _query_url,
1606
- headers: _headers
1607
- )
1608
- OAuth2.apply(config, _request)
1609
- _response = execute_request(_request)
1610
-
1611
- # Return appropriate response type.
1612
- decoded = APIHelper.json_deserialize(_response.raw_body)
1613
- _errors = APIHelper.map_response(decoded, ['errors'])
1614
- ApiResponse.new(
1615
- _response, data: decoded, errors: _errors
1616
- )
1617
- end
1618
-
1619
- # Modifies the details of a Favorites page in Square Point of Sale.
1620
- # @param [String] location_id Required parameter: The ID of the Favorites
1621
- # page's associated location
1622
- # @param [String] page_id Required parameter: The ID of the page to
1623
- # modify.
1624
- # @param [V1Page] body Required parameter: An object containing the fields
1625
- # to POST for the request. See the corresponding object definition for
1626
- # field details.
1627
- # @return [V1Page Hash] response from the API call
1628
- def update_page(location_id:,
1629
- page_id:,
1630
- body:)
1631
- warn 'Endpoint update_page in V1ItemsApi is deprecated'
1632
- # Prepare query url.
1633
- _query_builder = config.get_base_uri
1634
- _query_builder << '/v1/{location_id}/pages/{page_id}'
1635
- _query_builder = APIHelper.append_url_with_template_parameters(
1636
- _query_builder,
1637
- 'location_id' => { 'value' => location_id, 'encode' => true },
1638
- 'page_id' => { 'value' => page_id, 'encode' => true }
1639
- )
1640
- _query_url = APIHelper.clean_url _query_builder
1641
-
1642
- # Prepare headers.
1643
- _headers = {
1644
- 'accept' => 'application/json',
1645
- 'content-type' => 'application/json; charset=utf-8'
1646
- }
1647
-
1648
- # Prepare and execute HttpRequest.
1649
- _request = config.http_client.put(
1650
- _query_url,
1651
- headers: _headers,
1652
- parameters: body.to_json
1653
- )
1654
- OAuth2.apply(config, _request)
1655
- _response = execute_request(_request)
1656
-
1657
- # Return appropriate response type.
1658
- decoded = APIHelper.json_deserialize(_response.raw_body)
1659
- _errors = APIHelper.map_response(decoded, ['errors'])
1660
- ApiResponse.new(
1661
- _response, data: decoded, errors: _errors
1662
- )
1663
- end
1664
-
1665
- # Deletes a cell from a Favorites page in Square Point of Sale.
1666
- # __DeletePageCell__ returns nothing on success but Connect SDKs
1667
- # map the empty response to an empty `V1DeletePageCellRequest` object
1668
- # as documented below.
1669
- # @param [String] location_id Required parameter: The ID of the Favorites
1670
- # page's associated location.
1671
- # @param [String] page_id Required parameter: The ID of the page to
1672
- # delete.
1673
- # @param [String] row Optional parameter: The row of the cell to clear.
1674
- # Always an integer between 0 and 4, inclusive. Row 0 is the top row.
1675
- # @param [String] column Optional parameter: The column of the cell to
1676
- # clear. Always an integer between 0 and 4, inclusive. Column 0 is the
1677
- # leftmost column.
1678
- # @return [V1Page Hash] response from the API call
1679
- def delete_page_cell(location_id:,
1680
- page_id:,
1681
- row: nil,
1682
- column: nil)
1683
- warn 'Endpoint delete_page_cell in V1ItemsApi is deprecated'
1684
- # Prepare query url.
1685
- _query_builder = config.get_base_uri
1686
- _query_builder << '/v1/{location_id}/pages/{page_id}/cells'
1687
- _query_builder = APIHelper.append_url_with_template_parameters(
1688
- _query_builder,
1689
- 'location_id' => { 'value' => location_id, 'encode' => true },
1690
- 'page_id' => { 'value' => page_id, 'encode' => true }
1691
- )
1692
- _query_builder = APIHelper.append_url_with_query_parameters(
1693
- _query_builder,
1694
- 'row' => row,
1695
- 'column' => column
1696
- )
1697
- _query_url = APIHelper.clean_url _query_builder
1698
-
1699
- # Prepare headers.
1700
- _headers = {
1701
- 'accept' => 'application/json'
1702
- }
1703
-
1704
- # Prepare and execute HttpRequest.
1705
- _request = config.http_client.delete(
1706
- _query_url,
1707
- headers: _headers
1708
- )
1709
- OAuth2.apply(config, _request)
1710
- _response = execute_request(_request)
1711
-
1712
- # Return appropriate response type.
1713
- decoded = APIHelper.json_deserialize(_response.raw_body)
1714
- _errors = APIHelper.map_response(decoded, ['errors'])
1715
- ApiResponse.new(
1716
- _response, data: decoded, errors: _errors
1717
- )
1718
- end
1719
-
1720
- # Modifies a cell of a Favorites page in Square Point of Sale.
1721
- # @param [String] location_id Required parameter: The ID of the Favorites
1722
- # page's associated location.
1723
- # @param [String] page_id Required parameter: The ID of the page the cell
1724
- # belongs to.
1725
- # @param [V1PageCell] body Required parameter: An object containing the
1726
- # fields to POST for the request. See the corresponding object definition
1727
- # for field details.
1728
- # @return [V1Page Hash] response from the API call
1729
- def update_page_cell(location_id:,
1730
- page_id:,
1731
- body:)
1732
- warn 'Endpoint update_page_cell in V1ItemsApi is deprecated'
1733
- # Prepare query url.
1734
- _query_builder = config.get_base_uri
1735
- _query_builder << '/v1/{location_id}/pages/{page_id}/cells'
1736
- _query_builder = APIHelper.append_url_with_template_parameters(
1737
- _query_builder,
1738
- 'location_id' => { 'value' => location_id, 'encode' => true },
1739
- 'page_id' => { 'value' => page_id, 'encode' => true }
1740
- )
1741
- _query_url = APIHelper.clean_url _query_builder
1742
-
1743
- # Prepare headers.
1744
- _headers = {
1745
- 'accept' => 'application/json',
1746
- 'content-type' => 'application/json; charset=utf-8'
1747
- }
1748
-
1749
- # Prepare and execute HttpRequest.
1750
- _request = config.http_client.put(
1751
- _query_url,
1752
- headers: _headers,
1753
- parameters: body.to_json
1754
- )
1755
- OAuth2.apply(config, _request)
1756
- _response = execute_request(_request)
1757
-
1758
- # Return appropriate response type.
1759
- decoded = APIHelper.json_deserialize(_response.raw_body)
1760
- _errors = APIHelper.map_response(decoded, ['errors'])
1761
- ApiResponse.new(
1762
- _response, data: decoded, errors: _errors
1763
- )
1764
- end
1765
- end
1766
- end