square.rb 6.3.0.20200826 → 8.1.0.20210121
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +34 -31
- data/lib/square.rb +61 -61
- data/lib/square/api/apple_pay_api.rb +5 -3
- data/lib/square/api/bank_accounts_api.rb +16 -19
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/bookings_api.rb +308 -0
- data/lib/square/api/cash_drawers_api.rb +13 -6
- data/lib/square/api/catalog_api.rb +71 -35
- data/lib/square/api/checkout_api.rb +4 -2
- data/lib/square/api/customer_groups_api.rb +18 -8
- data/lib/square/api/customer_segments_api.rb +9 -5
- data/lib/square/api/customers_api.rb +47 -27
- data/lib/square/api/devices_api.rb +17 -6
- data/lib/square/api/disputes_api.rb +71 -68
- data/lib/square/api/employees_api.rb +7 -3
- data/lib/square/api/inventory_api.rb +27 -13
- data/lib/square/api/invoices_api.rb +44 -40
- data/lib/square/api/labor_api.rb +57 -25
- data/lib/square/api/locations_api.rb +16 -13
- data/lib/square/api/loyalty_api.rb +60 -66
- data/lib/square/api/merchants_api.rb +7 -3
- data/lib/square/api/mobile_authorization_api.rb +5 -3
- data/lib/square/api/o_auth_api.rb +11 -8
- data/lib/square/api/orders_api.rb +55 -16
- data/lib/square/api/payments_api.rb +75 -65
- data/lib/square/api/refunds_api.rb +37 -27
- data/lib/square/api/subscriptions_api.rb +26 -14
- data/lib/square/api/team_api.rb +46 -30
- data/lib/square/api/terminal_api.rb +156 -7
- data/lib/square/api/transactions_api.rb +32 -18
- data/lib/square/api/v1_employees_api.rb +59 -33
- data/lib/square/api/v1_items_api.rb +195 -115
- data/lib/square/api/v1_transactions_api.rb +49 -27
- data/lib/square/api_helper.rb +14 -9
- data/lib/square/client.rb +8 -8
- data/lib/square/configuration.rb +2 -2
- data/lib/square/http/api_response.rb +2 -0
- data/lib/square/http/faraday_client.rb +9 -2
- 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 +22 -33
- 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 +0 -5
- metadata +33 -15
- data/lib/square/api/v1_locations_api.rb +0 -65
@@ -16,10 +16,14 @@ module Square
|
|
16
16
|
# @param [ProductType] product_type Optional parameter: If specified, only
|
17
17
|
# returns DeviceCodes targeting the specified product type. Returns
|
18
18
|
# DeviceCodes of all product types if empty.
|
19
|
+
# @param [DeviceCodeStatus] status Optional parameter: If specified, returns
|
20
|
+
# DeviceCodes with the specified statuses. Returns DeviceCodes of status
|
21
|
+
# `PAIRED` and `UNPAIRED` if empty.
|
19
22
|
# @return [ListDeviceCodesResponse Hash] response from the API call
|
20
23
|
def list_device_codes(cursor: nil,
|
21
24
|
location_id: nil,
|
22
|
-
product_type: nil
|
25
|
+
product_type: nil,
|
26
|
+
status: nil)
|
23
27
|
# Prepare query url.
|
24
28
|
_query_builder = config.get_base_uri
|
25
29
|
_query_builder << '/v2/devices/codes'
|
@@ -27,7 +31,8 @@ module Square
|
|
27
31
|
_query_builder,
|
28
32
|
'cursor' => cursor,
|
29
33
|
'location_id' => location_id,
|
30
|
-
'product_type' => product_type
|
34
|
+
'product_type' => product_type,
|
35
|
+
'status' => status
|
31
36
|
)
|
32
37
|
_query_url = APIHelper.clean_url _query_builder
|
33
38
|
|
@@ -47,7 +52,9 @@ module Square
|
|
47
52
|
# Return appropriate response type.
|
48
53
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
49
54
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
50
|
-
ApiResponse.new(
|
55
|
+
ApiResponse.new(
|
56
|
+
_response, data: decoded, errors: _errors
|
57
|
+
)
|
51
58
|
end
|
52
59
|
|
53
60
|
# Creates a DeviceCode that can be used to login to a Square Terminal device
|
@@ -81,7 +88,9 @@ module Square
|
|
81
88
|
# Return appropriate response type.
|
82
89
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
83
90
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
84
|
-
ApiResponse.new(
|
91
|
+
ApiResponse.new(
|
92
|
+
_response, data: decoded, errors: _errors
|
93
|
+
)
|
85
94
|
end
|
86
95
|
|
87
96
|
# Retrieves DeviceCode with the associated ID.
|
@@ -94,7 +103,7 @@ module Square
|
|
94
103
|
_query_builder << '/v2/devices/codes/{id}'
|
95
104
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
96
105
|
_query_builder,
|
97
|
-
'id' => id
|
106
|
+
'id' => { 'value' => id, 'encode' => true }
|
98
107
|
)
|
99
108
|
_query_url = APIHelper.clean_url _query_builder
|
100
109
|
|
@@ -114,7 +123,9 @@ module Square
|
|
114
123
|
# Return appropriate response type.
|
115
124
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
116
125
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
117
|
-
ApiResponse.new(
|
126
|
+
ApiResponse.new(
|
127
|
+
_response, data: decoded, errors: _errors
|
128
|
+
)
|
118
129
|
end
|
119
130
|
end
|
120
131
|
end
|
@@ -5,20 +5,19 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Returns a list of disputes associated
|
9
|
-
# with a particular account.
|
8
|
+
# Returns a list of disputes associated with a particular account.
|
10
9
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
11
|
-
# a previous call to this endpoint. Provide this to retrieve the next
|
12
|
-
# results for the original query. For more information, see
|
13
|
-
# [
|
10
|
+
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
11
|
+
# set of results for the original query. For more information, see
|
12
|
+
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
14
13
|
# .
|
15
14
|
# @param [DisputeState] states Optional parameter: The dispute states to
|
16
15
|
# filter the result. If not specified, the endpoint returns all open
|
17
|
-
# disputes (dispute status is not `INQUIRY_CLOSED`, `WON`, or `LOST`).
|
16
|
+
# disputes (the dispute status is not `INQUIRY_CLOSED`, `WON`, or `LOST`).
|
18
17
|
# @param [String] location_id Optional parameter: The ID of the location for
|
19
|
-
# which to return
|
20
|
-
#
|
21
|
-
#
|
18
|
+
# which to return a list of disputes. If not specified, the endpoint returns
|
19
|
+
# all open disputes (the dispute status is not `INQUIRY_CLOSED`, `WON`, or
|
20
|
+
# `LOST`) associated with all locations.
|
22
21
|
# @return [ListDisputesResponse Hash] response from the API call
|
23
22
|
def list_disputes(cursor: nil,
|
24
23
|
states: nil,
|
@@ -50,10 +49,12 @@ module Square
|
|
50
49
|
# Return appropriate response type.
|
51
50
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
52
51
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
53
|
-
ApiResponse.new(
|
52
|
+
ApiResponse.new(
|
53
|
+
_response, data: decoded, errors: _errors
|
54
|
+
)
|
54
55
|
end
|
55
56
|
|
56
|
-
# Returns details
|
57
|
+
# Returns details about a specific dispute.
|
57
58
|
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
58
59
|
# want more details about.
|
59
60
|
# @return [RetrieveDisputeResponse Hash] response from the API call
|
@@ -63,7 +64,7 @@ module Square
|
|
63
64
|
_query_builder << '/v2/disputes/{dispute_id}'
|
64
65
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
65
66
|
_query_builder,
|
66
|
-
'dispute_id' => dispute_id
|
67
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
67
68
|
)
|
68
69
|
_query_url = APIHelper.clean_url _query_builder
|
69
70
|
|
@@ -83,20 +84,19 @@ module Square
|
|
83
84
|
# Return appropriate response type.
|
84
85
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
85
86
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
86
|
-
ApiResponse.new(
|
87
|
+
ApiResponse.new(
|
88
|
+
_response, data: decoded, errors: _errors
|
89
|
+
)
|
87
90
|
end
|
88
91
|
|
89
|
-
# Accepts loss on a dispute. Square returns
|
90
|
-
#
|
91
|
-
# dispute state to ACCEPTED.
|
92
|
-
# Square debits the disputed amount from the seller’s Square
|
93
|
-
#
|
94
|
-
# sufficient funds, Square debits the associated bank account.
|
95
|
-
#
|
96
|
-
#
|
97
|
-
# .
|
98
|
-
# @param [String] dispute_id Required parameter: ID of the dispute you want
|
99
|
-
# to accept.
|
92
|
+
# Accepts the loss on a dispute. Square returns the disputed amount to the
|
93
|
+
# cardholder and
|
94
|
+
# updates the dispute state to ACCEPTED.
|
95
|
+
# Square debits the disputed amount from the seller’s Square account. If the
|
96
|
+
# Square account
|
97
|
+
# does not have sufficient funds, Square debits the associated bank account.
|
98
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
99
|
+
# want to accept.
|
100
100
|
# @return [AcceptDisputeResponse Hash] response from the API call
|
101
101
|
def accept_dispute(dispute_id:)
|
102
102
|
# Prepare query url.
|
@@ -104,7 +104,7 @@ module Square
|
|
104
104
|
_query_builder << '/v2/disputes/{dispute_id}/accept'
|
105
105
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
106
106
|
_query_builder,
|
107
|
-
'dispute_id' => dispute_id
|
107
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
108
108
|
)
|
109
109
|
_query_url = APIHelper.clean_url _query_builder
|
110
110
|
|
@@ -124,7 +124,9 @@ module Square
|
|
124
124
|
# Return appropriate response type.
|
125
125
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
126
126
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
127
|
-
ApiResponse.new(
|
127
|
+
ApiResponse.new(
|
128
|
+
_response, data: decoded, errors: _errors
|
129
|
+
)
|
128
130
|
end
|
129
131
|
|
130
132
|
# Returns a list of evidence associated with a dispute.
|
@@ -136,7 +138,7 @@ module Square
|
|
136
138
|
_query_builder << '/v2/disputes/{dispute_id}/evidence'
|
137
139
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
138
140
|
_query_builder,
|
139
|
-
'dispute_id' => dispute_id
|
141
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
140
142
|
)
|
141
143
|
_query_url = APIHelper.clean_url _query_builder
|
142
144
|
|
@@ -156,12 +158,14 @@ module Square
|
|
156
158
|
# Return appropriate response type.
|
157
159
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
158
160
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
159
|
-
ApiResponse.new(
|
161
|
+
ApiResponse.new(
|
162
|
+
_response, data: decoded, errors: _errors
|
163
|
+
)
|
160
164
|
end
|
161
165
|
|
162
166
|
# Removes specified evidence from a dispute.
|
163
|
-
# Square does not send the bank any evidence that
|
164
|
-
#
|
167
|
+
# Square does not send the bank any evidence that is removed. Also, you
|
168
|
+
# cannot remove evidence after
|
165
169
|
# submitting it to the bank using
|
166
170
|
# [SubmitEvidence](https://developer.squareup.com/docs/reference/square/disp
|
167
171
|
# utes-api/submit-evidence).
|
@@ -177,8 +181,8 @@ module Square
|
|
177
181
|
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
178
182
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
179
183
|
_query_builder,
|
180
|
-
'dispute_id' => dispute_id,
|
181
|
-
'evidence_id' => evidence_id
|
184
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true },
|
185
|
+
'evidence_id' => { 'value' => evidence_id, 'encode' => true }
|
182
186
|
)
|
183
187
|
_query_url = APIHelper.clean_url _query_builder
|
184
188
|
|
@@ -198,13 +202,15 @@ module Square
|
|
198
202
|
# Return appropriate response type.
|
199
203
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
200
204
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
201
|
-
ApiResponse.new(
|
205
|
+
ApiResponse.new(
|
206
|
+
_response, data: decoded, errors: _errors
|
207
|
+
)
|
202
208
|
end
|
203
209
|
|
204
210
|
# Returns the specific evidence metadata associated with a specific dispute.
|
205
211
|
# You must maintain a copy of the evidence you upload if you want to
|
206
|
-
# reference it later. You cannot
|
207
|
-
# after you upload it.
|
212
|
+
# reference it later. You cannot
|
213
|
+
# download the evidence after you upload it.
|
208
214
|
# @param [String] dispute_id Required parameter: The ID of the dispute that
|
209
215
|
# you want to retrieve evidence from.
|
210
216
|
# @param [String] evidence_id Required parameter: The ID of the evidence to
|
@@ -217,8 +223,8 @@ module Square
|
|
217
223
|
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
218
224
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
219
225
|
_query_builder,
|
220
|
-
'dispute_id' => dispute_id,
|
221
|
-
'evidence_id' => evidence_id
|
226
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true },
|
227
|
+
'evidence_id' => { 'value' => evidence_id, 'encode' => true }
|
222
228
|
)
|
223
229
|
_query_url = APIHelper.clean_url _query_builder
|
224
230
|
|
@@ -238,20 +244,19 @@ module Square
|
|
238
244
|
# Return appropriate response type.
|
239
245
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
240
246
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
241
|
-
ApiResponse.new(
|
247
|
+
ApiResponse.new(
|
248
|
+
_response, data: decoded, errors: _errors
|
249
|
+
)
|
242
250
|
end
|
243
251
|
|
244
252
|
# Uploads a file to use as evidence in a dispute challenge. The endpoint
|
245
|
-
# accepts
|
246
|
-
#
|
247
|
-
#
|
248
|
-
#
|
249
|
-
#
|
250
|
-
# putes#challenge-a-dispute).
|
251
|
-
# @param [String] dispute_id Required parameter: ID of the dispute you want
|
252
|
-
# to upload evidence for.
|
253
|
+
# accepts HTTP
|
254
|
+
# multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF
|
255
|
+
# formats.
|
256
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
257
|
+
# want to upload evidence for.
|
253
258
|
# @param [CreateDisputeEvidenceFileRequest] request Optional parameter:
|
254
|
-
# Defines parameters for a CreateDisputeEvidenceFile request.
|
259
|
+
# Defines the parameters for a `CreateDisputeEvidenceFile` request.
|
255
260
|
# @param [File | UploadIO] image_file Optional parameter: Example:
|
256
261
|
# @return [CreateDisputeEvidenceFileResponse Hash] response from the API call
|
257
262
|
def create_dispute_evidence_file(dispute_id:,
|
@@ -262,7 +267,7 @@ module Square
|
|
262
267
|
_query_builder << '/v2/disputes/{dispute_id}/evidence_file'
|
263
268
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
264
269
|
_query_builder,
|
265
|
-
'dispute_id' => dispute_id
|
270
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
266
271
|
)
|
267
272
|
_query_url = APIHelper.clean_url _query_builder
|
268
273
|
|
@@ -304,14 +309,12 @@ module Square
|
|
304
309
|
# Return appropriate response type.
|
305
310
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
306
311
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
307
|
-
ApiResponse.new(
|
312
|
+
ApiResponse.new(
|
313
|
+
_response, data: decoded, errors: _errors
|
314
|
+
)
|
308
315
|
end
|
309
316
|
|
310
|
-
# Uploads text to use as evidence for a dispute challenge.
|
311
|
-
# information, see
|
312
|
-
# [Challenge a
|
313
|
-
# Dispute](https://developer.squareup.com/docs/docs/disputes-api/process-dis
|
314
|
-
# putes#challenge-a-dispute).
|
317
|
+
# Uploads text to use as evidence for a dispute challenge.
|
315
318
|
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
316
319
|
# want to upload evidence for.
|
317
320
|
# @param [CreateDisputeEvidenceTextRequest] body Required parameter: An
|
@@ -325,7 +328,7 @@ module Square
|
|
325
328
|
_query_builder << '/v2/disputes/{dispute_id}/evidence_text'
|
326
329
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
327
330
|
_query_builder,
|
328
|
-
'dispute_id' => dispute_id
|
331
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
329
332
|
)
|
330
333
|
_query_url = APIHelper.clean_url _query_builder
|
331
334
|
|
@@ -347,24 +350,22 @@ module Square
|
|
347
350
|
# Return appropriate response type.
|
348
351
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
349
352
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
350
|
-
ApiResponse.new(
|
353
|
+
ApiResponse.new(
|
354
|
+
_response, data: decoded, errors: _errors
|
355
|
+
)
|
351
356
|
end
|
352
357
|
|
353
358
|
# Submits evidence to the cardholder's bank.
|
354
359
|
# Before submitting evidence, Square compiles all available evidence. This
|
355
|
-
# includes
|
356
|
-
#
|
360
|
+
# includes evidence uploaded
|
361
|
+
# using the
|
357
362
|
# [CreateDisputeEvidenceFile](https://developer.squareup.com/docs/reference/
|
358
363
|
# square/disputes-api/create-dispute-evidence-file) and
|
359
364
|
# [CreateDisputeEvidenceText](https://developer.squareup.com/docs/reference/
|
360
|
-
# square/disputes-api/create-dispute-evidence-text) endpoints
|
361
|
-
#
|
362
|
-
#
|
363
|
-
#
|
364
|
-
# Dispute](https://developer.squareup.com/docs/docs/disputes-api/process-dis
|
365
|
-
# putes#challenge-a-dispute).
|
366
|
-
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
367
|
-
# want to submit evidence for.
|
365
|
+
# square/disputes-api/create-dispute-evidence-text) endpoints and
|
366
|
+
# evidence automatically provided by Square, when available.
|
367
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute that
|
368
|
+
# you want to submit evidence for.
|
368
369
|
# @return [SubmitEvidenceResponse Hash] response from the API call
|
369
370
|
def submit_evidence(dispute_id:)
|
370
371
|
# Prepare query url.
|
@@ -372,7 +373,7 @@ module Square
|
|
372
373
|
_query_builder << '/v2/disputes/{dispute_id}/submit-evidence'
|
373
374
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
374
375
|
_query_builder,
|
375
|
-
'dispute_id' => dispute_id
|
376
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
376
377
|
)
|
377
378
|
_query_url = APIHelper.clean_url _query_builder
|
378
379
|
|
@@ -392,7 +393,9 @@ module Square
|
|
392
393
|
# Return appropriate response type.
|
393
394
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
394
395
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
395
|
-
ApiResponse.new(
|
396
|
+
ApiResponse.new(
|
397
|
+
_response, data: decoded, errors: _errors
|
398
|
+
)
|
396
399
|
end
|
397
400
|
end
|
398
401
|
end
|
@@ -47,7 +47,9 @@ module Square
|
|
47
47
|
# Return appropriate response type.
|
48
48
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
49
49
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
50
|
-
ApiResponse.new(
|
50
|
+
ApiResponse.new(
|
51
|
+
_response, data: decoded, errors: _errors
|
52
|
+
)
|
51
53
|
end
|
52
54
|
|
53
55
|
# RetrieveEmployee
|
@@ -61,7 +63,7 @@ module Square
|
|
61
63
|
_query_builder << '/v2/employees/{id}'
|
62
64
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
63
65
|
_query_builder,
|
64
|
-
'id' => id
|
66
|
+
'id' => { 'value' => id, 'encode' => true }
|
65
67
|
)
|
66
68
|
_query_url = APIHelper.clean_url _query_builder
|
67
69
|
|
@@ -81,7 +83,9 @@ module Square
|
|
81
83
|
# Return appropriate response type.
|
82
84
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
83
85
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
84
|
-
ApiResponse.new(
|
86
|
+
ApiResponse.new(
|
87
|
+
_response, data: decoded, errors: _errors
|
88
|
+
)
|
85
89
|
end
|
86
90
|
end
|
87
91
|
end
|
@@ -16,7 +16,7 @@ module Square
|
|
16
16
|
_query_builder << '/v2/inventory/adjustment/{adjustment_id}'
|
17
17
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
18
18
|
_query_builder,
|
19
|
-
'adjustment_id' => adjustment_id
|
19
|
+
'adjustment_id' => { 'value' => adjustment_id, 'encode' => true }
|
20
20
|
)
|
21
21
|
_query_url = APIHelper.clean_url _query_builder
|
22
22
|
|
@@ -36,7 +36,9 @@ module Square
|
|
36
36
|
# Return appropriate response type.
|
37
37
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
38
38
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
39
|
-
ApiResponse.new(
|
39
|
+
ApiResponse.new(
|
40
|
+
_response, data: decoded, errors: _errors
|
41
|
+
)
|
40
42
|
end
|
41
43
|
|
42
44
|
# Applies adjustments and counts to the provided item quantities.
|
@@ -71,7 +73,9 @@ module Square
|
|
71
73
|
# Return appropriate response type.
|
72
74
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
73
75
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
74
|
-
ApiResponse.new(
|
76
|
+
ApiResponse.new(
|
77
|
+
_response, data: decoded, errors: _errors
|
78
|
+
)
|
75
79
|
end
|
76
80
|
|
77
81
|
# Returns historical physical counts and adjustments based on the
|
@@ -108,7 +112,9 @@ module Square
|
|
108
112
|
# Return appropriate response type.
|
109
113
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
110
114
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
111
|
-
ApiResponse.new(
|
115
|
+
ApiResponse.new(
|
116
|
+
_response, data: decoded, errors: _errors
|
117
|
+
)
|
112
118
|
end
|
113
119
|
|
114
120
|
# Returns current counts for the provided
|
@@ -149,7 +155,9 @@ module Square
|
|
149
155
|
# Return appropriate response type.
|
150
156
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
151
157
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
152
|
-
ApiResponse.new(
|
158
|
+
ApiResponse.new(
|
159
|
+
_response, data: decoded, errors: _errors
|
160
|
+
)
|
153
161
|
end
|
154
162
|
|
155
163
|
# Returns the [InventoryPhysicalCount](#type-inventoryphysicalcount)
|
@@ -163,7 +171,7 @@ module Square
|
|
163
171
|
_query_builder << '/v2/inventory/physical-count/{physical_count_id}'
|
164
172
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
165
173
|
_query_builder,
|
166
|
-
'physical_count_id' => physical_count_id
|
174
|
+
'physical_count_id' => { 'value' => physical_count_id, 'encode' => true }
|
167
175
|
)
|
168
176
|
_query_url = APIHelper.clean_url _query_builder
|
169
177
|
|
@@ -183,7 +191,9 @@ module Square
|
|
183
191
|
# Return appropriate response type.
|
184
192
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
185
193
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
186
|
-
ApiResponse.new(
|
194
|
+
ApiResponse.new(
|
195
|
+
_response, data: decoded, errors: _errors
|
196
|
+
)
|
187
197
|
end
|
188
198
|
|
189
199
|
# Retrieves the current calculated stock count for a given
|
@@ -198,8 +208,8 @@ module Square
|
|
198
208
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
199
209
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
200
210
|
# results for the original query. See the
|
201
|
-
# [Pagination](https://developer.squareup.com/docs/
|
202
|
-
#
|
211
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
212
|
+
# ion) guide for more information.
|
203
213
|
# @return [RetrieveInventoryCountResponse Hash] response from the API call
|
204
214
|
def retrieve_inventory_count(catalog_object_id:,
|
205
215
|
location_ids: nil,
|
@@ -209,7 +219,7 @@ module Square
|
|
209
219
|
_query_builder << '/v2/inventory/{catalog_object_id}'
|
210
220
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
211
221
|
_query_builder,
|
212
|
-
'catalog_object_id' => catalog_object_id
|
222
|
+
'catalog_object_id' => { 'value' => catalog_object_id, 'encode' => true }
|
213
223
|
)
|
214
224
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
215
225
|
_query_builder,
|
@@ -234,7 +244,9 @@ module Square
|
|
234
244
|
# Return appropriate response type.
|
235
245
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
236
246
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
237
|
-
ApiResponse.new(
|
247
|
+
ApiResponse.new(
|
248
|
+
_response, data: decoded, errors: _errors
|
249
|
+
)
|
238
250
|
end
|
239
251
|
|
240
252
|
# Returns a set of physical counts and inventory adjustments for the
|
@@ -265,7 +277,7 @@ module Square
|
|
265
277
|
_query_builder << '/v2/inventory/{catalog_object_id}/changes'
|
266
278
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
267
279
|
_query_builder,
|
268
|
-
'catalog_object_id' => catalog_object_id
|
280
|
+
'catalog_object_id' => { 'value' => catalog_object_id, 'encode' => true }
|
269
281
|
)
|
270
282
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
271
283
|
_query_builder,
|
@@ -290,7 +302,9 @@ module Square
|
|
290
302
|
# Return appropriate response type.
|
291
303
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
292
304
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
293
|
-
ApiResponse.new(
|
305
|
+
ApiResponse.new(
|
306
|
+
_response, data: decoded, errors: _errors
|
307
|
+
)
|
294
308
|
end
|
295
309
|
end
|
296
310
|
end
|