square.rb 6.4.0.20200923 → 9.0.0.20210226
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/LICENSE +1 -1
- data/README.md +43 -31
- data/lib/square.rb +60 -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 +70 -54
- 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 -25
- 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 -8
- data/lib/square/api/payments_api.rb +68 -55
- data/lib/square/api/refunds_api.rb +32 -26
- 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 +27 -389
- data/lib/square/api/v1_transactions_api.rb +42 -101
- data/lib/square/api_helper.rb +14 -9
- data/lib/square/client.rb +10 -14
- data/lib/square/configuration.rb +21 -6
- 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/test_locations_api.rb +1 -1
- metadata +5 -6
- data/lib/square/api/v1_items_api.rb +0 -1686
- data/lib/square/api/v1_locations_api.rb +0 -65
@@ -5,87 +5,10 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Provides non-confidential details for all of a location's associated bank
|
9
|
-
# accounts. This endpoint does not provide full bank account numbers, and
|
10
|
-
# there is no way to obtain a full bank account number with the Connect API.
|
11
|
-
# @param [String] location_id Required parameter: The ID of the location to
|
12
|
-
# list bank accounts for.
|
13
|
-
# @return [List of V1BankAccount Hash] response from the API call
|
14
|
-
def list_bank_accounts(location_id:)
|
15
|
-
warn 'Endpoint list_bank_accounts in V1TransactionsApi is deprecated'
|
16
|
-
# Prepare query url.
|
17
|
-
_query_builder = config.get_base_uri
|
18
|
-
_query_builder << '/v1/{location_id}/bank-accounts'
|
19
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
20
|
-
_query_builder,
|
21
|
-
'location_id' => location_id
|
22
|
-
)
|
23
|
-
_query_url = APIHelper.clean_url _query_builder
|
24
|
-
|
25
|
-
# Prepare headers.
|
26
|
-
_headers = {
|
27
|
-
'accept' => 'application/json'
|
28
|
-
}
|
29
|
-
|
30
|
-
# Prepare and execute HttpRequest.
|
31
|
-
_request = config.http_client.get(
|
32
|
-
_query_url,
|
33
|
-
headers: _headers
|
34
|
-
)
|
35
|
-
OAuth2.apply(config, _request)
|
36
|
-
_response = execute_request(_request)
|
37
|
-
|
38
|
-
# Return appropriate response type.
|
39
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
40
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
41
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
42
|
-
end
|
43
|
-
|
44
|
-
# Provides non-confidential details for a merchant's associated bank
|
45
|
-
# account. This endpoint does not provide full bank account numbers, and
|
46
|
-
# there is no way to obtain a full bank account number with the Connect API.
|
47
|
-
# @param [String] location_id Required parameter: The ID of the bank
|
48
|
-
# account's associated location.
|
49
|
-
# @param [String] bank_account_id Required parameter: The bank account's
|
50
|
-
# Square-issued ID. You obtain this value from Settlement objects
|
51
|
-
# returned.
|
52
|
-
# @return [V1BankAccount Hash] response from the API call
|
53
|
-
def retrieve_bank_account(location_id:,
|
54
|
-
bank_account_id:)
|
55
|
-
warn 'Endpoint retrieve_bank_account in V1TransactionsApi is deprecated'
|
56
|
-
# Prepare query url.
|
57
|
-
_query_builder = config.get_base_uri
|
58
|
-
_query_builder << '/v1/{location_id}/bank-accounts/{bank_account_id}'
|
59
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
60
|
-
_query_builder,
|
61
|
-
'location_id' => location_id,
|
62
|
-
'bank_account_id' => bank_account_id
|
63
|
-
)
|
64
|
-
_query_url = APIHelper.clean_url _query_builder
|
65
|
-
|
66
|
-
# Prepare headers.
|
67
|
-
_headers = {
|
68
|
-
'accept' => 'application/json'
|
69
|
-
}
|
70
|
-
|
71
|
-
# Prepare and execute HttpRequest.
|
72
|
-
_request = config.http_client.get(
|
73
|
-
_query_url,
|
74
|
-
headers: _headers
|
75
|
-
)
|
76
|
-
OAuth2.apply(config, _request)
|
77
|
-
_response = execute_request(_request)
|
78
|
-
|
79
|
-
# Return appropriate response type.
|
80
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
81
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
82
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
83
|
-
end
|
84
|
-
|
85
8
|
# Provides summary information for a merchant's online store orders.
|
86
9
|
# @param [String] location_id Required parameter: The ID of the location to
|
87
10
|
# list online store orders for.
|
88
|
-
# @param [SortOrder] order Optional parameter:
|
11
|
+
# @param [SortOrder] order Optional parameter: The order in which payments
|
89
12
|
# are listed in the response.
|
90
13
|
# @param [Integer] limit Optional parameter: The maximum number of payments
|
91
14
|
# to return in a single response. This value cannot exceed 200.
|
@@ -102,7 +25,7 @@ module Square
|
|
102
25
|
_query_builder << '/v1/{location_id}/orders'
|
103
26
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
104
27
|
_query_builder,
|
105
|
-
'location_id' => location_id
|
28
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
106
29
|
)
|
107
30
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
108
31
|
_query_builder,
|
@@ -128,7 +51,9 @@ module Square
|
|
128
51
|
# Return appropriate response type.
|
129
52
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
130
53
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
131
|
-
ApiResponse.new(
|
54
|
+
ApiResponse.new(
|
55
|
+
_response, data: decoded, errors: _errors
|
56
|
+
)
|
132
57
|
end
|
133
58
|
|
134
59
|
# Provides comprehensive information for a single online store order,
|
@@ -146,8 +71,8 @@ module Square
|
|
146
71
|
_query_builder << '/v1/{location_id}/orders/{order_id}'
|
147
72
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
148
73
|
_query_builder,
|
149
|
-
'location_id' => location_id,
|
150
|
-
'order_id' => order_id
|
74
|
+
'location_id' => { 'value' => location_id, 'encode' => true },
|
75
|
+
'order_id' => { 'value' => order_id, 'encode' => true }
|
151
76
|
)
|
152
77
|
_query_url = APIHelper.clean_url _query_builder
|
153
78
|
|
@@ -167,7 +92,9 @@ module Square
|
|
167
92
|
# Return appropriate response type.
|
168
93
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
169
94
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
170
|
-
ApiResponse.new(
|
95
|
+
ApiResponse.new(
|
96
|
+
_response, data: decoded, errors: _errors
|
97
|
+
)
|
171
98
|
end
|
172
99
|
|
173
100
|
# Updates the details of an online store order. Every update you perform on
|
@@ -189,8 +116,8 @@ module Square
|
|
189
116
|
_query_builder << '/v1/{location_id}/orders/{order_id}'
|
190
117
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
191
118
|
_query_builder,
|
192
|
-
'location_id' => location_id,
|
193
|
-
'order_id' => order_id
|
119
|
+
'location_id' => { 'value' => location_id, 'encode' => true },
|
120
|
+
'order_id' => { 'value' => order_id, 'encode' => true }
|
194
121
|
)
|
195
122
|
_query_url = APIHelper.clean_url _query_builder
|
196
123
|
|
@@ -212,7 +139,9 @@ module Square
|
|
212
139
|
# Return appropriate response type.
|
213
140
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
214
141
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
215
|
-
ApiResponse.new(
|
142
|
+
ApiResponse.new(
|
143
|
+
_response, data: decoded, errors: _errors
|
144
|
+
)
|
216
145
|
end
|
217
146
|
|
218
147
|
# Provides summary information for all payments taken for a given
|
@@ -260,7 +189,7 @@ module Square
|
|
260
189
|
_query_builder << '/v1/{location_id}/payments'
|
261
190
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
262
191
|
_query_builder,
|
263
|
-
'location_id' => location_id
|
192
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
264
193
|
)
|
265
194
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
266
195
|
_query_builder,
|
@@ -289,7 +218,9 @@ module Square
|
|
289
218
|
# Return appropriate response type.
|
290
219
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
291
220
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
292
|
-
ApiResponse.new(
|
221
|
+
ApiResponse.new(
|
222
|
+
_response, data: decoded, errors: _errors
|
223
|
+
)
|
293
224
|
end
|
294
225
|
|
295
226
|
# Provides comprehensive information for a single payment.
|
@@ -307,8 +238,8 @@ module Square
|
|
307
238
|
_query_builder << '/v1/{location_id}/payments/{payment_id}'
|
308
239
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
309
240
|
_query_builder,
|
310
|
-
'location_id' => location_id,
|
311
|
-
'payment_id' => payment_id
|
241
|
+
'location_id' => { 'value' => location_id, 'encode' => true },
|
242
|
+
'payment_id' => { 'value' => payment_id, 'encode' => true }
|
312
243
|
)
|
313
244
|
_query_url = APIHelper.clean_url _query_builder
|
314
245
|
|
@@ -328,7 +259,9 @@ module Square
|
|
328
259
|
# Return appropriate response type.
|
329
260
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
330
261
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
331
|
-
ApiResponse.new(
|
262
|
+
ApiResponse.new(
|
263
|
+
_response, data: decoded, errors: _errors
|
264
|
+
)
|
332
265
|
end
|
333
266
|
|
334
267
|
# Provides the details for all refunds initiated by a merchant or any of the
|
@@ -336,7 +269,7 @@ module Square
|
|
336
269
|
# year in length.
|
337
270
|
# @param [String] location_id Required parameter: The ID of the location to
|
338
271
|
# list refunds for.
|
339
|
-
# @param [SortOrder] order Optional parameter:
|
272
|
+
# @param [SortOrder] order Optional parameter: The order in which payments
|
340
273
|
# are listed in the response.
|
341
274
|
# @param [String] begin_time Optional parameter: The beginning of the
|
342
275
|
# requested reporting period, in ISO 8601 format. If this value is before
|
@@ -366,7 +299,7 @@ module Square
|
|
366
299
|
_query_builder << '/v1/{location_id}/refunds'
|
367
300
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
368
301
|
_query_builder,
|
369
|
-
'location_id' => location_id
|
302
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
370
303
|
)
|
371
304
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
372
305
|
_query_builder,
|
@@ -394,7 +327,9 @@ module Square
|
|
394
327
|
# Return appropriate response type.
|
395
328
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
396
329
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
397
|
-
ApiResponse.new(
|
330
|
+
ApiResponse.new(
|
331
|
+
_response, data: decoded, errors: _errors
|
332
|
+
)
|
398
333
|
end
|
399
334
|
|
400
335
|
# Issues a refund for a previously processed payment. You must issue
|
@@ -420,7 +355,7 @@ module Square
|
|
420
355
|
_query_builder << '/v1/{location_id}/refunds'
|
421
356
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
422
357
|
_query_builder,
|
423
|
-
'location_id' => location_id
|
358
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
424
359
|
)
|
425
360
|
_query_url = APIHelper.clean_url _query_builder
|
426
361
|
|
@@ -442,7 +377,9 @@ module Square
|
|
442
377
|
# Return appropriate response type.
|
443
378
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
444
379
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
445
|
-
ApiResponse.new(
|
380
|
+
ApiResponse.new(
|
381
|
+
_response, data: decoded, errors: _errors
|
382
|
+
)
|
446
383
|
end
|
447
384
|
|
448
385
|
# Provides summary information for all deposits and withdrawals
|
@@ -485,7 +422,7 @@ module Square
|
|
485
422
|
_query_builder << '/v1/{location_id}/settlements'
|
486
423
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
487
424
|
_query_builder,
|
488
|
-
'location_id' => location_id
|
425
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
489
426
|
)
|
490
427
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
491
428
|
_query_builder,
|
@@ -514,7 +451,9 @@ module Square
|
|
514
451
|
# Return appropriate response type.
|
515
452
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
516
453
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
517
|
-
ApiResponse.new(
|
454
|
+
ApiResponse.new(
|
455
|
+
_response, data: decoded, errors: _errors
|
456
|
+
)
|
518
457
|
end
|
519
458
|
|
520
459
|
# Provides comprehensive information for a single settlement.
|
@@ -545,8 +484,8 @@ module Square
|
|
545
484
|
_query_builder << '/v1/{location_id}/settlements/{settlement_id}'
|
546
485
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
547
486
|
_query_builder,
|
548
|
-
'location_id' => location_id,
|
549
|
-
'settlement_id' => settlement_id
|
487
|
+
'location_id' => { 'value' => location_id, 'encode' => true },
|
488
|
+
'settlement_id' => { 'value' => settlement_id, 'encode' => true }
|
550
489
|
)
|
551
490
|
_query_url = APIHelper.clean_url _query_builder
|
552
491
|
|
@@ -566,7 +505,9 @@ module Square
|
|
566
505
|
# Return appropriate response type.
|
567
506
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
568
507
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
569
|
-
ApiResponse.new(
|
508
|
+
ApiResponse.new(
|
509
|
+
_response, data: decoded, errors: _errors
|
510
|
+
)
|
570
511
|
end
|
571
512
|
end
|
572
513
|
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,7 +4,7 @@ module Square
|
|
4
4
|
attr_reader :config
|
5
5
|
|
6
6
|
def sdk_version
|
7
|
-
'
|
7
|
+
'9.0.0.20210226'
|
8
8
|
end
|
9
9
|
|
10
10
|
def square_version
|
@@ -23,12 +23,6 @@ module Square
|
|
23
23
|
@o_auth ||= OAuthApi.new config
|
24
24
|
end
|
25
25
|
|
26
|
-
# Access to v1_locations controller.
|
27
|
-
# @return [V1LocationsApi] Returns the controller instance.
|
28
|
-
def v1_locations
|
29
|
-
@v1_locations ||= V1LocationsApi.new config
|
30
|
-
end
|
31
|
-
|
32
26
|
# Access to v1_employees controller.
|
33
27
|
# @return [V1EmployeesApi] Returns the controller instance.
|
34
28
|
def v1_employees
|
@@ -41,12 +35,6 @@ module Square
|
|
41
35
|
@v1_transactions ||= V1TransactionsApi.new config
|
42
36
|
end
|
43
37
|
|
44
|
-
# Access to v1_items controller.
|
45
|
-
# @return [V1ItemsApi] Returns the controller instance.
|
46
|
-
def v1_items
|
47
|
-
@v1_items ||= V1ItemsApi.new config
|
48
|
-
end
|
49
|
-
|
50
38
|
# Access to apple_pay controller.
|
51
39
|
# @return [ApplePayApi] Returns the controller instance.
|
52
40
|
def apple_pay
|
@@ -59,6 +47,12 @@ module Square
|
|
59
47
|
@bank_accounts ||= BankAccountsApi.new config
|
60
48
|
end
|
61
49
|
|
50
|
+
# Access to bookings controller.
|
51
|
+
# @return [BookingsApi] Returns the controller instance.
|
52
|
+
def bookings
|
53
|
+
@bookings ||= BookingsApi.new config
|
54
|
+
end
|
55
|
+
|
62
56
|
# Access to cash_drawers controller.
|
63
57
|
# @return [CashDrawersApi] Returns the controller instance.
|
64
58
|
def cash_drawers
|
@@ -193,13 +187,15 @@ module Square
|
|
193
187
|
|
194
188
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
195
189
|
backoff_factor: 1, environment: 'production',
|
196
|
-
|
190
|
+
custom_url: 'https://connect.squareup.com',
|
191
|
+
square_version: '2021-02-26', access_token: 'TODO: Replace',
|
197
192
|
additional_headers: {}, config: nil)
|
198
193
|
@config = if config.nil?
|
199
194
|
Configuration.new(timeout: timeout, max_retries: max_retries,
|
200
195
|
retry_interval: retry_interval,
|
201
196
|
backoff_factor: backoff_factor,
|
202
197
|
environment: environment,
|
198
|
+
custom_url: custom_url,
|
203
199
|
square_version: square_version,
|
204
200
|
access_token: access_token,
|
205
201
|
additional_headers: additional_headers)
|
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 :custom_url
|
12
13
|
attr_reader :square_version
|
13
14
|
attr_reader :access_token
|
14
15
|
|
@@ -22,7 +23,8 @@ module Square
|
|
22
23
|
|
23
24
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
24
25
|
backoff_factor: 1, environment: 'production',
|
25
|
-
|
26
|
+
custom_url: 'https://connect.squareup.com',
|
27
|
+
square_version: '2021-02-26', access_token: 'TODO: Replace',
|
26
28
|
additional_headers: {})
|
27
29
|
# The value to use for connection timeout
|
28
30
|
@timeout = timeout
|
@@ -40,10 +42,13 @@ module Square
|
|
40
42
|
# Current API environment
|
41
43
|
@environment = String(environment)
|
42
44
|
|
45
|
+
# Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`
|
46
|
+
@custom_url = custom_url
|
47
|
+
|
43
48
|
# Square Connect API versions
|
44
49
|
@square_version = square_version
|
45
50
|
|
46
|
-
# OAuth 2.0 Access Token
|
51
|
+
# The OAuth 2.0 Access Token to use for API requests.
|
47
52
|
@access_token = access_token
|
48
53
|
|
49
54
|
# Additional headers to add to each API request
|
@@ -54,13 +59,15 @@ module Square
|
|
54
59
|
end
|
55
60
|
|
56
61
|
def clone_with(timeout: nil, max_retries: nil, retry_interval: nil,
|
57
|
-
backoff_factor: nil, environment: nil,
|
58
|
-
|
62
|
+
backoff_factor: nil, environment: nil, custom_url: nil,
|
63
|
+
square_version: nil, access_token: nil,
|
64
|
+
additional_headers: nil)
|
59
65
|
timeout ||= self.timeout
|
60
66
|
max_retries ||= self.max_retries
|
61
67
|
retry_interval ||= self.retry_interval
|
62
68
|
backoff_factor ||= self.backoff_factor
|
63
69
|
environment ||= self.environment
|
70
|
+
custom_url ||= self.custom_url
|
64
71
|
square_version ||= self.square_version
|
65
72
|
access_token ||= self.access_token
|
66
73
|
additional_headers ||= self.additional_headers
|
@@ -68,7 +75,7 @@ module Square
|
|
68
75
|
Configuration.new(timeout: timeout, max_retries: max_retries,
|
69
76
|
retry_interval: retry_interval,
|
70
77
|
backoff_factor: backoff_factor,
|
71
|
-
environment: environment,
|
78
|
+
environment: environment, custom_url: custom_url,
|
72
79
|
square_version: square_version,
|
73
80
|
access_token: access_token,
|
74
81
|
additional_headers: additional_headers)
|
@@ -87,6 +94,9 @@ module Square
|
|
87
94
|
},
|
88
95
|
'sandbox' => {
|
89
96
|
'default' => 'https://connect.squareupsandbox.com'
|
97
|
+
},
|
98
|
+
'custom' => {
|
99
|
+
'default' => '{custom_url}'
|
90
100
|
}
|
91
101
|
}.freeze
|
92
102
|
|
@@ -95,7 +105,12 @@ module Square
|
|
95
105
|
# required.
|
96
106
|
# @return [String] The base URI.
|
97
107
|
def get_base_uri(server = 'default')
|
98
|
-
|
108
|
+
parameters = {
|
109
|
+
'custom_url' => { 'value' => custom_url, 'encode' => false }
|
110
|
+
}
|
111
|
+
APIHelper.append_url_with_template_parameters(
|
112
|
+
ENVIRONMENTS[environment][server], parameters
|
113
|
+
)
|
99
114
|
end
|
100
115
|
end
|
101
116
|
end
|