square.rb 26.1.0.20230119 → 26.2.0.20230315
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/square/api/apple_pay_api.rb +14 -30
- data/lib/square/api/bank_accounts_api.rb +40 -90
- data/lib/square/api/base_api.rb +42 -42
- data/lib/square/api/booking_custom_attributes_api.rb +164 -329
- data/lib/square/api/bookings_api.rb +135 -260
- data/lib/square/api/cards_api.rb +56 -118
- data/lib/square/api/cash_drawers_api.rb +47 -103
- data/lib/square/api/catalog_api.rb +197 -423
- data/lib/square/api/checkout_api.rb +85 -175
- data/lib/square/api/customer_custom_attributes_api.rb +150 -303
- data/lib/square/api/customer_groups_api.rb +69 -145
- data/lib/square/api/customer_segments_api.rb +26 -61
- data/lib/square/api/customers_api.rb +147 -294
- data/lib/square/api/devices_api.rb +42 -89
- data/lib/square/api/disputes_api.rb +130 -288
- data/lib/square/api/employees_api.rb +28 -63
- data/lib/square/api/gift_card_activities_api.rb +33 -65
- data/lib/square/api/gift_cards_api.rb +103 -202
- data/lib/square/api/inventory_api.rb +179 -366
- data/lib/square/api/invoices_api.rb +118 -237
- data/lib/square/api/labor_api.rb +223 -459
- data/lib/square/api/location_custom_attributes_api.rb +166 -331
- data/lib/square/api/locations_api.rb +54 -112
- data/lib/square/api/loyalty_api.rb +259 -512
- data/lib/square/api/merchants_api.rb +25 -60
- data/lib/square/api/mobile_authorization_api.rb +14 -30
- data/lib/square/api/o_auth_api.rb +54 -109
- data/lib/square/api/order_custom_attributes_api.rb +168 -333
- data/lib/square/api/orders_api.rb +115 -222
- data/lib/square/api/payments_api.rb +106 -208
- data/lib/square/api/payouts_api.rb +47 -100
- data/lib/square/api/refunds_api.rb +46 -93
- data/lib/square/api/sites_api.rb +11 -28
- data/lib/square/api/snippets_api.rb +42 -90
- data/lib/square/api/subscriptions_api.rb +150 -299
- data/lib/square/api/team_api.rb +114 -224
- data/lib/square/api/terminal_api.rb +162 -328
- data/lib/square/api/transactions_api.rb +62 -126
- data/lib/square/api/v1_transactions_api.rb +155 -296
- data/lib/square/api/vendors_api.rb +99 -192
- data/lib/square/api/webhook_subscriptions_api.rb +115 -235
- data/lib/square/api_helper.rb +1 -437
- data/lib/square/client.rb +77 -47
- data/lib/square/configuration.rb +28 -53
- data/lib/square/exceptions/api_exception.rb +1 -11
- data/lib/square/http/api_response.rb +13 -19
- data/lib/square/http/auth/o_auth2.rb +14 -7
- data/lib/square/http/http_call_back.rb +1 -15
- data/lib/square/http/http_method_enum.rb +1 -4
- data/lib/square/http/http_request.rb +1 -45
- data/lib/square/http/http_response.rb +1 -20
- data/lib/square/utilities/date_time_helper.rb +1 -146
- data/lib/square/utilities/file_wrapper.rb +5 -5
- data/lib/square.rb +6 -6
- data/spec/user_journey_spec.rb +2 -2
- data/test/api/api_test_base.rb +13 -5
- data/test/api/test_catalog_api.rb +5 -4
- data/test/api/test_customers_api.rb +3 -2
- data/test/api/test_employees_api.rb +4 -3
- data/test/api/test_labor_api.rb +6 -5
- data/test/api/test_locations_api.rb +3 -2
- data/test/api/test_merchants_api.rb +4 -3
- data/test/api/test_payments_api.rb +4 -3
- data/test/api/test_refunds_api.rb +4 -3
- metadata +11 -111
- data/lib/square/exceptions/validation_exception.rb +0 -13
- data/lib/square/http/faraday_client.rb +0 -93
- data/lib/square/http/http_client.rb +0 -118
- data/test/test_helper.rb +0 -89
@@ -1,10 +1,6 @@
|
|
1
1
|
module Square
|
2
2
|
# V1TransactionsApi
|
3
3
|
class V1TransactionsApi < BaseApi
|
4
|
-
def initialize(config, http_call_back: nil)
|
5
|
-
super(config, http_call_back: http_call_back)
|
6
|
-
end
|
7
|
-
|
8
4
|
# Provides summary information for a merchant's online store orders.
|
9
5
|
# @param [String] location_id Required parameter: The ID of the location to
|
10
6
|
# list online store orders for.
|
@@ -21,40 +17,23 @@ module Square
|
|
21
17
|
limit: nil,
|
22
18
|
batch_token: nil)
|
23
19
|
warn 'Endpoint v1_list_orders in V1TransactionsApi is deprecated'
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
'accept' => 'application/json'
|
42
|
-
}
|
43
|
-
|
44
|
-
# Prepare and execute HttpRequest.
|
45
|
-
_request = config.http_client.get(
|
46
|
-
_query_url,
|
47
|
-
headers: _headers
|
48
|
-
)
|
49
|
-
OAuth2.apply(config, _request)
|
50
|
-
_response = execute_request(_request)
|
51
|
-
|
52
|
-
# Return appropriate response type.
|
53
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
54
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
55
|
-
ApiResponse.new(
|
56
|
-
_response, data: decoded, errors: _errors
|
57
|
-
)
|
20
|
+
new_api_call_builder
|
21
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
22
|
+
'/v1/{location_id}/orders',
|
23
|
+
'default')
|
24
|
+
.template_param(new_parameter(location_id, key: 'location_id')
|
25
|
+
.should_encode(true))
|
26
|
+
.query_param(new_parameter(order, key: 'order'))
|
27
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
28
|
+
.query_param(new_parameter(batch_token, key: 'batch_token'))
|
29
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
30
|
+
.auth(Single.new('global')))
|
31
|
+
.response(new_response_handler
|
32
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
33
|
+
.is_api_response(true)
|
34
|
+
.convertor(ApiResponse.method(:create))
|
35
|
+
.is_response_array(true))
|
36
|
+
.execute
|
58
37
|
end
|
59
38
|
|
60
39
|
# Provides comprehensive information for a single online store order,
|
@@ -68,35 +47,21 @@ module Square
|
|
68
47
|
def v1_retrieve_order(location_id:,
|
69
48
|
order_id:)
|
70
49
|
warn 'Endpoint v1_retrieve_order in V1TransactionsApi is deprecated'
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
# Prepare and execute HttpRequest.
|
87
|
-
_request = config.http_client.get(
|
88
|
-
_query_url,
|
89
|
-
headers: _headers
|
90
|
-
)
|
91
|
-
OAuth2.apply(config, _request)
|
92
|
-
_response = execute_request(_request)
|
93
|
-
|
94
|
-
# Return appropriate response type.
|
95
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
96
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
97
|
-
ApiResponse.new(
|
98
|
-
_response, data: decoded, errors: _errors
|
99
|
-
)
|
50
|
+
new_api_call_builder
|
51
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
52
|
+
'/v1/{location_id}/orders/{order_id}',
|
53
|
+
'default')
|
54
|
+
.template_param(new_parameter(location_id, key: 'location_id')
|
55
|
+
.should_encode(true))
|
56
|
+
.template_param(new_parameter(order_id, key: 'order_id')
|
57
|
+
.should_encode(true))
|
58
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
59
|
+
.auth(Single.new('global')))
|
60
|
+
.response(new_response_handler
|
61
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
62
|
+
.is_api_response(true)
|
63
|
+
.convertor(ApiResponse.method(:create)))
|
64
|
+
.execute
|
100
65
|
end
|
101
66
|
|
102
67
|
# Updates the details of an online store order. Every update you perform on
|
@@ -114,37 +79,24 @@ module Square
|
|
114
79
|
order_id:,
|
115
80
|
body:)
|
116
81
|
warn 'Endpoint v1_update_order in V1TransactionsApi is deprecated'
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
_query_url,
|
136
|
-
headers: _headers,
|
137
|
-
parameters: body.to_json
|
138
|
-
)
|
139
|
-
OAuth2.apply(config, _request)
|
140
|
-
_response = execute_request(_request)
|
141
|
-
|
142
|
-
# Return appropriate response type.
|
143
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
144
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
145
|
-
ApiResponse.new(
|
146
|
-
_response, data: decoded, errors: _errors
|
147
|
-
)
|
82
|
+
new_api_call_builder
|
83
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
84
|
+
'/v1/{location_id}/orders/{order_id}',
|
85
|
+
'default')
|
86
|
+
.template_param(new_parameter(location_id, key: 'location_id')
|
87
|
+
.should_encode(true))
|
88
|
+
.template_param(new_parameter(order_id, key: 'order_id')
|
89
|
+
.should_encode(true))
|
90
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
91
|
+
.body_param(new_parameter(body))
|
92
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
93
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
94
|
+
.auth(Single.new('global')))
|
95
|
+
.response(new_response_handler
|
96
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
97
|
+
.is_api_response(true)
|
98
|
+
.convertor(ApiResponse.method(:create)))
|
99
|
+
.execute
|
148
100
|
end
|
149
101
|
|
150
102
|
# Provides summary information for all payments taken for a given
|
@@ -188,43 +140,26 @@ module Square
|
|
188
140
|
batch_token: nil,
|
189
141
|
include_partial: false)
|
190
142
|
warn 'Endpoint v1_list_payments in V1TransactionsApi is deprecated'
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
'accept' => 'application/json'
|
212
|
-
}
|
213
|
-
|
214
|
-
# Prepare and execute HttpRequest.
|
215
|
-
_request = config.http_client.get(
|
216
|
-
_query_url,
|
217
|
-
headers: _headers
|
218
|
-
)
|
219
|
-
OAuth2.apply(config, _request)
|
220
|
-
_response = execute_request(_request)
|
221
|
-
|
222
|
-
# Return appropriate response type.
|
223
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
224
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
225
|
-
ApiResponse.new(
|
226
|
-
_response, data: decoded, errors: _errors
|
227
|
-
)
|
143
|
+
new_api_call_builder
|
144
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
145
|
+
'/v1/{location_id}/payments',
|
146
|
+
'default')
|
147
|
+
.template_param(new_parameter(location_id, key: 'location_id')
|
148
|
+
.should_encode(true))
|
149
|
+
.query_param(new_parameter(order, key: 'order'))
|
150
|
+
.query_param(new_parameter(begin_time, key: 'begin_time'))
|
151
|
+
.query_param(new_parameter(end_time, key: 'end_time'))
|
152
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
153
|
+
.query_param(new_parameter(batch_token, key: 'batch_token'))
|
154
|
+
.query_param(new_parameter(include_partial, key: 'include_partial'))
|
155
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
156
|
+
.auth(Single.new('global')))
|
157
|
+
.response(new_response_handler
|
158
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
159
|
+
.is_api_response(true)
|
160
|
+
.convertor(ApiResponse.method(:create))
|
161
|
+
.is_response_array(true))
|
162
|
+
.execute
|
228
163
|
end
|
229
164
|
|
230
165
|
# Provides comprehensive information for a single payment.
|
@@ -238,35 +173,21 @@ module Square
|
|
238
173
|
def v1_retrieve_payment(location_id:,
|
239
174
|
payment_id:)
|
240
175
|
warn 'Endpoint v1_retrieve_payment in V1TransactionsApi is deprecated'
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
# Prepare and execute HttpRequest.
|
257
|
-
_request = config.http_client.get(
|
258
|
-
_query_url,
|
259
|
-
headers: _headers
|
260
|
-
)
|
261
|
-
OAuth2.apply(config, _request)
|
262
|
-
_response = execute_request(_request)
|
263
|
-
|
264
|
-
# Return appropriate response type.
|
265
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
266
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
267
|
-
ApiResponse.new(
|
268
|
-
_response, data: decoded, errors: _errors
|
269
|
-
)
|
176
|
+
new_api_call_builder
|
177
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
178
|
+
'/v1/{location_id}/payments/{payment_id}',
|
179
|
+
'default')
|
180
|
+
.template_param(new_parameter(location_id, key: 'location_id')
|
181
|
+
.should_encode(true))
|
182
|
+
.template_param(new_parameter(payment_id, key: 'payment_id')
|
183
|
+
.should_encode(true))
|
184
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
185
|
+
.auth(Single.new('global')))
|
186
|
+
.response(new_response_handler
|
187
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
188
|
+
.is_api_response(true)
|
189
|
+
.convertor(ApiResponse.method(:create)))
|
190
|
+
.execute
|
270
191
|
end
|
271
192
|
|
272
193
|
# Provides the details for all refunds initiated by a merchant or any of the
|
@@ -300,42 +221,25 @@ module Square
|
|
300
221
|
limit: nil,
|
301
222
|
batch_token: nil)
|
302
223
|
warn 'Endpoint v1_list_refunds in V1TransactionsApi is deprecated'
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
'accept' => 'application/json'
|
323
|
-
}
|
324
|
-
|
325
|
-
# Prepare and execute HttpRequest.
|
326
|
-
_request = config.http_client.get(
|
327
|
-
_query_url,
|
328
|
-
headers: _headers
|
329
|
-
)
|
330
|
-
OAuth2.apply(config, _request)
|
331
|
-
_response = execute_request(_request)
|
332
|
-
|
333
|
-
# Return appropriate response type.
|
334
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
335
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
336
|
-
ApiResponse.new(
|
337
|
-
_response, data: decoded, errors: _errors
|
338
|
-
)
|
224
|
+
new_api_call_builder
|
225
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
226
|
+
'/v1/{location_id}/refunds',
|
227
|
+
'default')
|
228
|
+
.template_param(new_parameter(location_id, key: 'location_id')
|
229
|
+
.should_encode(true))
|
230
|
+
.query_param(new_parameter(order, key: 'order'))
|
231
|
+
.query_param(new_parameter(begin_time, key: 'begin_time'))
|
232
|
+
.query_param(new_parameter(end_time, key: 'end_time'))
|
233
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
234
|
+
.query_param(new_parameter(batch_token, key: 'batch_token'))
|
235
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
236
|
+
.auth(Single.new('global')))
|
237
|
+
.response(new_response_handler
|
238
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
239
|
+
.is_api_response(true)
|
240
|
+
.convertor(ApiResponse.method(:create))
|
241
|
+
.is_response_array(true))
|
242
|
+
.execute
|
339
243
|
end
|
340
244
|
|
341
245
|
# Issues a refund for a previously processed payment. You must issue
|
@@ -357,36 +261,22 @@ module Square
|
|
357
261
|
def v1_create_refund(location_id:,
|
358
262
|
body:)
|
359
263
|
warn 'Endpoint v1_create_refund in V1TransactionsApi is deprecated'
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
_request = config.http_client.post(
|
377
|
-
_query_url,
|
378
|
-
headers: _headers,
|
379
|
-
parameters: body.to_json
|
380
|
-
)
|
381
|
-
OAuth2.apply(config, _request)
|
382
|
-
_response = execute_request(_request)
|
383
|
-
|
384
|
-
# Return appropriate response type.
|
385
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
386
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
387
|
-
ApiResponse.new(
|
388
|
-
_response, data: decoded, errors: _errors
|
389
|
-
)
|
264
|
+
new_api_call_builder
|
265
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
266
|
+
'/v1/{location_id}/refunds',
|
267
|
+
'default')
|
268
|
+
.template_param(new_parameter(location_id, key: 'location_id')
|
269
|
+
.should_encode(true))
|
270
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
271
|
+
.body_param(new_parameter(body))
|
272
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
273
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
274
|
+
.auth(Single.new('global')))
|
275
|
+
.response(new_response_handler
|
276
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
277
|
+
.is_api_response(true)
|
278
|
+
.convertor(ApiResponse.method(:create)))
|
279
|
+
.execute
|
390
280
|
end
|
391
281
|
|
392
282
|
# Provides summary information for all deposits and withdrawals
|
@@ -425,43 +315,26 @@ module Square
|
|
425
315
|
status: nil,
|
426
316
|
batch_token: nil)
|
427
317
|
warn 'Endpoint v1_list_settlements in V1TransactionsApi is deprecated'
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
'accept' => 'application/json'
|
449
|
-
}
|
450
|
-
|
451
|
-
# Prepare and execute HttpRequest.
|
452
|
-
_request = config.http_client.get(
|
453
|
-
_query_url,
|
454
|
-
headers: _headers
|
455
|
-
)
|
456
|
-
OAuth2.apply(config, _request)
|
457
|
-
_response = execute_request(_request)
|
458
|
-
|
459
|
-
# Return appropriate response type.
|
460
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
461
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
462
|
-
ApiResponse.new(
|
463
|
-
_response, data: decoded, errors: _errors
|
464
|
-
)
|
318
|
+
new_api_call_builder
|
319
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
320
|
+
'/v1/{location_id}/settlements',
|
321
|
+
'default')
|
322
|
+
.template_param(new_parameter(location_id, key: 'location_id')
|
323
|
+
.should_encode(true))
|
324
|
+
.query_param(new_parameter(order, key: 'order'))
|
325
|
+
.query_param(new_parameter(begin_time, key: 'begin_time'))
|
326
|
+
.query_param(new_parameter(end_time, key: 'end_time'))
|
327
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
328
|
+
.query_param(new_parameter(status, key: 'status'))
|
329
|
+
.query_param(new_parameter(batch_token, key: 'batch_token'))
|
330
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
331
|
+
.auth(Single.new('global')))
|
332
|
+
.response(new_response_handler
|
333
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
334
|
+
.is_api_response(true)
|
335
|
+
.convertor(ApiResponse.method(:create))
|
336
|
+
.is_response_array(true))
|
337
|
+
.execute
|
465
338
|
end
|
466
339
|
|
467
340
|
# Provides comprehensive information for a single settlement.
|
@@ -488,35 +361,21 @@ module Square
|
|
488
361
|
def v1_retrieve_settlement(location_id:,
|
489
362
|
settlement_id:)
|
490
363
|
warn 'Endpoint v1_retrieve_settlement in V1TransactionsApi is deprecated'
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
# Prepare and execute HttpRequest.
|
507
|
-
_request = config.http_client.get(
|
508
|
-
_query_url,
|
509
|
-
headers: _headers
|
510
|
-
)
|
511
|
-
OAuth2.apply(config, _request)
|
512
|
-
_response = execute_request(_request)
|
513
|
-
|
514
|
-
# Return appropriate response type.
|
515
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
516
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
517
|
-
ApiResponse.new(
|
518
|
-
_response, data: decoded, errors: _errors
|
519
|
-
)
|
364
|
+
new_api_call_builder
|
365
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
366
|
+
'/v1/{location_id}/settlements/{settlement_id}',
|
367
|
+
'default')
|
368
|
+
.template_param(new_parameter(location_id, key: 'location_id')
|
369
|
+
.should_encode(true))
|
370
|
+
.template_param(new_parameter(settlement_id, key: 'settlement_id')
|
371
|
+
.should_encode(true))
|
372
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
373
|
+
.auth(Single.new('global')))
|
374
|
+
.response(new_response_handler
|
375
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
376
|
+
.is_api_response(true)
|
377
|
+
.convertor(ApiResponse.method(:create)))
|
378
|
+
.execute
|
520
379
|
end
|
521
380
|
end
|
522
381
|
end
|