square.rb 3.20190814.0 → 3.20190925.0

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