square.rb 26.1.0.20230119 → 27.0.0.20230419
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/square/api/apple_pay_api.rb +14 -30
- data/lib/square/api/bank_accounts_api.rb +40 -90
- data/lib/square/api/base_api.rb +42 -42
- data/lib/square/api/booking_custom_attributes_api.rb +171 -336
- data/lib/square/api/bookings_api.rb +140 -263
- data/lib/square/api/cards_api.rb +58 -120
- data/lib/square/api/cash_drawers_api.rb +47 -103
- data/lib/square/api/catalog_api.rb +200 -426
- data/lib/square/api/checkout_api.rb +86 -176
- data/lib/square/api/customer_custom_attributes_api.rb +157 -310
- data/lib/square/api/customer_groups_api.rb +69 -145
- data/lib/square/api/customer_segments_api.rb +26 -61
- data/lib/square/api/customers_api.rb +147 -294
- data/lib/square/api/devices_api.rb +42 -89
- data/lib/square/api/disputes_api.rb +132 -290
- data/lib/square/api/employees_api.rb +28 -63
- data/lib/square/api/gift_card_activities_api.rb +34 -66
- data/lib/square/api/gift_cards_api.rb +109 -207
- data/lib/square/api/inventory_api.rb +204 -391
- data/lib/square/api/invoices_api.rb +121 -240
- data/lib/square/api/labor_api.rb +223 -459
- data/lib/square/api/location_custom_attributes_api.rb +173 -338
- data/lib/square/api/locations_api.rb +54 -112
- data/lib/square/api/loyalty_api.rb +283 -535
- data/lib/square/api/merchants_api.rb +25 -60
- data/lib/square/api/mobile_authorization_api.rb +14 -30
- data/lib/square/api/o_auth_api.rb +54 -109
- data/lib/square/api/order_custom_attributes_api.rb +174 -339
- data/lib/square/api/orders_api.rb +115 -222
- data/lib/square/api/payments_api.rb +118 -217
- data/lib/square/api/payouts_api.rb +54 -107
- data/lib/square/api/refunds_api.rb +59 -104
- data/lib/square/api/sites_api.rb +11 -28
- data/lib/square/api/snippets_api.rb +42 -90
- data/lib/square/api/subscriptions_api.rb +150 -299
- data/lib/square/api/team_api.rb +114 -224
- data/lib/square/api/terminal_api.rb +162 -328
- data/lib/square/api/transactions_api.rb +64 -128
- data/lib/square/api/v1_transactions_api.rb +155 -296
- data/lib/square/api/vendors_api.rb +100 -193
- data/lib/square/api/webhook_subscriptions_api.rb +124 -244
- data/lib/square/api_helper.rb +1 -437
- data/lib/square/client.rb +77 -47
- data/lib/square/configuration.rb +28 -53
- data/lib/square/exceptions/api_exception.rb +1 -11
- data/lib/square/http/api_response.rb +13 -19
- data/lib/square/http/auth/o_auth2.rb +14 -7
- data/lib/square/http/http_call_back.rb +1 -15
- data/lib/square/http/http_method_enum.rb +1 -4
- data/lib/square/http/http_request.rb +1 -45
- data/lib/square/http/http_response.rb +1 -20
- data/lib/square/utilities/date_time_helper.rb +1 -146
- data/lib/square/utilities/file_wrapper.rb +5 -5
- data/lib/square.rb +6 -6
- data/spec/user_journey_spec.rb +2 -2
- data/test/api/api_test_base.rb +13 -5
- data/test/api/test_catalog_api.rb +5 -4
- data/test/api/test_customers_api.rb +3 -2
- data/test/api/test_employees_api.rb +4 -3
- data/test/api/test_labor_api.rb +6 -5
- data/test/api/test_locations_api.rb +3 -2
- data/test/api/test_merchants_api.rb +4 -3
- data/test/api/test_payments_api.rb +4 -3
- data/test/api/test_refunds_api.rb +4 -3
- metadata +11 -111
- data/lib/square/exceptions/validation_exception.rb +0 -13
- data/lib/square/http/faraday_client.rb +0 -93
- data/lib/square/http/http_client.rb +0 -118
- data/test/test_helper.rb +0 -89
@@ -1,89 +1,55 @@
|
|
1
1
|
module Square
|
2
2
|
# InventoryApi
|
3
3
|
class InventoryApi < BaseApi
|
4
|
-
def initialize(config, http_call_back: nil)
|
5
|
-
super(config, http_call_back: http_call_back)
|
6
|
-
end
|
7
|
-
|
8
4
|
# Deprecated version of
|
9
|
-
# [RetrieveInventoryAdjustment](
|
10
|
-
# after the endpoint URL
|
5
|
+
# [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdju
|
6
|
+
# stment) after the endpoint URL
|
11
7
|
# is updated to conform to the standard convention.
|
12
8
|
# @param [String] adjustment_id Required parameter: ID of the
|
13
|
-
# [InventoryAdjustment](
|
9
|
+
# [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
|
14
10
|
# @return [RetrieveInventoryAdjustmentResponse Hash] response from the API call
|
15
11
|
def deprecated_retrieve_inventory_adjustment(adjustment_id:)
|
16
12
|
warn 'Endpoint deprecated_retrieve_inventory_adjustment in InventoryApi '\
|
17
13
|
'is deprecated'
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
-
)
|
14
|
+
new_api_call_builder
|
15
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
16
|
+
'/v2/inventory/adjustment/{adjustment_id}',
|
17
|
+
'default')
|
18
|
+
.template_param(new_parameter(adjustment_id, key: 'adjustment_id')
|
19
|
+
.should_encode(true))
|
20
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
21
|
+
.auth(Single.new('global')))
|
22
|
+
.response(new_response_handler
|
23
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
24
|
+
.is_api_response(true)
|
25
|
+
.convertor(ApiResponse.method(:create)))
|
26
|
+
.execute
|
46
27
|
end
|
47
28
|
|
48
29
|
# Returns the [InventoryAdjustment]($m/InventoryAdjustment) object
|
49
30
|
# with the provided `adjustment_id`.
|
50
31
|
# @param [String] adjustment_id Required parameter: ID of the
|
51
|
-
# [InventoryAdjustment](
|
32
|
+
# [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
|
52
33
|
# @return [RetrieveInventoryAdjustmentResponse Hash] response from the API call
|
53
34
|
def retrieve_inventory_adjustment(adjustment_id:)
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
# Prepare and execute HttpRequest.
|
69
|
-
_request = config.http_client.get(
|
70
|
-
_query_url,
|
71
|
-
headers: _headers
|
72
|
-
)
|
73
|
-
OAuth2.apply(config, _request)
|
74
|
-
_response = execute_request(_request)
|
75
|
-
|
76
|
-
# Return appropriate response type.
|
77
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
78
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
79
|
-
ApiResponse.new(
|
80
|
-
_response, data: decoded, errors: _errors
|
81
|
-
)
|
35
|
+
new_api_call_builder
|
36
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
37
|
+
'/v2/inventory/adjustments/{adjustment_id}',
|
38
|
+
'default')
|
39
|
+
.template_param(new_parameter(adjustment_id, key: 'adjustment_id')
|
40
|
+
.should_encode(true))
|
41
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
42
|
+
.auth(Single.new('global')))
|
43
|
+
.response(new_response_handler
|
44
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
45
|
+
.is_api_response(true)
|
46
|
+
.convertor(ApiResponse.method(:create)))
|
47
|
+
.execute
|
82
48
|
end
|
83
49
|
|
84
50
|
# Deprecated version of
|
85
|
-
# [BatchChangeInventory](
|
86
|
-
# endpoint URL
|
51
|
+
# [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) after
|
52
|
+
# the endpoint URL
|
87
53
|
# is updated to conform to the standard convention.
|
88
54
|
# @param [BatchChangeInventoryRequest] body Required parameter: An object
|
89
55
|
# containing the fields to POST for the request. See the corresponding
|
@@ -92,37 +58,25 @@ module Square
|
|
92
58
|
def deprecated_batch_change_inventory(body:)
|
93
59
|
warn 'Endpoint deprecated_batch_change_inventory in InventoryApi is depr'\
|
94
60
|
'ecated'
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
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
|
-
)
|
61
|
+
new_api_call_builder
|
62
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
63
|
+
'/v2/inventory/batch-change',
|
64
|
+
'default')
|
65
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
66
|
+
.body_param(new_parameter(body))
|
67
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
68
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
69
|
+
.auth(Single.new('global')))
|
70
|
+
.response(new_response_handler
|
71
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
72
|
+
.is_api_response(true)
|
73
|
+
.convertor(ApiResponse.method(:create)))
|
74
|
+
.execute
|
121
75
|
end
|
122
76
|
|
123
77
|
# Deprecated version of
|
124
|
-
# [BatchRetrieveInventoryChanges](
|
125
|
-
# ) after the endpoint URL
|
78
|
+
# [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInvent
|
79
|
+
# oryChanges) after the endpoint URL
|
126
80
|
# is updated to conform to the standard convention.
|
127
81
|
# @param [BatchRetrieveInventoryChangesRequest] body Required parameter: An
|
128
82
|
# object containing the fields to POST for the request. See the
|
@@ -131,37 +85,25 @@ module Square
|
|
131
85
|
def deprecated_batch_retrieve_inventory_changes(body:)
|
132
86
|
warn 'Endpoint deprecated_batch_retrieve_inventory_changes in InventoryA'\
|
133
87
|
'pi is deprecated'
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
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
|
-
)
|
88
|
+
new_api_call_builder
|
89
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
90
|
+
'/v2/inventory/batch-retrieve-changes',
|
91
|
+
'default')
|
92
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
93
|
+
.body_param(new_parameter(body))
|
94
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
95
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
96
|
+
.auth(Single.new('global')))
|
97
|
+
.response(new_response_handler
|
98
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
99
|
+
.is_api_response(true)
|
100
|
+
.convertor(ApiResponse.method(:create)))
|
101
|
+
.execute
|
160
102
|
end
|
161
103
|
|
162
104
|
# Deprecated version of
|
163
|
-
# [BatchRetrieveInventoryCounts](
|
164
|
-
# after the endpoint URL
|
105
|
+
# [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInvento
|
106
|
+
# ryCounts) after the endpoint URL
|
165
107
|
# is updated to conform to the standard convention.
|
166
108
|
# @param [BatchRetrieveInventoryCountsRequest] body Required parameter: An
|
167
109
|
# object containing the fields to POST for the request. See the
|
@@ -170,32 +112,20 @@ module Square
|
|
170
112
|
def deprecated_batch_retrieve_inventory_counts(body:)
|
171
113
|
warn 'Endpoint deprecated_batch_retrieve_inventory_counts in InventoryAp'\
|
172
114
|
'i is deprecated'
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
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
|
-
)
|
115
|
+
new_api_call_builder
|
116
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
117
|
+
'/v2/inventory/batch-retrieve-counts',
|
118
|
+
'default')
|
119
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
120
|
+
.body_param(new_parameter(body))
|
121
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
122
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
123
|
+
.auth(Single.new('global')))
|
124
|
+
.response(new_response_handler
|
125
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
126
|
+
.is_api_response(true)
|
127
|
+
.convertor(ApiResponse.method(:create)))
|
128
|
+
.execute
|
199
129
|
end
|
200
130
|
|
201
131
|
# Applies adjustments and counts to the provided item quantities.
|
@@ -207,32 +137,20 @@ module Square
|
|
207
137
|
# object definition for field details.
|
208
138
|
# @return [BatchChangeInventoryResponse Hash] response from the API call
|
209
139
|
def batch_change_inventory(body:)
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
headers: _headers,
|
225
|
-
parameters: body.to_json
|
226
|
-
)
|
227
|
-
OAuth2.apply(config, _request)
|
228
|
-
_response = execute_request(_request)
|
229
|
-
|
230
|
-
# Return appropriate response type.
|
231
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
232
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
233
|
-
ApiResponse.new(
|
234
|
-
_response, data: decoded, errors: _errors
|
235
|
-
)
|
140
|
+
new_api_call_builder
|
141
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
142
|
+
'/v2/inventory/changes/batch-create',
|
143
|
+
'default')
|
144
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
145
|
+
.body_param(new_parameter(body))
|
146
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
147
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
148
|
+
.auth(Single.new('global')))
|
149
|
+
.response(new_response_handler
|
150
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
151
|
+
.is_api_response(true)
|
152
|
+
.convertor(ApiResponse.method(:create)))
|
153
|
+
.execute
|
236
154
|
end
|
237
155
|
|
238
156
|
# Returns historical physical counts and adjustments based on the
|
@@ -246,32 +164,20 @@ module Square
|
|
246
164
|
# corresponding object definition for field details.
|
247
165
|
# @return [BatchRetrieveInventoryChangesResponse Hash] response from the API call
|
248
166
|
def batch_retrieve_inventory_changes(body:)
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
headers: _headers,
|
264
|
-
parameters: body.to_json
|
265
|
-
)
|
266
|
-
OAuth2.apply(config, _request)
|
267
|
-
_response = execute_request(_request)
|
268
|
-
|
269
|
-
# Return appropriate response type.
|
270
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
271
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
272
|
-
ApiResponse.new(
|
273
|
-
_response, data: decoded, errors: _errors
|
274
|
-
)
|
167
|
+
new_api_call_builder
|
168
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
169
|
+
'/v2/inventory/changes/batch-retrieve',
|
170
|
+
'default')
|
171
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
172
|
+
.body_param(new_parameter(body))
|
173
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
174
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
175
|
+
.auth(Single.new('global')))
|
176
|
+
.response(new_response_handler
|
177
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
178
|
+
.is_api_response(true)
|
179
|
+
.convertor(ApiResponse.method(:create)))
|
180
|
+
.execute
|
275
181
|
end
|
276
182
|
|
277
183
|
# Returns current counts for the provided
|
@@ -289,144 +195,87 @@ module Square
|
|
289
195
|
# corresponding object definition for field details.
|
290
196
|
# @return [BatchRetrieveInventoryCountsResponse Hash] response from the API call
|
291
197
|
def batch_retrieve_inventory_counts(body:)
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
headers: _headers,
|
307
|
-
parameters: body.to_json
|
308
|
-
)
|
309
|
-
OAuth2.apply(config, _request)
|
310
|
-
_response = execute_request(_request)
|
311
|
-
|
312
|
-
# Return appropriate response type.
|
313
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
314
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
315
|
-
ApiResponse.new(
|
316
|
-
_response, data: decoded, errors: _errors
|
317
|
-
)
|
198
|
+
new_api_call_builder
|
199
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
200
|
+
'/v2/inventory/counts/batch-retrieve',
|
201
|
+
'default')
|
202
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
203
|
+
.body_param(new_parameter(body))
|
204
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
205
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
206
|
+
.auth(Single.new('global')))
|
207
|
+
.response(new_response_handler
|
208
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
209
|
+
.is_api_response(true)
|
210
|
+
.convertor(ApiResponse.method(:create)))
|
211
|
+
.execute
|
318
212
|
end
|
319
213
|
|
320
214
|
# Deprecated version of
|
321
|
-
# [RetrieveInventoryPhysicalCount](
|
322
|
-
#
|
215
|
+
# [RetrieveInventoryPhysicalCount](api-endpoint:Inventory-RetrieveInventoryP
|
216
|
+
# hysicalCount) after the endpoint URL
|
323
217
|
# is updated to conform to the standard convention.
|
324
218
|
# @param [String] physical_count_id Required parameter: ID of the
|
325
|
-
# [InventoryPhysicalCount](
|
219
|
+
# [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
|
326
220
|
# @return [RetrieveInventoryPhysicalCountResponse Hash] response from the API call
|
327
221
|
def deprecated_retrieve_inventory_physical_count(physical_count_id:)
|
328
222
|
warn 'Endpoint deprecated_retrieve_inventory_physical_count in Inventory'\
|
329
223
|
'Api is deprecated'
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
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
|
-
)
|
224
|
+
new_api_call_builder
|
225
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
226
|
+
'/v2/inventory/physical-count/{physical_count_id}',
|
227
|
+
'default')
|
228
|
+
.template_param(new_parameter(physical_count_id, key: 'physical_count_id')
|
229
|
+
.should_encode(true))
|
230
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
231
|
+
.auth(Single.new('global')))
|
232
|
+
.response(new_response_handler
|
233
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
234
|
+
.is_api_response(true)
|
235
|
+
.convertor(ApiResponse.method(:create)))
|
236
|
+
.execute
|
358
237
|
end
|
359
238
|
|
360
239
|
# Returns the [InventoryPhysicalCount]($m/InventoryPhysicalCount)
|
361
240
|
# object with the provided `physical_count_id`.
|
362
241
|
# @param [String] physical_count_id Required parameter: ID of the
|
363
|
-
# [InventoryPhysicalCount](
|
242
|
+
# [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
|
364
243
|
# @return [RetrieveInventoryPhysicalCountResponse Hash] response from the API call
|
365
244
|
def retrieve_inventory_physical_count(physical_count_id:)
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
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
|
-
)
|
245
|
+
new_api_call_builder
|
246
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
247
|
+
'/v2/inventory/physical-counts/{physical_count_id}',
|
248
|
+
'default')
|
249
|
+
.template_param(new_parameter(physical_count_id, key: 'physical_count_id')
|
250
|
+
.should_encode(true))
|
251
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
252
|
+
.auth(Single.new('global')))
|
253
|
+
.response(new_response_handler
|
254
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
255
|
+
.is_api_response(true)
|
256
|
+
.convertor(ApiResponse.method(:create)))
|
257
|
+
.execute
|
394
258
|
end
|
395
259
|
|
396
260
|
# Returns the [InventoryTransfer]($m/InventoryTransfer) object
|
397
261
|
# with the provided `transfer_id`.
|
398
262
|
# @param [String] transfer_id Required parameter: ID of the
|
399
|
-
# [InventoryTransfer](
|
263
|
+
# [InventoryTransfer](entity:InventoryTransfer) to retrieve.
|
400
264
|
# @return [RetrieveInventoryTransferResponse Hash] response from the API call
|
401
265
|
def retrieve_inventory_transfer(transfer_id:)
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
# Prepare and execute HttpRequest.
|
417
|
-
_request = config.http_client.get(
|
418
|
-
_query_url,
|
419
|
-
headers: _headers
|
420
|
-
)
|
421
|
-
OAuth2.apply(config, _request)
|
422
|
-
_response = execute_request(_request)
|
423
|
-
|
424
|
-
# Return appropriate response type.
|
425
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
426
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
427
|
-
ApiResponse.new(
|
428
|
-
_response, data: decoded, errors: _errors
|
429
|
-
)
|
266
|
+
new_api_call_builder
|
267
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
268
|
+
'/v2/inventory/transfers/{transfer_id}',
|
269
|
+
'default')
|
270
|
+
.template_param(new_parameter(transfer_id, key: 'transfer_id')
|
271
|
+
.should_encode(true))
|
272
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
273
|
+
.auth(Single.new('global')))
|
274
|
+
.response(new_response_handler
|
275
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
276
|
+
.is_api_response(true)
|
277
|
+
.convertor(ApiResponse.method(:create)))
|
278
|
+
.execute
|
430
279
|
end
|
431
280
|
|
432
281
|
# Retrieves the current calculated stock count for a given
|
@@ -434,10 +283,10 @@ module Square
|
|
434
283
|
# [Location]($m/Location)s. Responses are paginated and unsorted.
|
435
284
|
# For more sophisticated queries, use a batch endpoint.
|
436
285
|
# @param [String] catalog_object_id Required parameter: ID of the
|
437
|
-
# [CatalogObject](
|
286
|
+
# [CatalogObject](entity:CatalogObject) to retrieve.
|
438
287
|
# @param [String] location_ids Optional parameter: The
|
439
|
-
# [Location](
|
440
|
-
# list queries all locations.
|
288
|
+
# [Location](entity:Location) IDs to look up as a comma-separated list. An
|
289
|
+
# empty list queries all locations.
|
441
290
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
442
291
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
443
292
|
# results for the original query. See the
|
@@ -447,47 +296,29 @@ module Square
|
|
447
296
|
def retrieve_inventory_count(catalog_object_id:,
|
448
297
|
location_ids: nil,
|
449
298
|
cursor: nil)
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
_headers = {
|
466
|
-
'accept' => 'application/json'
|
467
|
-
}
|
468
|
-
|
469
|
-
# Prepare and execute HttpRequest.
|
470
|
-
_request = config.http_client.get(
|
471
|
-
_query_url,
|
472
|
-
headers: _headers
|
473
|
-
)
|
474
|
-
OAuth2.apply(config, _request)
|
475
|
-
_response = execute_request(_request)
|
476
|
-
|
477
|
-
# Return appropriate response type.
|
478
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
479
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
480
|
-
ApiResponse.new(
|
481
|
-
_response, data: decoded, errors: _errors
|
482
|
-
)
|
299
|
+
new_api_call_builder
|
300
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
301
|
+
'/v2/inventory/{catalog_object_id}',
|
302
|
+
'default')
|
303
|
+
.template_param(new_parameter(catalog_object_id, key: 'catalog_object_id')
|
304
|
+
.should_encode(true))
|
305
|
+
.query_param(new_parameter(location_ids, key: 'location_ids'))
|
306
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
307
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
308
|
+
.auth(Single.new('global')))
|
309
|
+
.response(new_response_handler
|
310
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
311
|
+
.is_api_response(true)
|
312
|
+
.convertor(ApiResponse.method(:create)))
|
313
|
+
.execute
|
483
314
|
end
|
484
315
|
|
485
316
|
# Returns a set of physical counts and inventory adjustments for the
|
486
|
-
# provided [CatalogObject](
|
487
|
-
# [Location](
|
317
|
+
# provided [CatalogObject](entity:CatalogObject) at the requested
|
318
|
+
# [Location](entity:Location)s.
|
488
319
|
# You can achieve the same result by calling
|
489
|
-
# [BatchRetrieveInventoryChanges](
|
490
|
-
# )
|
320
|
+
# [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInvent
|
321
|
+
# oryChanges)
|
491
322
|
# and having the `catalog_object_ids` list contain a single element of the
|
492
323
|
# `CatalogObject` ID.
|
493
324
|
# Results are paginated and sorted in descending order according to their
|
@@ -497,10 +328,10 @@ module Square
|
|
497
328
|
# used to display recent changes for a specific item. For more
|
498
329
|
# sophisticated queries, use a batch endpoint.
|
499
330
|
# @param [String] catalog_object_id Required parameter: ID of the
|
500
|
-
# [CatalogObject](
|
331
|
+
# [CatalogObject](entity:CatalogObject) to retrieve.
|
501
332
|
# @param [String] location_ids Optional parameter: The
|
502
|
-
# [Location](
|
503
|
-
# list queries all locations.
|
333
|
+
# [Location](entity:Location) IDs to look up as a comma-separated list. An
|
334
|
+
# empty list queries all locations.
|
504
335
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
505
336
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
506
337
|
# results for the original query. See the
|
@@ -511,39 +342,21 @@ module Square
|
|
511
342
|
location_ids: nil,
|
512
343
|
cursor: nil)
|
513
344
|
warn 'Endpoint retrieve_inventory_changes in InventoryApi is deprecated'
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
_headers = {
|
530
|
-
'accept' => 'application/json'
|
531
|
-
}
|
532
|
-
|
533
|
-
# Prepare and execute HttpRequest.
|
534
|
-
_request = config.http_client.get(
|
535
|
-
_query_url,
|
536
|
-
headers: _headers
|
537
|
-
)
|
538
|
-
OAuth2.apply(config, _request)
|
539
|
-
_response = execute_request(_request)
|
540
|
-
|
541
|
-
# Return appropriate response type.
|
542
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
543
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
544
|
-
ApiResponse.new(
|
545
|
-
_response, data: decoded, errors: _errors
|
546
|
-
)
|
345
|
+
new_api_call_builder
|
346
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
347
|
+
'/v2/inventory/{catalog_object_id}/changes',
|
348
|
+
'default')
|
349
|
+
.template_param(new_parameter(catalog_object_id, key: 'catalog_object_id')
|
350
|
+
.should_encode(true))
|
351
|
+
.query_param(new_parameter(location_ids, key: 'location_ids'))
|
352
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
353
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
354
|
+
.auth(Single.new('global')))
|
355
|
+
.response(new_response_handler
|
356
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
357
|
+
.is_api_response(true)
|
358
|
+
.convertor(ApiResponse.method(:create)))
|
359
|
+
.execute
|
547
360
|
end
|
548
361
|
end
|
549
362
|
end
|