square.rb 6.0.0.20200625 → 6.5.0.20201028
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/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
@@ -30,7 +30,9 @@ module Square
|
|
30
30
|
# Return appropriate response type.
|
31
31
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
32
32
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
33
|
-
ApiResponse.new(
|
33
|
+
ApiResponse.new(
|
34
|
+
_response, data: decoded, errors: _errors
|
35
|
+
)
|
34
36
|
end
|
35
37
|
|
36
38
|
# Provides details for all business locations associated with a Square
|
@@ -59,7 +61,9 @@ module Square
|
|
59
61
|
# Return appropriate response type.
|
60
62
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
61
63
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
62
|
-
ApiResponse.new(
|
64
|
+
ApiResponse.new(
|
65
|
+
_response, data: decoded, errors: _errors
|
66
|
+
)
|
63
67
|
end
|
64
68
|
end
|
65
69
|
end
|
@@ -18,7 +18,7 @@ module Square
|
|
18
18
|
_query_builder << '/v1/{location_id}/bank-accounts'
|
19
19
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
20
20
|
_query_builder,
|
21
|
-
'location_id' => location_id
|
21
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
22
22
|
)
|
23
23
|
_query_url = APIHelper.clean_url _query_builder
|
24
24
|
|
@@ -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
|
# Provides non-confidential details for a merchant's associated bank
|
@@ -58,8 +60,8 @@ module Square
|
|
58
60
|
_query_builder << '/v1/{location_id}/bank-accounts/{bank_account_id}'
|
59
61
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
60
62
|
_query_builder,
|
61
|
-
'location_id' => location_id,
|
62
|
-
'bank_account_id' => bank_account_id
|
63
|
+
'location_id' => { 'value' => location_id, 'encode' => true },
|
64
|
+
'bank_account_id' => { 'value' => bank_account_id, 'encode' => true }
|
63
65
|
)
|
64
66
|
_query_url = APIHelper.clean_url _query_builder
|
65
67
|
|
@@ -79,7 +81,9 @@ module Square
|
|
79
81
|
# Return appropriate response type.
|
80
82
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
81
83
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
82
|
-
ApiResponse.new(
|
84
|
+
ApiResponse.new(
|
85
|
+
_response, data: decoded, errors: _errors
|
86
|
+
)
|
83
87
|
end
|
84
88
|
|
85
89
|
# Provides summary information for a merchant's online store orders.
|
@@ -102,7 +106,7 @@ module Square
|
|
102
106
|
_query_builder << '/v1/{location_id}/orders'
|
103
107
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
104
108
|
_query_builder,
|
105
|
-
'location_id' => location_id
|
109
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
106
110
|
)
|
107
111
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
108
112
|
_query_builder,
|
@@ -128,7 +132,9 @@ module Square
|
|
128
132
|
# Return appropriate response type.
|
129
133
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
130
134
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
131
|
-
ApiResponse.new(
|
135
|
+
ApiResponse.new(
|
136
|
+
_response, data: decoded, errors: _errors
|
137
|
+
)
|
132
138
|
end
|
133
139
|
|
134
140
|
# Provides comprehensive information for a single online store order,
|
@@ -146,8 +152,8 @@ module Square
|
|
146
152
|
_query_builder << '/v1/{location_id}/orders/{order_id}'
|
147
153
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
148
154
|
_query_builder,
|
149
|
-
'location_id' => location_id,
|
150
|
-
'order_id' => order_id
|
155
|
+
'location_id' => { 'value' => location_id, 'encode' => true },
|
156
|
+
'order_id' => { 'value' => order_id, 'encode' => true }
|
151
157
|
)
|
152
158
|
_query_url = APIHelper.clean_url _query_builder
|
153
159
|
|
@@ -167,7 +173,9 @@ module Square
|
|
167
173
|
# Return appropriate response type.
|
168
174
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
169
175
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
170
|
-
ApiResponse.new(
|
176
|
+
ApiResponse.new(
|
177
|
+
_response, data: decoded, errors: _errors
|
178
|
+
)
|
171
179
|
end
|
172
180
|
|
173
181
|
# Updates the details of an online store order. Every update you perform on
|
@@ -189,8 +197,8 @@ module Square
|
|
189
197
|
_query_builder << '/v1/{location_id}/orders/{order_id}'
|
190
198
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
191
199
|
_query_builder,
|
192
|
-
'location_id' => location_id,
|
193
|
-
'order_id' => order_id
|
200
|
+
'location_id' => { 'value' => location_id, 'encode' => true },
|
201
|
+
'order_id' => { 'value' => order_id, 'encode' => true }
|
194
202
|
)
|
195
203
|
_query_url = APIHelper.clean_url _query_builder
|
196
204
|
|
@@ -212,7 +220,9 @@ module Square
|
|
212
220
|
# Return appropriate response type.
|
213
221
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
214
222
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
215
|
-
ApiResponse.new(
|
223
|
+
ApiResponse.new(
|
224
|
+
_response, data: decoded, errors: _errors
|
225
|
+
)
|
216
226
|
end
|
217
227
|
|
218
228
|
# Provides summary information for all payments taken for a given
|
@@ -260,7 +270,7 @@ module Square
|
|
260
270
|
_query_builder << '/v1/{location_id}/payments'
|
261
271
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
262
272
|
_query_builder,
|
263
|
-
'location_id' => location_id
|
273
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
264
274
|
)
|
265
275
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
266
276
|
_query_builder,
|
@@ -289,7 +299,9 @@ module Square
|
|
289
299
|
# Return appropriate response type.
|
290
300
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
291
301
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
292
|
-
ApiResponse.new(
|
302
|
+
ApiResponse.new(
|
303
|
+
_response, data: decoded, errors: _errors
|
304
|
+
)
|
293
305
|
end
|
294
306
|
|
295
307
|
# Provides comprehensive information for a single payment.
|
@@ -307,8 +319,8 @@ module Square
|
|
307
319
|
_query_builder << '/v1/{location_id}/payments/{payment_id}'
|
308
320
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
309
321
|
_query_builder,
|
310
|
-
'location_id' => location_id,
|
311
|
-
'payment_id' => payment_id
|
322
|
+
'location_id' => { 'value' => location_id, 'encode' => true },
|
323
|
+
'payment_id' => { 'value' => payment_id, 'encode' => true }
|
312
324
|
)
|
313
325
|
_query_url = APIHelper.clean_url _query_builder
|
314
326
|
|
@@ -328,7 +340,9 @@ module Square
|
|
328
340
|
# Return appropriate response type.
|
329
341
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
330
342
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
331
|
-
ApiResponse.new(
|
343
|
+
ApiResponse.new(
|
344
|
+
_response, data: decoded, errors: _errors
|
345
|
+
)
|
332
346
|
end
|
333
347
|
|
334
348
|
# Provides the details for all refunds initiated by a merchant or any of the
|
@@ -366,7 +380,7 @@ module Square
|
|
366
380
|
_query_builder << '/v1/{location_id}/refunds'
|
367
381
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
368
382
|
_query_builder,
|
369
|
-
'location_id' => location_id
|
383
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
370
384
|
)
|
371
385
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
372
386
|
_query_builder,
|
@@ -394,7 +408,9 @@ module Square
|
|
394
408
|
# Return appropriate response type.
|
395
409
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
396
410
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
397
|
-
ApiResponse.new(
|
411
|
+
ApiResponse.new(
|
412
|
+
_response, data: decoded, errors: _errors
|
413
|
+
)
|
398
414
|
end
|
399
415
|
|
400
416
|
# Issues a refund for a previously processed payment. You must issue
|
@@ -420,7 +436,7 @@ module Square
|
|
420
436
|
_query_builder << '/v1/{location_id}/refunds'
|
421
437
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
422
438
|
_query_builder,
|
423
|
-
'location_id' => location_id
|
439
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
424
440
|
)
|
425
441
|
_query_url = APIHelper.clean_url _query_builder
|
426
442
|
|
@@ -442,7 +458,9 @@ module Square
|
|
442
458
|
# Return appropriate response type.
|
443
459
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
444
460
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
445
|
-
ApiResponse.new(
|
461
|
+
ApiResponse.new(
|
462
|
+
_response, data: decoded, errors: _errors
|
463
|
+
)
|
446
464
|
end
|
447
465
|
|
448
466
|
# Provides summary information for all deposits and withdrawals
|
@@ -485,7 +503,7 @@ module Square
|
|
485
503
|
_query_builder << '/v1/{location_id}/settlements'
|
486
504
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
487
505
|
_query_builder,
|
488
|
-
'location_id' => location_id
|
506
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
489
507
|
)
|
490
508
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
491
509
|
_query_builder,
|
@@ -514,7 +532,9 @@ module Square
|
|
514
532
|
# Return appropriate response type.
|
515
533
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
516
534
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
517
|
-
ApiResponse.new(
|
535
|
+
ApiResponse.new(
|
536
|
+
_response, data: decoded, errors: _errors
|
537
|
+
)
|
518
538
|
end
|
519
539
|
|
520
540
|
# Provides comprehensive information for a single settlement.
|
@@ -545,8 +565,8 @@ module Square
|
|
545
565
|
_query_builder << '/v1/{location_id}/settlements/{settlement_id}'
|
546
566
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
547
567
|
_query_builder,
|
548
|
-
'location_id' => location_id,
|
549
|
-
'settlement_id' => settlement_id
|
568
|
+
'location_id' => { 'value' => location_id, 'encode' => true },
|
569
|
+
'settlement_id' => { 'value' => settlement_id, 'encode' => true }
|
550
570
|
)
|
551
571
|
_query_url = APIHelper.clean_url _query_builder
|
552
572
|
|
@@ -566,7 +586,9 @@ module Square
|
|
566
586
|
# Return appropriate response type.
|
567
587
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
568
588
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
569
|
-
ApiResponse.new(
|
589
|
+
ApiResponse.new(
|
590
|
+
_response, data: decoded, errors: _errors
|
591
|
+
)
|
570
592
|
end
|
571
593
|
end
|
572
594
|
end
|
data/lib/square/api_helper.rb
CHANGED
@@ -36,17 +36,22 @@ module Square
|
|
36
36
|
# Return if there are no parameters to replace.
|
37
37
|
return query_builder if parameters.nil?
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
replace_value = ''
|
42
|
-
|
43
|
-
if value.nil?
|
39
|
+
parameters.each do |key, val|
|
40
|
+
if val.nil?
|
44
41
|
replace_value = ''
|
45
|
-
elsif value.instance_of? Array
|
46
|
-
|
47
|
-
|
42
|
+
elsif val['value'].instance_of? Array
|
43
|
+
if val['encode'] == true
|
44
|
+
val['value'].map! { |element| CGI.escape(element.to_s) }
|
45
|
+
else
|
46
|
+
val['value'].map!(&:to_s)
|
47
|
+
end
|
48
|
+
replace_value = val['value'].join('/')
|
48
49
|
else
|
49
|
-
replace_value =
|
50
|
+
replace_value = if val['encode'] == true
|
51
|
+
CGI.escape(val['value'].to_s)
|
52
|
+
else
|
53
|
+
val['value'].to_s
|
54
|
+
end
|
50
55
|
end
|
51
56
|
|
52
57
|
# Find the template parameter and replace it with its value.
|
data/lib/square/client.rb
CHANGED
@@ -4,11 +4,11 @@ module Square
|
|
4
4
|
attr_reader :config
|
5
5
|
|
6
6
|
def sdk_version
|
7
|
-
'6.
|
7
|
+
'6.5.0.20201028'
|
8
8
|
end
|
9
9
|
|
10
10
|
def square_version
|
11
|
-
|
11
|
+
config.square_version
|
12
12
|
end
|
13
13
|
|
14
14
|
# Access to mobile_authorization controller.
|
@@ -113,6 +113,12 @@ module Square
|
|
113
113
|
@inventory ||= InventoryApi.new config
|
114
114
|
end
|
115
115
|
|
116
|
+
# Access to invoices controller.
|
117
|
+
# @return [InvoicesApi] Returns the controller instance.
|
118
|
+
def invoices
|
119
|
+
@invoices ||= InvoicesApi.new config
|
120
|
+
end
|
121
|
+
|
116
122
|
# Access to labor controller.
|
117
123
|
# @return [LaborApi] Returns the controller instance.
|
118
124
|
def labor
|
@@ -125,24 +131,12 @@ module Square
|
|
125
131
|
@locations ||= LocationsApi.new config
|
126
132
|
end
|
127
133
|
|
128
|
-
# Access to reporting controller.
|
129
|
-
# @return [ReportingApi] Returns the controller instance.
|
130
|
-
def reporting
|
131
|
-
@reporting ||= ReportingApi.new config
|
132
|
-
end
|
133
|
-
|
134
134
|
# Access to checkout controller.
|
135
135
|
# @return [CheckoutApi] Returns the controller instance.
|
136
136
|
def checkout
|
137
137
|
@checkout ||= CheckoutApi.new config
|
138
138
|
end
|
139
139
|
|
140
|
-
# Access to orders controller.
|
141
|
-
# @return [OrdersApi] Returns the controller instance.
|
142
|
-
def orders
|
143
|
-
@orders ||= OrdersApi.new config
|
144
|
-
end
|
145
|
-
|
146
140
|
# Access to transactions controller.
|
147
141
|
# @return [TransactionsApi] Returns the controller instance.
|
148
142
|
def transactions
|
@@ -161,6 +155,12 @@ module Square
|
|
161
155
|
@merchants ||= MerchantsApi.new config
|
162
156
|
end
|
163
157
|
|
158
|
+
# Access to orders controller.
|
159
|
+
# @return [OrdersApi] Returns the controller instance.
|
160
|
+
def orders
|
161
|
+
@orders ||= OrdersApi.new config
|
162
|
+
end
|
163
|
+
|
164
164
|
# Access to payments controller.
|
165
165
|
# @return [PaymentsApi] Returns the controller instance.
|
166
166
|
def payments
|
@@ -173,6 +173,12 @@ module Square
|
|
173
173
|
@refunds ||= RefundsApi.new config
|
174
174
|
end
|
175
175
|
|
176
|
+
# Access to subscriptions controller.
|
177
|
+
# @return [SubscriptionsApi] Returns the controller instance.
|
178
|
+
def subscriptions
|
179
|
+
@subscriptions ||= SubscriptionsApi.new config
|
180
|
+
end
|
181
|
+
|
176
182
|
# Access to team controller.
|
177
183
|
# @return [TeamApi] Returns the controller instance.
|
178
184
|
def team
|
@@ -187,13 +193,14 @@ module Square
|
|
187
193
|
|
188
194
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
189
195
|
backoff_factor: 1, environment: 'production',
|
190
|
-
access_token: 'TODO: Replace',
|
191
|
-
config: nil)
|
196
|
+
square_version: '2020-10-28', access_token: 'TODO: Replace',
|
197
|
+
additional_headers: {}, config: nil)
|
192
198
|
@config = if config.nil?
|
193
199
|
Configuration.new(timeout: timeout, max_retries: max_retries,
|
194
200
|
retry_interval: retry_interval,
|
195
201
|
backoff_factor: backoff_factor,
|
196
202
|
environment: environment,
|
203
|
+
square_version: square_version,
|
197
204
|
access_token: access_token,
|
198
205
|
additional_headers: additional_headers)
|
199
206
|
else
|
data/lib/square/configuration.rb
CHANGED
@@ -9,6 +9,7 @@ module Square
|
|
9
9
|
attr_reader :retry_interval
|
10
10
|
attr_reader :backoff_factor
|
11
11
|
attr_reader :environment
|
12
|
+
attr_reader :square_version
|
12
13
|
attr_reader :access_token
|
13
14
|
|
14
15
|
def additional_headers
|
@@ -21,7 +22,8 @@ module Square
|
|
21
22
|
|
22
23
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
23
24
|
backoff_factor: 1, environment: 'production',
|
24
|
-
access_token: 'TODO: Replace',
|
25
|
+
square_version: '2020-10-28', access_token: 'TODO: Replace',
|
26
|
+
additional_headers: {})
|
25
27
|
# The value to use for connection timeout
|
26
28
|
@timeout = timeout
|
27
29
|
|
@@ -38,6 +40,9 @@ module Square
|
|
38
40
|
# Current API environment
|
39
41
|
@environment = String(environment)
|
40
42
|
|
43
|
+
# Square Connect API versions
|
44
|
+
@square_version = square_version
|
45
|
+
|
41
46
|
# OAuth 2.0 Access Token
|
42
47
|
@access_token = access_token
|
43
48
|
|
@@ -49,20 +54,23 @@ module Square
|
|
49
54
|
end
|
50
55
|
|
51
56
|
def clone_with(timeout: nil, max_retries: nil, retry_interval: nil,
|
52
|
-
backoff_factor: nil, environment: nil,
|
53
|
-
additional_headers: nil)
|
57
|
+
backoff_factor: nil, environment: nil, square_version: nil,
|
58
|
+
access_token: nil, additional_headers: nil)
|
54
59
|
timeout ||= self.timeout
|
55
60
|
max_retries ||= self.max_retries
|
56
61
|
retry_interval ||= self.retry_interval
|
57
62
|
backoff_factor ||= self.backoff_factor
|
58
63
|
environment ||= self.environment
|
64
|
+
square_version ||= self.square_version
|
59
65
|
access_token ||= self.access_token
|
60
66
|
additional_headers ||= self.additional_headers
|
61
67
|
|
62
68
|
Configuration.new(timeout: timeout, max_retries: max_retries,
|
63
69
|
retry_interval: retry_interval,
|
64
70
|
backoff_factor: backoff_factor,
|
65
|
-
environment: environment,
|
71
|
+
environment: environment,
|
72
|
+
square_version: square_version,
|
73
|
+
access_token: access_token,
|
66
74
|
additional_headers: additional_headers)
|
67
75
|
end
|
68
76
|
|
@@ -34,10 +34,12 @@ module Square
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
# returns true if status_code is between 200-300
|
37
38
|
def success?
|
38
39
|
status_code >= 200 && status_code < 300
|
39
40
|
end
|
40
41
|
|
42
|
+
# returns true if status_code is between 400-600
|
41
43
|
def error?
|
42
44
|
status_code >= 400 && status_code < 600
|
43
45
|
end
|
@@ -10,6 +10,7 @@ module Square
|
|
10
10
|
@connection = Faraday.new do |faraday|
|
11
11
|
faraday.use Faraday::HttpCache, serializer: Marshal if cache
|
12
12
|
faraday.use FaradayMiddleware::FollowRedirects
|
13
|
+
faraday.use :gzip
|
13
14
|
faraday.request :multipart
|
14
15
|
faraday.request :url_encoded
|
15
16
|
faraday.ssl[:ca_file] = Certifi.where
|
data/spec/user_journey_spec.rb
CHANGED
@@ -121,11 +121,8 @@ describe "UserJourney" do
|
|
121
121
|
|
122
122
|
# list
|
123
123
|
response = sq.customers.list_customers
|
124
|
-
|
125
|
-
|
126
|
-
assert_equal response.status_code, 200
|
127
|
-
end
|
128
|
-
|
124
|
+
assert_equal response.data.to_h.keys, %i[customers]
|
125
|
+
assert_equal response.status_code, 200
|
129
126
|
|
130
127
|
# update
|
131
128
|
response = sq.customers.update_customer(customer_id: created_customer[:id], body: customer2)
|