fangkuai.rb 0.0.1

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