square.rb 3.3.0.20191217

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