square.rb 6.3.0.20200826 → 17.1.0.20220120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +86 -51
- data/lib/square/api/apple_pay_api.rb +12 -9
- data/lib/square/api/bank_accounts_api.rb +21 -24
- data/lib/square/api/base_api.rb +20 -9
- data/lib/square/api/bookings_api.rb +391 -0
- data/lib/square/api/cards_api.rb +170 -0
- data/lib/square/api/cash_drawers_api.rb +13 -6
- data/lib/square/api/catalog_api.rb +195 -85
- data/lib/square/api/checkout_api.rb +7 -5
- data/lib/square/api/customer_groups_api.rb +34 -16
- data/lib/square/api/customer_segments_api.rb +21 -9
- data/lib/square/api/customers_api.rb +102 -55
- data/lib/square/api/devices_api.rb +20 -8
- data/lib/square/api/disputes_api.rb +156 -144
- data/lib/square/api/employees_api.rb +7 -3
- data/lib/square/api/gift_card_activities_api.rb +133 -0
- data/lib/square/api/gift_cards_api.rb +297 -0
- data/lib/square/api/inventory_api.rb +290 -37
- data/lib/square/api/invoices_api.rb +61 -57
- data/lib/square/api/labor_api.rb +127 -93
- data/lib/square/api/locations_api.rb +36 -25
- data/lib/square/api/loyalty_api.rb +134 -87
- data/lib/square/api/merchants_api.rb +8 -4
- data/lib/square/api/mobile_authorization_api.rb +9 -7
- data/lib/square/api/o_auth_api.rb +41 -32
- data/lib/square/api/orders_api.rb +132 -54
- data/lib/square/api/payments_api.rb +133 -75
- data/lib/square/api/refunds_api.rb +51 -30
- data/lib/square/api/sites_api.rb +43 -0
- data/lib/square/api/snippets_api.rb +146 -0
- data/lib/square/api/subscriptions_api.rb +216 -26
- data/lib/square/api/team_api.rb +81 -65
- data/lib/square/api/terminal_api.rb +166 -16
- data/lib/square/api/transactions_api.rb +32 -194
- data/lib/square/api/v1_transactions_api.rb +53 -103
- data/lib/square/api_helper.rb +38 -43
- data/lib/square/client.rb +54 -24
- data/lib/square/configuration.rb +61 -21
- data/lib/square/http/api_response.rb +3 -1
- data/lib/square/http/faraday_client.rb +34 -5
- data/lib/square/utilities/date_time_helper.rb +151 -0
- data/lib/square/utilities/file_wrapper.rb +1 -2
- data/lib/square.rb +65 -61
- data/spec/user_journey_spec.rb +2 -5
- data/test/api/api_test_base.rb +1 -6
- data/test/api/test_catalog_api.rb +1 -4
- data/test/api/test_customers_api.rb +1 -4
- data/test/api/test_employees_api.rb +1 -4
- data/test/api/test_labor_api.rb +2 -6
- data/test/api/test_locations_api.rb +21 -35
- data/test/api/test_merchants_api.rb +1 -4
- data/test/api/test_payments_api.rb +3 -6
- data/test/api/test_refunds_api.rb +3 -6
- data/test/http_response_catcher.rb +0 -5
- data/test/test_helper.rb +1 -6
- metadata +40 -18
- data/lib/square/api/v1_employees_api.rb +0 -723
- data/lib/square/api/v1_items_api.rb +0 -1686
- data/lib/square/api/v1_locations_api.rb +0 -65
@@ -5,18 +5,58 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
#
|
8
|
+
# Deprecated version of
|
9
|
+
# [RetrieveInventoryAdjustment]($e/Inventory/RetrieveInventoryAdjustment)
|
10
|
+
# after the endpoint URL
|
11
|
+
# is updated to conform to the standard convention.
|
12
|
+
# @param [String] adjustment_id Required parameter: ID of the
|
13
|
+
# [InventoryAdjustment]($m/InventoryAdjustment) to retrieve.
|
14
|
+
# @return [RetrieveInventoryAdjustmentResponse Hash] response from the API call
|
15
|
+
def deprecated_retrieve_inventory_adjustment(adjustment_id:)
|
16
|
+
warn 'Endpoint deprecated_retrieve_inventory_adjustment in InventoryApi '\
|
17
|
+
'is deprecated'
|
18
|
+
# Prepare query url.
|
19
|
+
_query_builder = config.get_base_uri
|
20
|
+
_query_builder << '/v2/inventory/adjustment/{adjustment_id}'
|
21
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
22
|
+
_query_builder,
|
23
|
+
'adjustment_id' => { 'value' => adjustment_id, 'encode' => true }
|
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(
|
44
|
+
_response, data: decoded, errors: _errors
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns the [InventoryAdjustment]($m/InventoryAdjustment) object
|
9
49
|
# with the provided `adjustment_id`.
|
10
50
|
# @param [String] adjustment_id Required parameter: ID of the
|
11
|
-
# [InventoryAdjustment](
|
51
|
+
# [InventoryAdjustment]($m/InventoryAdjustment) to retrieve.
|
12
52
|
# @return [RetrieveInventoryAdjustmentResponse Hash] response from the API call
|
13
53
|
def retrieve_inventory_adjustment(adjustment_id:)
|
14
54
|
# Prepare query url.
|
15
55
|
_query_builder = config.get_base_uri
|
16
|
-
_query_builder << '/v2/inventory/
|
56
|
+
_query_builder << '/v2/inventory/adjustments/{adjustment_id}'
|
17
57
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
18
58
|
_query_builder,
|
19
|
-
'adjustment_id' => adjustment_id
|
59
|
+
'adjustment_id' => { 'value' => adjustment_id, 'encode' => true }
|
20
60
|
)
|
21
61
|
_query_url = APIHelper.clean_url _query_builder
|
22
62
|
|
@@ -36,7 +76,126 @@ module Square
|
|
36
76
|
# Return appropriate response type.
|
37
77
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
38
78
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
39
|
-
ApiResponse.new(
|
79
|
+
ApiResponse.new(
|
80
|
+
_response, data: decoded, errors: _errors
|
81
|
+
)
|
82
|
+
end
|
83
|
+
|
84
|
+
# Deprecated version of
|
85
|
+
# [BatchChangeInventory]($e/Inventory/BatchChangeInventory) after the
|
86
|
+
# endpoint URL
|
87
|
+
# is updated to conform to the standard convention.
|
88
|
+
# @param [BatchChangeInventoryRequest] body Required parameter: An object
|
89
|
+
# containing the fields to POST for the request. See the corresponding
|
90
|
+
# object definition for field details.
|
91
|
+
# @return [BatchChangeInventoryResponse Hash] response from the API call
|
92
|
+
def deprecated_batch_change_inventory(body:)
|
93
|
+
warn 'Endpoint deprecated_batch_change_inventory in InventoryApi is depr'\
|
94
|
+
'ecated'
|
95
|
+
# Prepare query url.
|
96
|
+
_query_builder = config.get_base_uri
|
97
|
+
_query_builder << '/v2/inventory/batch-change'
|
98
|
+
_query_url = APIHelper.clean_url _query_builder
|
99
|
+
|
100
|
+
# Prepare headers.
|
101
|
+
_headers = {
|
102
|
+
'accept' => 'application/json',
|
103
|
+
'Content-Type' => 'application/json'
|
104
|
+
}
|
105
|
+
|
106
|
+
# Prepare and execute HttpRequest.
|
107
|
+
_request = config.http_client.post(
|
108
|
+
_query_url,
|
109
|
+
headers: _headers,
|
110
|
+
parameters: body.to_json
|
111
|
+
)
|
112
|
+
OAuth2.apply(config, _request)
|
113
|
+
_response = execute_request(_request)
|
114
|
+
|
115
|
+
# Return appropriate response type.
|
116
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
117
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
118
|
+
ApiResponse.new(
|
119
|
+
_response, data: decoded, errors: _errors
|
120
|
+
)
|
121
|
+
end
|
122
|
+
|
123
|
+
# Deprecated version of
|
124
|
+
# [BatchRetrieveInventoryChanges]($e/Inventory/BatchRetrieveInventoryChanges
|
125
|
+
# ) after the endpoint URL
|
126
|
+
# is updated to conform to the standard convention.
|
127
|
+
# @param [BatchRetrieveInventoryChangesRequest] body Required parameter: An
|
128
|
+
# object containing the fields to POST for the request. See the
|
129
|
+
# corresponding object definition for field details.
|
130
|
+
# @return [BatchRetrieveInventoryChangesResponse Hash] response from the API call
|
131
|
+
def deprecated_batch_retrieve_inventory_changes(body:)
|
132
|
+
warn 'Endpoint deprecated_batch_retrieve_inventory_changes in InventoryA'\
|
133
|
+
'pi is deprecated'
|
134
|
+
# Prepare query url.
|
135
|
+
_query_builder = config.get_base_uri
|
136
|
+
_query_builder << '/v2/inventory/batch-retrieve-changes'
|
137
|
+
_query_url = APIHelper.clean_url _query_builder
|
138
|
+
|
139
|
+
# Prepare headers.
|
140
|
+
_headers = {
|
141
|
+
'accept' => 'application/json',
|
142
|
+
'Content-Type' => 'application/json'
|
143
|
+
}
|
144
|
+
|
145
|
+
# Prepare and execute HttpRequest.
|
146
|
+
_request = config.http_client.post(
|
147
|
+
_query_url,
|
148
|
+
headers: _headers,
|
149
|
+
parameters: body.to_json
|
150
|
+
)
|
151
|
+
OAuth2.apply(config, _request)
|
152
|
+
_response = execute_request(_request)
|
153
|
+
|
154
|
+
# Return appropriate response type.
|
155
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
156
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
157
|
+
ApiResponse.new(
|
158
|
+
_response, data: decoded, errors: _errors
|
159
|
+
)
|
160
|
+
end
|
161
|
+
|
162
|
+
# Deprecated version of
|
163
|
+
# [BatchRetrieveInventoryCounts]($e/Inventory/BatchRetrieveInventoryCounts)
|
164
|
+
# after the endpoint URL
|
165
|
+
# is updated to conform to the standard convention.
|
166
|
+
# @param [BatchRetrieveInventoryCountsRequest] body Required parameter: An
|
167
|
+
# object containing the fields to POST for the request. See the
|
168
|
+
# corresponding object definition for field details.
|
169
|
+
# @return [BatchRetrieveInventoryCountsResponse Hash] response from the API call
|
170
|
+
def deprecated_batch_retrieve_inventory_counts(body:)
|
171
|
+
warn 'Endpoint deprecated_batch_retrieve_inventory_counts in InventoryAp'\
|
172
|
+
'i is deprecated'
|
173
|
+
# Prepare query url.
|
174
|
+
_query_builder = config.get_base_uri
|
175
|
+
_query_builder << '/v2/inventory/batch-retrieve-counts'
|
176
|
+
_query_url = APIHelper.clean_url _query_builder
|
177
|
+
|
178
|
+
# Prepare headers.
|
179
|
+
_headers = {
|
180
|
+
'accept' => 'application/json',
|
181
|
+
'Content-Type' => 'application/json'
|
182
|
+
}
|
183
|
+
|
184
|
+
# Prepare and execute HttpRequest.
|
185
|
+
_request = config.http_client.post(
|
186
|
+
_query_url,
|
187
|
+
headers: _headers,
|
188
|
+
parameters: body.to_json
|
189
|
+
)
|
190
|
+
OAuth2.apply(config, _request)
|
191
|
+
_response = execute_request(_request)
|
192
|
+
|
193
|
+
# Return appropriate response type.
|
194
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
195
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
196
|
+
ApiResponse.new(
|
197
|
+
_response, data: decoded, errors: _errors
|
198
|
+
)
|
40
199
|
end
|
41
200
|
|
42
201
|
# Applies adjustments and counts to the provided item quantities.
|
@@ -50,13 +209,13 @@ module Square
|
|
50
209
|
def batch_change_inventory(body:)
|
51
210
|
# Prepare query url.
|
52
211
|
_query_builder = config.get_base_uri
|
53
|
-
_query_builder << '/v2/inventory/batch-
|
212
|
+
_query_builder << '/v2/inventory/changes/batch-create'
|
54
213
|
_query_url = APIHelper.clean_url _query_builder
|
55
214
|
|
56
215
|
# Prepare headers.
|
57
216
|
_headers = {
|
58
217
|
'accept' => 'application/json',
|
59
|
-
'
|
218
|
+
'Content-Type' => 'application/json'
|
60
219
|
}
|
61
220
|
|
62
221
|
# Prepare and execute HttpRequest.
|
@@ -71,7 +230,9 @@ module Square
|
|
71
230
|
# Return appropriate response type.
|
72
231
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
73
232
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
74
|
-
ApiResponse.new(
|
233
|
+
ApiResponse.new(
|
234
|
+
_response, data: decoded, errors: _errors
|
235
|
+
)
|
75
236
|
end
|
76
237
|
|
77
238
|
# Returns historical physical counts and adjustments based on the
|
@@ -87,13 +248,13 @@ module Square
|
|
87
248
|
def batch_retrieve_inventory_changes(body:)
|
88
249
|
# Prepare query url.
|
89
250
|
_query_builder = config.get_base_uri
|
90
|
-
_query_builder << '/v2/inventory/batch-retrieve
|
251
|
+
_query_builder << '/v2/inventory/changes/batch-retrieve'
|
91
252
|
_query_url = APIHelper.clean_url _query_builder
|
92
253
|
|
93
254
|
# Prepare headers.
|
94
255
|
_headers = {
|
95
256
|
'accept' => 'application/json',
|
96
|
-
'
|
257
|
+
'Content-Type' => 'application/json'
|
97
258
|
}
|
98
259
|
|
99
260
|
# Prepare and execute HttpRequest.
|
@@ -108,12 +269,14 @@ module Square
|
|
108
269
|
# Return appropriate response type.
|
109
270
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
110
271
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
111
|
-
ApiResponse.new(
|
272
|
+
ApiResponse.new(
|
273
|
+
_response, data: decoded, errors: _errors
|
274
|
+
)
|
112
275
|
end
|
113
276
|
|
114
277
|
# Returns current counts for the provided
|
115
|
-
# [CatalogObject](
|
116
|
-
# [Location](
|
278
|
+
# [CatalogObject]($m/CatalogObject)s at the requested
|
279
|
+
# [Location]($m/Location)s.
|
117
280
|
# Results are paginated and sorted in descending order according to their
|
118
281
|
# `calculated_at` timestamp (newest first).
|
119
282
|
# When `updated_after` is specified, only counts that have changed since
|
@@ -128,13 +291,13 @@ module Square
|
|
128
291
|
def batch_retrieve_inventory_counts(body:)
|
129
292
|
# Prepare query url.
|
130
293
|
_query_builder = config.get_base_uri
|
131
|
-
_query_builder << '/v2/inventory/batch-retrieve
|
294
|
+
_query_builder << '/v2/inventory/counts/batch-retrieve'
|
132
295
|
_query_url = APIHelper.clean_url _query_builder
|
133
296
|
|
134
297
|
# Prepare headers.
|
135
298
|
_headers = {
|
136
299
|
'accept' => 'application/json',
|
137
|
-
'
|
300
|
+
'Content-Type' => 'application/json'
|
138
301
|
}
|
139
302
|
|
140
303
|
# Prepare and execute HttpRequest.
|
@@ -149,21 +312,99 @@ module Square
|
|
149
312
|
# Return appropriate response type.
|
150
313
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
151
314
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
152
|
-
ApiResponse.new(
|
315
|
+
ApiResponse.new(
|
316
|
+
_response, data: decoded, errors: _errors
|
317
|
+
)
|
318
|
+
end
|
319
|
+
|
320
|
+
# Deprecated version of
|
321
|
+
# [RetrieveInventoryPhysicalCount]($e/Inventory/RetrieveInventoryPhysicalCou
|
322
|
+
# nt) after the endpoint URL
|
323
|
+
# is updated to conform to the standard convention.
|
324
|
+
# @param [String] physical_count_id Required parameter: ID of the
|
325
|
+
# [InventoryPhysicalCount]($m/InventoryPhysicalCount) to retrieve.
|
326
|
+
# @return [RetrieveInventoryPhysicalCountResponse Hash] response from the API call
|
327
|
+
def deprecated_retrieve_inventory_physical_count(physical_count_id:)
|
328
|
+
warn 'Endpoint deprecated_retrieve_inventory_physical_count in Inventory'\
|
329
|
+
'Api is deprecated'
|
330
|
+
# Prepare query url.
|
331
|
+
_query_builder = config.get_base_uri
|
332
|
+
_query_builder << '/v2/inventory/physical-count/{physical_count_id}'
|
333
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
334
|
+
_query_builder,
|
335
|
+
'physical_count_id' => { 'value' => physical_count_id, 'encode' => true }
|
336
|
+
)
|
337
|
+
_query_url = APIHelper.clean_url _query_builder
|
338
|
+
|
339
|
+
# Prepare headers.
|
340
|
+
_headers = {
|
341
|
+
'accept' => 'application/json'
|
342
|
+
}
|
343
|
+
|
344
|
+
# Prepare and execute HttpRequest.
|
345
|
+
_request = config.http_client.get(
|
346
|
+
_query_url,
|
347
|
+
headers: _headers
|
348
|
+
)
|
349
|
+
OAuth2.apply(config, _request)
|
350
|
+
_response = execute_request(_request)
|
351
|
+
|
352
|
+
# Return appropriate response type.
|
353
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
354
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
355
|
+
ApiResponse.new(
|
356
|
+
_response, data: decoded, errors: _errors
|
357
|
+
)
|
153
358
|
end
|
154
359
|
|
155
|
-
# Returns the [InventoryPhysicalCount](
|
360
|
+
# Returns the [InventoryPhysicalCount]($m/InventoryPhysicalCount)
|
156
361
|
# object with the provided `physical_count_id`.
|
157
362
|
# @param [String] physical_count_id Required parameter: ID of the
|
158
|
-
# [InventoryPhysicalCount](
|
363
|
+
# [InventoryPhysicalCount]($m/InventoryPhysicalCount) to retrieve.
|
159
364
|
# @return [RetrieveInventoryPhysicalCountResponse Hash] response from the API call
|
160
365
|
def retrieve_inventory_physical_count(physical_count_id:)
|
161
366
|
# Prepare query url.
|
162
367
|
_query_builder = config.get_base_uri
|
163
|
-
_query_builder << '/v2/inventory/physical-
|
368
|
+
_query_builder << '/v2/inventory/physical-counts/{physical_count_id}'
|
369
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
370
|
+
_query_builder,
|
371
|
+
'physical_count_id' => { 'value' => physical_count_id, 'encode' => true }
|
372
|
+
)
|
373
|
+
_query_url = APIHelper.clean_url _query_builder
|
374
|
+
|
375
|
+
# Prepare headers.
|
376
|
+
_headers = {
|
377
|
+
'accept' => 'application/json'
|
378
|
+
}
|
379
|
+
|
380
|
+
# Prepare and execute HttpRequest.
|
381
|
+
_request = config.http_client.get(
|
382
|
+
_query_url,
|
383
|
+
headers: _headers
|
384
|
+
)
|
385
|
+
OAuth2.apply(config, _request)
|
386
|
+
_response = execute_request(_request)
|
387
|
+
|
388
|
+
# Return appropriate response type.
|
389
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
390
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
391
|
+
ApiResponse.new(
|
392
|
+
_response, data: decoded, errors: _errors
|
393
|
+
)
|
394
|
+
end
|
395
|
+
|
396
|
+
# Returns the [InventoryTransfer]($m/InventoryTransfer) object
|
397
|
+
# with the provided `transfer_id`.
|
398
|
+
# @param [String] transfer_id Required parameter: ID of the
|
399
|
+
# [InventoryTransfer]($m/InventoryTransfer) to retrieve.
|
400
|
+
# @return [RetrieveInventoryTransferResponse Hash] response from the API call
|
401
|
+
def retrieve_inventory_transfer(transfer_id:)
|
402
|
+
# Prepare query url.
|
403
|
+
_query_builder = config.get_base_uri
|
404
|
+
_query_builder << '/v2/inventory/transfers/{transfer_id}'
|
164
405
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
165
406
|
_query_builder,
|
166
|
-
'
|
407
|
+
'transfer_id' => { 'value' => transfer_id, 'encode' => true }
|
167
408
|
)
|
168
409
|
_query_url = APIHelper.clean_url _query_builder
|
169
410
|
|
@@ -183,23 +424,25 @@ module Square
|
|
183
424
|
# Return appropriate response type.
|
184
425
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
185
426
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
186
|
-
ApiResponse.new(
|
427
|
+
ApiResponse.new(
|
428
|
+
_response, data: decoded, errors: _errors
|
429
|
+
)
|
187
430
|
end
|
188
431
|
|
189
432
|
# Retrieves the current calculated stock count for a given
|
190
|
-
# [CatalogObject](
|
191
|
-
# [Location](
|
433
|
+
# [CatalogObject]($m/CatalogObject) at a given set of
|
434
|
+
# [Location]($m/Location)s. Responses are paginated and unsorted.
|
192
435
|
# For more sophisticated queries, use a batch endpoint.
|
193
436
|
# @param [String] catalog_object_id Required parameter: ID of the
|
194
|
-
# [CatalogObject](
|
437
|
+
# [CatalogObject]($m/CatalogObject) to retrieve.
|
195
438
|
# @param [String] location_ids Optional parameter: The
|
196
|
-
# [Location](
|
197
|
-
#
|
439
|
+
# [Location]($m/Location) IDs to look up as a comma-separated list. An empty
|
440
|
+
# list queries all locations.
|
198
441
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
199
442
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
200
443
|
# results for the original query. See the
|
201
|
-
# [Pagination](https://developer.squareup.com/docs/
|
202
|
-
#
|
444
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
445
|
+
# ion) guide for more information.
|
203
446
|
# @return [RetrieveInventoryCountResponse Hash] response from the API call
|
204
447
|
def retrieve_inventory_count(catalog_object_id:,
|
205
448
|
location_ids: nil,
|
@@ -209,7 +452,7 @@ module Square
|
|
209
452
|
_query_builder << '/v2/inventory/{catalog_object_id}'
|
210
453
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
211
454
|
_query_builder,
|
212
|
-
'catalog_object_id' => catalog_object_id
|
455
|
+
'catalog_object_id' => { 'value' => catalog_object_id, 'encode' => true }
|
213
456
|
)
|
214
457
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
215
458
|
_query_builder,
|
@@ -234,12 +477,19 @@ module Square
|
|
234
477
|
# Return appropriate response type.
|
235
478
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
236
479
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
237
|
-
ApiResponse.new(
|
480
|
+
ApiResponse.new(
|
481
|
+
_response, data: decoded, errors: _errors
|
482
|
+
)
|
238
483
|
end
|
239
484
|
|
240
485
|
# Returns a set of physical counts and inventory adjustments for the
|
241
|
-
# provided [CatalogObject](
|
242
|
-
# [Location](
|
486
|
+
# provided [CatalogObject]($m/CatalogObject) at the requested
|
487
|
+
# [Location]($m/Location)s.
|
488
|
+
# You can achieve the same result by calling
|
489
|
+
# [BatchRetrieveInventoryChanges]($e/Inventory/BatchRetrieveInventoryChanges
|
490
|
+
# )
|
491
|
+
# and having the `catalog_object_ids` list contain a single element of the
|
492
|
+
# `CatalogObject` ID.
|
243
493
|
# Results are paginated and sorted in descending order according to their
|
244
494
|
# `occurred_at` timestamp (newest first).
|
245
495
|
# There are no limits on how far back the caller can page. This endpoint can
|
@@ -247,10 +497,10 @@ module Square
|
|
247
497
|
# used to display recent changes for a specific item. For more
|
248
498
|
# sophisticated queries, use a batch endpoint.
|
249
499
|
# @param [String] catalog_object_id Required parameter: ID of the
|
250
|
-
# [CatalogObject](
|
500
|
+
# [CatalogObject]($m/CatalogObject) to retrieve.
|
251
501
|
# @param [String] location_ids Optional parameter: The
|
252
|
-
# [Location](
|
253
|
-
#
|
502
|
+
# [Location]($m/Location) IDs to look up as a comma-separated list. An empty
|
503
|
+
# list queries all locations.
|
254
504
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
255
505
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
256
506
|
# results for the original query. See the
|
@@ -260,12 +510,13 @@ module Square
|
|
260
510
|
def retrieve_inventory_changes(catalog_object_id:,
|
261
511
|
location_ids: nil,
|
262
512
|
cursor: nil)
|
513
|
+
warn 'Endpoint retrieve_inventory_changes in InventoryApi is deprecated'
|
263
514
|
# Prepare query url.
|
264
515
|
_query_builder = config.get_base_uri
|
265
516
|
_query_builder << '/v2/inventory/{catalog_object_id}/changes'
|
266
517
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
267
518
|
_query_builder,
|
268
|
-
'catalog_object_id' => catalog_object_id
|
519
|
+
'catalog_object_id' => { 'value' => catalog_object_id, 'encode' => true }
|
269
520
|
)
|
270
521
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
271
522
|
_query_builder,
|
@@ -290,7 +541,9 @@ module Square
|
|
290
541
|
# Return appropriate response type.
|
291
542
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
292
543
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
293
|
-
ApiResponse.new(
|
544
|
+
ApiResponse.new(
|
545
|
+
_response, data: decoded, errors: _errors
|
546
|
+
)
|
294
547
|
end
|
295
548
|
end
|
296
549
|
end
|