square.rb 6.4.0.20200923 → 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 +31 -30
- data/lib/square.rb +61 -61
- 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 +1 -1
- data/lib/square/api/cash_drawers_api.rb +11 -5
- data/lib/square/api/catalog_api.rb +47 -25
- 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 +37 -19
- data/lib/square/api/employees_api.rb +7 -3
- data/lib/square/api/inventory_api.rb +25 -11
- data/lib/square/api/invoices_api.rb +29 -13
- 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 +59 -65
- data/lib/square/api/merchants_api.rb +7 -3
- 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 +55 -8
- data/lib/square/api/payments_api.rb +68 -55
- data/lib/square/api/refunds_api.rb +12 -6
- data/lib/square/api/subscriptions_api.rb +22 -10
- 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 +2 -2
- data/lib/square/configuration.rb +1 -1
- 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/test_locations_api.rb +1 -1
- metadata +3 -3
@@ -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
|
@@ -101,7 +105,7 @@ module Square
|
|
101
105
|
_query_builder << '/v2/disputes/{dispute_id}/accept'
|
102
106
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
103
107
|
_query_builder,
|
104
|
-
'dispute_id' => dispute_id
|
108
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
105
109
|
)
|
106
110
|
_query_url = APIHelper.clean_url _query_builder
|
107
111
|
|
@@ -121,7 +125,9 @@ module Square
|
|
121
125
|
# Return appropriate response type.
|
122
126
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
123
127
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
124
|
-
ApiResponse.new(
|
128
|
+
ApiResponse.new(
|
129
|
+
_response, data: decoded, errors: _errors
|
130
|
+
)
|
125
131
|
end
|
126
132
|
|
127
133
|
# Returns a list of evidence associated with a dispute.
|
@@ -133,7 +139,7 @@ module Square
|
|
133
139
|
_query_builder << '/v2/disputes/{dispute_id}/evidence'
|
134
140
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
135
141
|
_query_builder,
|
136
|
-
'dispute_id' => dispute_id
|
142
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
137
143
|
)
|
138
144
|
_query_url = APIHelper.clean_url _query_builder
|
139
145
|
|
@@ -153,7 +159,9 @@ module Square
|
|
153
159
|
# Return appropriate response type.
|
154
160
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
155
161
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
156
|
-
ApiResponse.new(
|
162
|
+
ApiResponse.new(
|
163
|
+
_response, data: decoded, errors: _errors
|
164
|
+
)
|
157
165
|
end
|
158
166
|
|
159
167
|
# Removes specified evidence from a dispute.
|
@@ -174,8 +182,8 @@ module Square
|
|
174
182
|
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
175
183
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
176
184
|
_query_builder,
|
177
|
-
'dispute_id' => dispute_id,
|
178
|
-
'evidence_id' => evidence_id
|
185
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true },
|
186
|
+
'evidence_id' => { 'value' => evidence_id, 'encode' => true }
|
179
187
|
)
|
180
188
|
_query_url = APIHelper.clean_url _query_builder
|
181
189
|
|
@@ -195,7 +203,9 @@ module Square
|
|
195
203
|
# Return appropriate response type.
|
196
204
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
197
205
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
198
|
-
ApiResponse.new(
|
206
|
+
ApiResponse.new(
|
207
|
+
_response, data: decoded, errors: _errors
|
208
|
+
)
|
199
209
|
end
|
200
210
|
|
201
211
|
# Returns the specific evidence metadata associated with a specific dispute.
|
@@ -214,8 +224,8 @@ module Square
|
|
214
224
|
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
215
225
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
216
226
|
_query_builder,
|
217
|
-
'dispute_id' => dispute_id,
|
218
|
-
'evidence_id' => evidence_id
|
227
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true },
|
228
|
+
'evidence_id' => { 'value' => evidence_id, 'encode' => true }
|
219
229
|
)
|
220
230
|
_query_url = APIHelper.clean_url _query_builder
|
221
231
|
|
@@ -235,7 +245,9 @@ module Square
|
|
235
245
|
# Return appropriate response type.
|
236
246
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
237
247
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
238
|
-
ApiResponse.new(
|
248
|
+
ApiResponse.new(
|
249
|
+
_response, data: decoded, errors: _errors
|
250
|
+
)
|
239
251
|
end
|
240
252
|
|
241
253
|
# Uploads a file to use as evidence in a dispute challenge. The endpoint
|
@@ -256,7 +268,7 @@ module Square
|
|
256
268
|
_query_builder << '/v2/disputes/{dispute_id}/evidence_file'
|
257
269
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
258
270
|
_query_builder,
|
259
|
-
'dispute_id' => dispute_id
|
271
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
260
272
|
)
|
261
273
|
_query_url = APIHelper.clean_url _query_builder
|
262
274
|
|
@@ -298,7 +310,9 @@ module Square
|
|
298
310
|
# Return appropriate response type.
|
299
311
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
300
312
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
301
|
-
ApiResponse.new(
|
313
|
+
ApiResponse.new(
|
314
|
+
_response, data: decoded, errors: _errors
|
315
|
+
)
|
302
316
|
end
|
303
317
|
|
304
318
|
# Uploads text to use as evidence for a dispute challenge.
|
@@ -315,7 +329,7 @@ module Square
|
|
315
329
|
_query_builder << '/v2/disputes/{dispute_id}/evidence_text'
|
316
330
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
317
331
|
_query_builder,
|
318
|
-
'dispute_id' => dispute_id
|
332
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
319
333
|
)
|
320
334
|
_query_url = APIHelper.clean_url _query_builder
|
321
335
|
|
@@ -337,7 +351,9 @@ module Square
|
|
337
351
|
# Return appropriate response type.
|
338
352
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
339
353
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
340
|
-
ApiResponse.new(
|
354
|
+
ApiResponse.new(
|
355
|
+
_response, data: decoded, errors: _errors
|
356
|
+
)
|
341
357
|
end
|
342
358
|
|
343
359
|
# Submits evidence to the cardholder's bank.
|
@@ -359,7 +375,7 @@ module Square
|
|
359
375
|
_query_builder << '/v2/disputes/{dispute_id}/submit-evidence'
|
360
376
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
361
377
|
_query_builder,
|
362
|
-
'dispute_id' => dispute_id
|
378
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
363
379
|
)
|
364
380
|
_query_url = APIHelper.clean_url _query_builder
|
365
381
|
|
@@ -379,7 +395,9 @@ module Square
|
|
379
395
|
# Return appropriate response type.
|
380
396
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
381
397
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
382
|
-
ApiResponse.new(
|
398
|
+
ApiResponse.new(
|
399
|
+
_response, data: decoded, errors: _errors
|
400
|
+
)
|
383
401
|
end
|
384
402
|
end
|
385
403
|
end
|