square.rb 6.0.0.20200625 → 6.5.0.20201028
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -30
- data/lib/square.rb +61 -60
- data/lib/square/api/apple_pay_api.rb +3 -1
- data/lib/square/api/bank_accounts_api.rb +12 -15
- data/lib/square/api/base_api.rb +2 -2
- data/lib/square/api/cash_drawers_api.rb +11 -5
- data/lib/square/api/catalog_api.rb +119 -49
- 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 +7 -3
- 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 +39 -34
- data/lib/square/api/employees_api.rb +10 -5
- data/lib/square/api/inventory_api.rb +30 -15
- data/lib/square/api/invoices_api.rb +359 -0
- data/lib/square/api/labor_api.rb +131 -22
- data/lib/square/api/locations_api.rb +20 -12
- data/lib/square/api/loyalty_api.rb +59 -65
- data/lib/square/api/merchants_api.rb +9 -4
- data/lib/square/api/mobile_authorization_api.rb +3 -1
- data/lib/square/api/o_auth_api.rb +10 -4
- data/lib/square/api/orders_api.rb +111 -90
- data/lib/square/api/payments_api.rb +75 -65
- data/lib/square/api/refunds_api.rb +21 -11
- data/lib/square/api/subscriptions_api.rb +263 -0
- data/lib/square/api/team_api.rb +32 -16
- 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 -27
- data/lib/square/api/v1_items_api.rb +195 -115
- data/lib/square/api/v1_locations_api.rb +6 -2
- data/lib/square/api/v1_transactions_api.rb +49 -27
- data/lib/square/api_helper.rb +14 -9
- data/lib/square/client.rb +23 -16
- data/lib/square/configuration.rb +12 -4
- data/lib/square/http/api_response.rb +2 -0
- data/lib/square/http/faraday_client.rb +1 -0
- 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 -14
- data/lib/square/api/reporting_api.rb +0 -138
@@ -21,7 +21,7 @@ module Square
|
|
21
21
|
_query_builder << '/v2/locations/{location_id}/checkouts'
|
22
22
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
23
23
|
_query_builder,
|
24
|
-
'location_id' => location_id
|
24
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
25
25
|
)
|
26
26
|
_query_url = APIHelper.clean_url _query_builder
|
27
27
|
|
@@ -43,7 +43,9 @@ module Square
|
|
43
43
|
# Return appropriate response type.
|
44
44
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
45
45
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
46
|
-
ApiResponse.new(
|
46
|
+
ApiResponse.new(
|
47
|
+
_response, data: decoded, errors: _errors
|
48
|
+
)
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|
@@ -38,7 +38,9 @@ module Square
|
|
38
38
|
# Return appropriate response type.
|
39
39
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
40
40
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
41
|
-
ApiResponse.new(
|
41
|
+
ApiResponse.new(
|
42
|
+
_response, data: decoded, errors: _errors
|
43
|
+
)
|
42
44
|
end
|
43
45
|
|
44
46
|
# Creates a new customer group for a business.
|
@@ -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
|
# Deletes a customer group as identified by the `group_id` value.
|
@@ -84,7 +88,7 @@ module Square
|
|
84
88
|
_query_builder << '/v2/customers/groups/{group_id}'
|
85
89
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
86
90
|
_query_builder,
|
87
|
-
'group_id' => group_id
|
91
|
+
'group_id' => { 'value' => group_id, 'encode' => true }
|
88
92
|
)
|
89
93
|
_query_url = APIHelper.clean_url _query_builder
|
90
94
|
|
@@ -104,7 +108,9 @@ module Square
|
|
104
108
|
# Return appropriate response type.
|
105
109
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
106
110
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
107
|
-
ApiResponse.new(
|
111
|
+
ApiResponse.new(
|
112
|
+
_response, data: decoded, errors: _errors
|
113
|
+
)
|
108
114
|
end
|
109
115
|
|
110
116
|
# Retrieves a specific customer group as identified by the `group_id` value.
|
@@ -117,7 +123,7 @@ module Square
|
|
117
123
|
_query_builder << '/v2/customers/groups/{group_id}'
|
118
124
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
119
125
|
_query_builder,
|
120
|
-
'group_id' => group_id
|
126
|
+
'group_id' => { 'value' => group_id, 'encode' => true }
|
121
127
|
)
|
122
128
|
_query_url = APIHelper.clean_url _query_builder
|
123
129
|
|
@@ -137,7 +143,9 @@ module Square
|
|
137
143
|
# Return appropriate response type.
|
138
144
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
139
145
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
140
|
-
ApiResponse.new(
|
146
|
+
ApiResponse.new(
|
147
|
+
_response, data: decoded, errors: _errors
|
148
|
+
)
|
141
149
|
end
|
142
150
|
|
143
151
|
# Updates a customer group as identified by the `group_id` value.
|
@@ -154,7 +162,7 @@ module Square
|
|
154
162
|
_query_builder << '/v2/customers/groups/{group_id}'
|
155
163
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
156
164
|
_query_builder,
|
157
|
-
'group_id' => group_id
|
165
|
+
'group_id' => { 'value' => group_id, 'encode' => true }
|
158
166
|
)
|
159
167
|
_query_url = APIHelper.clean_url _query_builder
|
160
168
|
|
@@ -176,7 +184,9 @@ module Square
|
|
176
184
|
# Return appropriate response type.
|
177
185
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
178
186
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
179
|
-
ApiResponse.new(
|
187
|
+
ApiResponse.new(
|
188
|
+
_response, data: decoded, errors: _errors
|
189
|
+
)
|
180
190
|
end
|
181
191
|
end
|
182
192
|
end
|
@@ -38,7 +38,9 @@ module Square
|
|
38
38
|
# Return appropriate response type.
|
39
39
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
40
40
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
41
|
-
ApiResponse.new(
|
41
|
+
ApiResponse.new(
|
42
|
+
_response, data: decoded, errors: _errors
|
43
|
+
)
|
42
44
|
end
|
43
45
|
|
44
46
|
# Retrieves a specific customer segment as identified by the `segment_id`
|
@@ -52,7 +54,7 @@ module Square
|
|
52
54
|
_query_builder << '/v2/customers/segments/{segment_id}'
|
53
55
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
54
56
|
_query_builder,
|
55
|
-
'segment_id' => segment_id
|
57
|
+
'segment_id' => { 'value' => segment_id, 'encode' => true }
|
56
58
|
)
|
57
59
|
_query_url = APIHelper.clean_url _query_builder
|
58
60
|
|
@@ -72,7 +74,9 @@ module Square
|
|
72
74
|
# Return appropriate response type.
|
73
75
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
74
76
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
75
|
-
ApiResponse.new(
|
77
|
+
ApiResponse.new(
|
78
|
+
_response, data: decoded, errors: _errors
|
79
|
+
)
|
76
80
|
end
|
77
81
|
end
|
78
82
|
end
|
@@ -10,7 +10,7 @@ module Square
|
|
10
10
|
# profiles become available
|
11
11
|
# for the listing operation in well under 30 seconds. Occasionally,
|
12
12
|
# propagation of the new or updated
|
13
|
-
# profiles can take closer to one minute or longer,
|
13
|
+
# profiles can take closer to one minute or longer, especially during
|
14
14
|
# network incidents and outages.
|
15
15
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
16
16
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
@@ -53,7 +53,9 @@ module Square
|
|
53
53
|
# Return appropriate response type.
|
54
54
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
55
55
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
56
|
-
ApiResponse.new(
|
56
|
+
ApiResponse.new(
|
57
|
+
_response, data: decoded, errors: _errors
|
58
|
+
)
|
57
59
|
end
|
58
60
|
|
59
61
|
# Creates a new customer for a business, which can have associated cards on
|
@@ -94,11 +96,13 @@ module Square
|
|
94
96
|
# Return appropriate response type.
|
95
97
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
96
98
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
97
|
-
ApiResponse.new(
|
99
|
+
ApiResponse.new(
|
100
|
+
_response, data: decoded, errors: _errors
|
101
|
+
)
|
98
102
|
end
|
99
103
|
|
100
|
-
# Searches the customer profiles associated with a Square account using
|
101
|
-
#
|
104
|
+
# Searches the customer profiles associated with a Square account using a
|
105
|
+
# supported query filter.
|
102
106
|
# Calling `SearchCustomers` without any explicit query filter returns all
|
103
107
|
# customer profiles ordered alphabetically based on `given_name` and
|
104
108
|
# `family_name`.
|
@@ -106,7 +110,7 @@ module Square
|
|
106
110
|
# profiles become available
|
107
111
|
# for the search operation in well under 30 seconds. Occasionally,
|
108
112
|
# propagation of the new or updated
|
109
|
-
# profiles can take closer to one minute or longer,
|
113
|
+
# profiles can take closer to one minute or longer, especially during
|
110
114
|
# network incidents and outages.
|
111
115
|
# @param [SearchCustomersRequest] body Required parameter: An object
|
112
116
|
# containing the fields to POST for the request. See the corresponding
|
@@ -136,7 +140,9 @@ module Square
|
|
136
140
|
# Return appropriate response type.
|
137
141
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
138
142
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
139
|
-
ApiResponse.new(
|
143
|
+
ApiResponse.new(
|
144
|
+
_response, data: decoded, errors: _errors
|
145
|
+
)
|
140
146
|
end
|
141
147
|
|
142
148
|
# Deletes a customer from a business, along with any linked cards on file.
|
@@ -153,7 +159,7 @@ module Square
|
|
153
159
|
_query_builder << '/v2/customers/{customer_id}'
|
154
160
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
155
161
|
_query_builder,
|
156
|
-
'customer_id' => customer_id
|
162
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true }
|
157
163
|
)
|
158
164
|
_query_url = APIHelper.clean_url _query_builder
|
159
165
|
|
@@ -173,7 +179,9 @@ module Square
|
|
173
179
|
# Return appropriate response type.
|
174
180
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
175
181
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
176
|
-
ApiResponse.new(
|
182
|
+
ApiResponse.new(
|
183
|
+
_response, data: decoded, errors: _errors
|
184
|
+
)
|
177
185
|
end
|
178
186
|
|
179
187
|
# Returns details for a single customer.
|
@@ -186,7 +194,7 @@ module Square
|
|
186
194
|
_query_builder << '/v2/customers/{customer_id}'
|
187
195
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
188
196
|
_query_builder,
|
189
|
-
'customer_id' => customer_id
|
197
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true }
|
190
198
|
)
|
191
199
|
_query_url = APIHelper.clean_url _query_builder
|
192
200
|
|
@@ -206,7 +214,9 @@ module Square
|
|
206
214
|
# Return appropriate response type.
|
207
215
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
208
216
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
209
|
-
ApiResponse.new(
|
217
|
+
ApiResponse.new(
|
218
|
+
_response, data: decoded, errors: _errors
|
219
|
+
)
|
210
220
|
end
|
211
221
|
|
212
222
|
# Updates the details of an existing customer. When two profiles are merged
|
@@ -216,9 +226,9 @@ module Square
|
|
216
226
|
# You cannot edit a customer's cards on file with this endpoint. To make
|
217
227
|
# changes
|
218
228
|
# to a card on file, you must delete the existing card on file with the
|
219
|
-
# [DeleteCustomerCard](#endpoint-deletecustomercard) endpoint,
|
220
|
-
# new one with the
|
221
|
-
# [CreateCustomerCard](#endpoint-createcustomercard) endpoint.
|
229
|
+
# [DeleteCustomerCard](#endpoint-Customers-deletecustomercard) endpoint,
|
230
|
+
# then create a new one with the
|
231
|
+
# [CreateCustomerCard](#endpoint-Customers-createcustomercard) endpoint.
|
222
232
|
# @param [String] customer_id Required parameter: The ID of the customer to
|
223
233
|
# update.
|
224
234
|
# @param [UpdateCustomerRequest] body Required parameter: An object
|
@@ -232,7 +242,7 @@ module Square
|
|
232
242
|
_query_builder << '/v2/customers/{customer_id}'
|
233
243
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
234
244
|
_query_builder,
|
235
|
-
'customer_id' => customer_id
|
245
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true }
|
236
246
|
)
|
237
247
|
_query_url = APIHelper.clean_url _query_builder
|
238
248
|
|
@@ -254,7 +264,9 @@ module Square
|
|
254
264
|
# Return appropriate response type.
|
255
265
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
256
266
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
257
|
-
ApiResponse.new(
|
267
|
+
ApiResponse.new(
|
268
|
+
_response, data: decoded, errors: _errors
|
269
|
+
)
|
258
270
|
end
|
259
271
|
|
260
272
|
# Adds a card on file to an existing customer.
|
@@ -275,7 +287,7 @@ module Square
|
|
275
287
|
_query_builder << '/v2/customers/{customer_id}/cards'
|
276
288
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
277
289
|
_query_builder,
|
278
|
-
'customer_id' => customer_id
|
290
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true }
|
279
291
|
)
|
280
292
|
_query_url = APIHelper.clean_url _query_builder
|
281
293
|
|
@@ -297,7 +309,9 @@ module Square
|
|
297
309
|
# Return appropriate response type.
|
298
310
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
299
311
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
300
|
-
ApiResponse.new(
|
312
|
+
ApiResponse.new(
|
313
|
+
_response, data: decoded, errors: _errors
|
314
|
+
)
|
301
315
|
end
|
302
316
|
|
303
317
|
# Removes a card on file from a customer.
|
@@ -313,8 +327,8 @@ module Square
|
|
313
327
|
_query_builder << '/v2/customers/{customer_id}/cards/{card_id}'
|
314
328
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
315
329
|
_query_builder,
|
316
|
-
'customer_id' => customer_id,
|
317
|
-
'card_id' => card_id
|
330
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true },
|
331
|
+
'card_id' => { 'value' => card_id, 'encode' => true }
|
318
332
|
)
|
319
333
|
_query_url = APIHelper.clean_url _query_builder
|
320
334
|
|
@@ -334,7 +348,9 @@ module Square
|
|
334
348
|
# Return appropriate response type.
|
335
349
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
336
350
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
337
|
-
ApiResponse.new(
|
351
|
+
ApiResponse.new(
|
352
|
+
_response, data: decoded, errors: _errors
|
353
|
+
)
|
338
354
|
end
|
339
355
|
|
340
356
|
# Removes a group membership from a customer.
|
@@ -352,8 +368,8 @@ module Square
|
|
352
368
|
_query_builder << '/v2/customers/{customer_id}/groups/{group_id}'
|
353
369
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
354
370
|
_query_builder,
|
355
|
-
'customer_id' => customer_id,
|
356
|
-
'group_id' => group_id
|
371
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true },
|
372
|
+
'group_id' => { 'value' => group_id, 'encode' => true }
|
357
373
|
)
|
358
374
|
_query_url = APIHelper.clean_url _query_builder
|
359
375
|
|
@@ -373,7 +389,9 @@ module Square
|
|
373
389
|
# Return appropriate response type.
|
374
390
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
375
391
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
376
|
-
ApiResponse.new(
|
392
|
+
ApiResponse.new(
|
393
|
+
_response, data: decoded, errors: _errors
|
394
|
+
)
|
377
395
|
end
|
378
396
|
|
379
397
|
# Adds a group membership to a customer.
|
@@ -391,8 +409,8 @@ module Square
|
|
391
409
|
_query_builder << '/v2/customers/{customer_id}/groups/{group_id}'
|
392
410
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
393
411
|
_query_builder,
|
394
|
-
'customer_id' => customer_id,
|
395
|
-
'group_id' => group_id
|
412
|
+
'customer_id' => { 'value' => customer_id, 'encode' => true },
|
413
|
+
'group_id' => { 'value' => group_id, 'encode' => true }
|
396
414
|
)
|
397
415
|
_query_url = APIHelper.clean_url _query_builder
|
398
416
|
|
@@ -412,7 +430,9 @@ module Square
|
|
412
430
|
# Return appropriate response type.
|
413
431
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
414
432
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
415
|
-
ApiResponse.new(
|
433
|
+
ApiResponse.new(
|
434
|
+
_response, data: decoded, errors: _errors
|
435
|
+
)
|
416
436
|
end
|
417
437
|
end
|
418
438
|
end
|
@@ -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
|
@@ -50,7 +50,9 @@ module Square
|
|
50
50
|
# Return appropriate response type.
|
51
51
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
52
52
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
53
|
-
ApiResponse.new(
|
53
|
+
ApiResponse.new(
|
54
|
+
_response, data: decoded, errors: _errors
|
55
|
+
)
|
54
56
|
end
|
55
57
|
|
56
58
|
# Returns details of a specific dispute.
|
@@ -63,7 +65,7 @@ module Square
|
|
63
65
|
_query_builder << '/v2/disputes/{dispute_id}'
|
64
66
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
65
67
|
_query_builder,
|
66
|
-
'dispute_id' => dispute_id
|
68
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
67
69
|
)
|
68
70
|
_query_url = APIHelper.clean_url _query_builder
|
69
71
|
|
@@ -83,7 +85,9 @@ module Square
|
|
83
85
|
# Return appropriate response type.
|
84
86
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
85
87
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
86
|
-
ApiResponse.new(
|
88
|
+
ApiResponse.new(
|
89
|
+
_response, data: decoded, errors: _errors
|
90
|
+
)
|
87
91
|
end
|
88
92
|
|
89
93
|
# Accepts loss on a dispute. Square returns
|
@@ -92,9 +96,6 @@ module Square
|
|
92
96
|
# Square debits the disputed amount from the seller’s Square
|
93
97
|
# account. If the Square account balance does not have
|
94
98
|
# sufficient funds, Square debits the associated bank account.
|
95
|
-
# For an overview of the Disputes API, see
|
96
|
-
# [Overview](https://developer.squareup.com/docs/docs/disputes-api/overview)
|
97
|
-
# .
|
98
99
|
# @param [String] dispute_id Required parameter: ID of the dispute you want
|
99
100
|
# to accept.
|
100
101
|
# @return [AcceptDisputeResponse Hash] response from the API call
|
@@ -104,7 +105,7 @@ module Square
|
|
104
105
|
_query_builder << '/v2/disputes/{dispute_id}/accept'
|
105
106
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
106
107
|
_query_builder,
|
107
|
-
'dispute_id' => dispute_id
|
108
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
108
109
|
)
|
109
110
|
_query_url = APIHelper.clean_url _query_builder
|
110
111
|
|
@@ -124,7 +125,9 @@ module Square
|
|
124
125
|
# Return appropriate response type.
|
125
126
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
126
127
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
127
|
-
ApiResponse.new(
|
128
|
+
ApiResponse.new(
|
129
|
+
_response, data: decoded, errors: _errors
|
130
|
+
)
|
128
131
|
end
|
129
132
|
|
130
133
|
# Returns a list of evidence associated with a dispute.
|
@@ -136,7 +139,7 @@ module Square
|
|
136
139
|
_query_builder << '/v2/disputes/{dispute_id}/evidence'
|
137
140
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
138
141
|
_query_builder,
|
139
|
-
'dispute_id' => dispute_id
|
142
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
140
143
|
)
|
141
144
|
_query_url = APIHelper.clean_url _query_builder
|
142
145
|
|
@@ -156,7 +159,9 @@ module Square
|
|
156
159
|
# Return appropriate response type.
|
157
160
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
158
161
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
159
|
-
ApiResponse.new(
|
162
|
+
ApiResponse.new(
|
163
|
+
_response, data: decoded, errors: _errors
|
164
|
+
)
|
160
165
|
end
|
161
166
|
|
162
167
|
# Removes specified evidence from a dispute.
|
@@ -177,8 +182,8 @@ module Square
|
|
177
182
|
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
178
183
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
179
184
|
_query_builder,
|
180
|
-
'dispute_id' => dispute_id,
|
181
|
-
'evidence_id' => evidence_id
|
185
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true },
|
186
|
+
'evidence_id' => { 'value' => evidence_id, 'encode' => true }
|
182
187
|
)
|
183
188
|
_query_url = APIHelper.clean_url _query_builder
|
184
189
|
|
@@ -198,7 +203,9 @@ module Square
|
|
198
203
|
# Return appropriate response type.
|
199
204
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
200
205
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
201
|
-
ApiResponse.new(
|
206
|
+
ApiResponse.new(
|
207
|
+
_response, data: decoded, errors: _errors
|
208
|
+
)
|
202
209
|
end
|
203
210
|
|
204
211
|
# Returns the specific evidence metadata associated with a specific dispute.
|
@@ -217,8 +224,8 @@ module Square
|
|
217
224
|
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
218
225
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
219
226
|
_query_builder,
|
220
|
-
'dispute_id' => dispute_id,
|
221
|
-
'evidence_id' => evidence_id
|
227
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true },
|
228
|
+
'evidence_id' => { 'value' => evidence_id, 'encode' => true }
|
222
229
|
)
|
223
230
|
_query_url = APIHelper.clean_url _query_builder
|
224
231
|
|
@@ -238,16 +245,15 @@ module Square
|
|
238
245
|
# Return appropriate response type.
|
239
246
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
240
247
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
241
|
-
ApiResponse.new(
|
248
|
+
ApiResponse.new(
|
249
|
+
_response, data: decoded, errors: _errors
|
250
|
+
)
|
242
251
|
end
|
243
252
|
|
244
253
|
# Uploads a file to use as evidence in a dispute challenge. The endpoint
|
245
254
|
# accepts
|
246
255
|
# HTTP multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG,
|
247
256
|
# and TIFF formats.
|
248
|
-
# For more information, see [Challenge a
|
249
|
-
# Dispute](https://developer.squareup.com/docs/docs/disputes-api/process-dis
|
250
|
-
# putes#challenge-a-dispute).
|
251
257
|
# @param [String] dispute_id Required parameter: ID of the dispute you want
|
252
258
|
# to upload evidence for.
|
253
259
|
# @param [CreateDisputeEvidenceFileRequest] request Optional parameter:
|
@@ -262,7 +268,7 @@ module Square
|
|
262
268
|
_query_builder << '/v2/disputes/{dispute_id}/evidence_file'
|
263
269
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
264
270
|
_query_builder,
|
265
|
-
'dispute_id' => dispute_id
|
271
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
266
272
|
)
|
267
273
|
_query_url = APIHelper.clean_url _query_builder
|
268
274
|
|
@@ -304,14 +310,12 @@ module Square
|
|
304
310
|
# Return appropriate response type.
|
305
311
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
306
312
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
307
|
-
ApiResponse.new(
|
313
|
+
ApiResponse.new(
|
314
|
+
_response, data: decoded, errors: _errors
|
315
|
+
)
|
308
316
|
end
|
309
317
|
|
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).
|
318
|
+
# Uploads text to use as evidence for a dispute challenge.
|
315
319
|
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
316
320
|
# want to upload evidence for.
|
317
321
|
# @param [CreateDisputeEvidenceTextRequest] body Required parameter: An
|
@@ -325,7 +329,7 @@ module Square
|
|
325
329
|
_query_builder << '/v2/disputes/{dispute_id}/evidence_text'
|
326
330
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
327
331
|
_query_builder,
|
328
|
-
'dispute_id' => dispute_id
|
332
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
329
333
|
)
|
330
334
|
_query_url = APIHelper.clean_url _query_builder
|
331
335
|
|
@@ -347,7 +351,9 @@ module Square
|
|
347
351
|
# Return appropriate response type.
|
348
352
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
349
353
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
350
|
-
ApiResponse.new(
|
354
|
+
ApiResponse.new(
|
355
|
+
_response, data: decoded, errors: _errors
|
356
|
+
)
|
351
357
|
end
|
352
358
|
|
353
359
|
# Submits evidence to the cardholder's bank.
|
@@ -359,10 +365,7 @@ module Square
|
|
359
365
|
# [CreateDisputeEvidenceText](https://developer.squareup.com/docs/reference/
|
360
366
|
# square/disputes-api/create-dispute-evidence-text) endpoints,
|
361
367
|
# and evidence automatically provided by Square, when
|
362
|
-
# available.
|
363
|
-
# [Challenge a
|
364
|
-
# Dispute](https://developer.squareup.com/docs/docs/disputes-api/process-dis
|
365
|
-
# putes#challenge-a-dispute).
|
368
|
+
# available.
|
366
369
|
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
367
370
|
# want to submit evidence for.
|
368
371
|
# @return [SubmitEvidenceResponse Hash] response from the API call
|
@@ -372,7 +375,7 @@ module Square
|
|
372
375
|
_query_builder << '/v2/disputes/{dispute_id}/submit-evidence'
|
373
376
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
374
377
|
_query_builder,
|
375
|
-
'dispute_id' => dispute_id
|
378
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
376
379
|
)
|
377
380
|
_query_url = APIHelper.clean_url _query_builder
|
378
381
|
|
@@ -392,7 +395,9 @@ module Square
|
|
392
395
|
# Return appropriate response type.
|
393
396
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
394
397
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
395
|
-
ApiResponse.new(
|
398
|
+
ApiResponse.new(
|
399
|
+
_response, data: decoded, errors: _errors
|
400
|
+
)
|
396
401
|
end
|
397
402
|
end
|
398
403
|
end
|