square.rb 26.0.0.20221214 → 26.2.0.20230315

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/lib/square/api/apple_pay_api.rb +14 -30
  4. data/lib/square/api/bank_accounts_api.rb +40 -90
  5. data/lib/square/api/base_api.rb +42 -42
  6. data/lib/square/api/booking_custom_attributes_api.rb +164 -329
  7. data/lib/square/api/bookings_api.rb +135 -260
  8. data/lib/square/api/cards_api.rb +56 -118
  9. data/lib/square/api/cash_drawers_api.rb +47 -103
  10. data/lib/square/api/catalog_api.rb +197 -423
  11. data/lib/square/api/checkout_api.rb +85 -175
  12. data/lib/square/api/customer_custom_attributes_api.rb +150 -303
  13. data/lib/square/api/customer_groups_api.rb +69 -145
  14. data/lib/square/api/customer_segments_api.rb +26 -61
  15. data/lib/square/api/customers_api.rb +147 -294
  16. data/lib/square/api/devices_api.rb +42 -89
  17. data/lib/square/api/disputes_api.rb +130 -288
  18. data/lib/square/api/employees_api.rb +28 -63
  19. data/lib/square/api/gift_card_activities_api.rb +33 -65
  20. data/lib/square/api/gift_cards_api.rb +103 -202
  21. data/lib/square/api/inventory_api.rb +179 -366
  22. data/lib/square/api/invoices_api.rb +118 -237
  23. data/lib/square/api/labor_api.rb +223 -459
  24. data/lib/square/api/location_custom_attributes_api.rb +419 -0
  25. data/lib/square/api/locations_api.rb +54 -112
  26. data/lib/square/api/loyalty_api.rb +259 -512
  27. data/lib/square/api/merchants_api.rb +25 -60
  28. data/lib/square/api/mobile_authorization_api.rb +14 -30
  29. data/lib/square/api/o_auth_api.rb +54 -109
  30. data/lib/square/api/order_custom_attributes_api.rb +168 -333
  31. data/lib/square/api/orders_api.rb +115 -222
  32. data/lib/square/api/payments_api.rb +106 -208
  33. data/lib/square/api/payouts_api.rb +47 -100
  34. data/lib/square/api/refunds_api.rb +46 -93
  35. data/lib/square/api/sites_api.rb +11 -28
  36. data/lib/square/api/snippets_api.rb +42 -90
  37. data/lib/square/api/subscriptions_api.rb +150 -299
  38. data/lib/square/api/team_api.rb +114 -224
  39. data/lib/square/api/terminal_api.rb +162 -328
  40. data/lib/square/api/transactions_api.rb +62 -126
  41. data/lib/square/api/v1_transactions_api.rb +155 -296
  42. data/lib/square/api/vendors_api.rb +99 -192
  43. data/lib/square/api/webhook_subscriptions_api.rb +115 -235
  44. data/lib/square/api_helper.rb +1 -437
  45. data/lib/square/client.rb +82 -46
  46. data/lib/square/configuration.rb +28 -53
  47. data/lib/square/exceptions/api_exception.rb +1 -11
  48. data/lib/square/http/api_response.rb +13 -19
  49. data/lib/square/http/auth/o_auth2.rb +14 -7
  50. data/lib/square/http/http_call_back.rb +1 -15
  51. data/lib/square/http/http_method_enum.rb +1 -4
  52. data/lib/square/http/http_request.rb +1 -45
  53. data/lib/square/http/http_response.rb +1 -20
  54. data/lib/square/utilities/date_time_helper.rb +1 -146
  55. data/lib/square/utilities/file_wrapper.rb +5 -5
  56. data/lib/square.rb +7 -6
  57. data/spec/user_journey_spec.rb +2 -2
  58. data/test/api/api_test_base.rb +13 -5
  59. data/test/api/test_catalog_api.rb +5 -4
  60. data/test/api/test_customers_api.rb +3 -2
  61. data/test/api/test_employees_api.rb +4 -3
  62. data/test/api/test_labor_api.rb +6 -5
  63. data/test/api/test_locations_api.rb +3 -2
  64. data/test/api/test_merchants_api.rb +4 -3
  65. data/test/api/test_payments_api.rb +4 -3
  66. data/test/api/test_refunds_api.rb +4 -3
  67. metadata +12 -111
  68. data/lib/square/exceptions/validation_exception.rb +0 -13
  69. data/lib/square/http/faraday_client.rb +0 -93
  70. data/lib/square/http/http_client.rb +0 -118
  71. data/test/test_helper.rb +0 -89
@@ -1,10 +1,6 @@
1
1
  module Square
2
2
  # PaymentsApi
3
3
  class PaymentsApi < BaseApi
4
- def initialize(config, http_call_back: nil)
5
- super(config, http_call_back: http_call_back)
6
- end
7
-
8
4
  # Retrieves a list of payments taken by the account making the request.
9
5
  # Results are eventually consistent, and new payments or changes to payments
10
6
  # might take several
@@ -48,42 +44,26 @@ module Square
48
44
  last_4: nil,
49
45
  card_brand: nil,
50
46
  limit: nil)
51
- # Prepare query url.
52
- _query_builder = config.get_base_uri
53
- _query_builder << '/v2/payments'
54
- _query_builder = APIHelper.append_url_with_query_parameters(
55
- _query_builder,
56
- 'begin_time' => begin_time,
57
- 'end_time' => end_time,
58
- 'sort_order' => sort_order,
59
- 'cursor' => cursor,
60
- 'location_id' => location_id,
61
- 'total' => total,
62
- 'last_4' => last_4,
63
- 'card_brand' => card_brand,
64
- 'limit' => limit
65
- )
66
- _query_url = APIHelper.clean_url _query_builder
67
-
68
- # Prepare headers.
69
- _headers = {
70
- 'accept' => 'application/json'
71
- }
72
-
73
- # Prepare and execute HttpRequest.
74
- _request = config.http_client.get(
75
- _query_url,
76
- headers: _headers
77
- )
78
- OAuth2.apply(config, _request)
79
- _response = execute_request(_request)
80
-
81
- # Return appropriate response type.
82
- decoded = APIHelper.json_deserialize(_response.raw_body)
83
- _errors = APIHelper.map_response(decoded, ['errors'])
84
- ApiResponse.new(
85
- _response, data: decoded, errors: _errors
86
- )
47
+ new_api_call_builder
48
+ .request(new_request_builder(HttpMethodEnum::GET,
49
+ '/v2/payments',
50
+ 'default')
51
+ .query_param(new_parameter(begin_time, key: 'begin_time'))
52
+ .query_param(new_parameter(end_time, key: 'end_time'))
53
+ .query_param(new_parameter(sort_order, key: 'sort_order'))
54
+ .query_param(new_parameter(cursor, key: 'cursor'))
55
+ .query_param(new_parameter(location_id, key: 'location_id'))
56
+ .query_param(new_parameter(total, key: 'total'))
57
+ .query_param(new_parameter(last_4, key: 'last_4'))
58
+ .query_param(new_parameter(card_brand, key: 'card_brand'))
59
+ .query_param(new_parameter(limit, key: 'limit'))
60
+ .header_param(new_parameter('application/json', key: 'accept'))
61
+ .auth(Single.new('global')))
62
+ .response(new_response_handler
63
+ .deserializer(APIHelper.method(:json_deserialize))
64
+ .is_api_response(true)
65
+ .convertor(ApiResponse.method(:create)))
66
+ .execute
87
67
  end
88
68
 
89
69
  # Creates a payment using the provided source. You can use this endpoint
@@ -99,32 +79,20 @@ module Square
99
79
  # object definition for field details.
100
80
  # @return [CreatePaymentResponse Hash] response from the API call
101
81
  def create_payment(body:)
102
- # Prepare query url.
103
- _query_builder = config.get_base_uri
104
- _query_builder << '/v2/payments'
105
- _query_url = APIHelper.clean_url _query_builder
106
-
107
- # Prepare headers.
108
- _headers = {
109
- 'accept' => 'application/json',
110
- 'Content-Type' => 'application/json'
111
- }
112
-
113
- # Prepare and execute HttpRequest.
114
- _request = config.http_client.post(
115
- _query_url,
116
- headers: _headers,
117
- parameters: body.to_json
118
- )
119
- OAuth2.apply(config, _request)
120
- _response = execute_request(_request)
121
-
122
- # Return appropriate response type.
123
- decoded = APIHelper.json_deserialize(_response.raw_body)
124
- _errors = APIHelper.map_response(decoded, ['errors'])
125
- ApiResponse.new(
126
- _response, data: decoded, errors: _errors
127
- )
82
+ new_api_call_builder
83
+ .request(new_request_builder(HttpMethodEnum::POST,
84
+ '/v2/payments',
85
+ 'default')
86
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
87
+ .body_param(new_parameter(body))
88
+ .header_param(new_parameter('application/json', key: 'accept'))
89
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
90
+ .auth(Single.new('global')))
91
+ .response(new_response_handler
92
+ .deserializer(APIHelper.method(:json_deserialize))
93
+ .is_api_response(true)
94
+ .convertor(ApiResponse.method(:create)))
95
+ .execute
128
96
  end
129
97
 
130
98
  # Cancels (voids) a payment identified by the idempotency key that is
@@ -147,32 +115,20 @@ module Square
147
115
  # corresponding object definition for field details.
148
116
  # @return [CancelPaymentByIdempotencyKeyResponse Hash] response from the API call
149
117
  def cancel_payment_by_idempotency_key(body:)
150
- # Prepare query url.
151
- _query_builder = config.get_base_uri
152
- _query_builder << '/v2/payments/cancel'
153
- _query_url = APIHelper.clean_url _query_builder
154
-
155
- # Prepare headers.
156
- _headers = {
157
- 'accept' => 'application/json',
158
- 'Content-Type' => 'application/json'
159
- }
160
-
161
- # Prepare and execute HttpRequest.
162
- _request = config.http_client.post(
163
- _query_url,
164
- headers: _headers,
165
- parameters: body.to_json
166
- )
167
- OAuth2.apply(config, _request)
168
- _response = execute_request(_request)
169
-
170
- # Return appropriate response type.
171
- decoded = APIHelper.json_deserialize(_response.raw_body)
172
- _errors = APIHelper.map_response(decoded, ['errors'])
173
- ApiResponse.new(
174
- _response, data: decoded, errors: _errors
175
- )
118
+ new_api_call_builder
119
+ .request(new_request_builder(HttpMethodEnum::POST,
120
+ '/v2/payments/cancel',
121
+ 'default')
122
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
123
+ .body_param(new_parameter(body))
124
+ .header_param(new_parameter('application/json', key: 'accept'))
125
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
126
+ .auth(Single.new('global')))
127
+ .response(new_response_handler
128
+ .deserializer(APIHelper.method(:json_deserialize))
129
+ .is_api_response(true)
130
+ .convertor(ApiResponse.method(:create)))
131
+ .execute
176
132
  end
177
133
 
178
134
  # Retrieves details for a specific payment.
@@ -180,34 +136,19 @@ module Square
180
136
  # payment.
181
137
  # @return [GetPaymentResponse Hash] response from the API call
182
138
  def get_payment(payment_id:)
183
- # Prepare query url.
184
- _query_builder = config.get_base_uri
185
- _query_builder << '/v2/payments/{payment_id}'
186
- _query_builder = APIHelper.append_url_with_template_parameters(
187
- _query_builder,
188
- 'payment_id' => { 'value' => payment_id, 'encode' => true }
189
- )
190
- _query_url = APIHelper.clean_url _query_builder
191
-
192
- # Prepare headers.
193
- _headers = {
194
- 'accept' => 'application/json'
195
- }
196
-
197
- # Prepare and execute HttpRequest.
198
- _request = config.http_client.get(
199
- _query_url,
200
- headers: _headers
201
- )
202
- OAuth2.apply(config, _request)
203
- _response = execute_request(_request)
204
-
205
- # Return appropriate response type.
206
- decoded = APIHelper.json_deserialize(_response.raw_body)
207
- _errors = APIHelper.map_response(decoded, ['errors'])
208
- ApiResponse.new(
209
- _response, data: decoded, errors: _errors
210
- )
139
+ new_api_call_builder
140
+ .request(new_request_builder(HttpMethodEnum::GET,
141
+ '/v2/payments/{payment_id}',
142
+ 'default')
143
+ .template_param(new_parameter(payment_id, key: 'payment_id')
144
+ .should_encode(true))
145
+ .header_param(new_parameter('application/json', key: 'accept'))
146
+ .auth(Single.new('global')))
147
+ .response(new_response_handler
148
+ .deserializer(APIHelper.method(:json_deserialize))
149
+ .is_api_response(true)
150
+ .convertor(ApiResponse.method(:create)))
151
+ .execute
211
152
  end
212
153
 
213
154
  # Updates a payment with the APPROVED status.
@@ -220,36 +161,22 @@ module Square
220
161
  # @return [UpdatePaymentResponse Hash] response from the API call
221
162
  def update_payment(payment_id:,
222
163
  body:)
223
- # Prepare query url.
224
- _query_builder = config.get_base_uri
225
- _query_builder << '/v2/payments/{payment_id}'
226
- _query_builder = APIHelper.append_url_with_template_parameters(
227
- _query_builder,
228
- 'payment_id' => { 'value' => payment_id, 'encode' => true }
229
- )
230
- _query_url = APIHelper.clean_url _query_builder
231
-
232
- # Prepare headers.
233
- _headers = {
234
- 'accept' => 'application/json',
235
- 'Content-Type' => 'application/json'
236
- }
237
-
238
- # Prepare and execute HttpRequest.
239
- _request = config.http_client.put(
240
- _query_url,
241
- headers: _headers,
242
- parameters: body.to_json
243
- )
244
- OAuth2.apply(config, _request)
245
- _response = execute_request(_request)
246
-
247
- # Return appropriate response type.
248
- decoded = APIHelper.json_deserialize(_response.raw_body)
249
- _errors = APIHelper.map_response(decoded, ['errors'])
250
- ApiResponse.new(
251
- _response, data: decoded, errors: _errors
252
- )
164
+ new_api_call_builder
165
+ .request(new_request_builder(HttpMethodEnum::PUT,
166
+ '/v2/payments/{payment_id}',
167
+ 'default')
168
+ .template_param(new_parameter(payment_id, key: 'payment_id')
169
+ .should_encode(true))
170
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
171
+ .body_param(new_parameter(body))
172
+ .header_param(new_parameter('application/json', key: 'accept'))
173
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
174
+ .auth(Single.new('global')))
175
+ .response(new_response_handler
176
+ .deserializer(APIHelper.method(:json_deserialize))
177
+ .is_api_response(true)
178
+ .convertor(ApiResponse.method(:create)))
179
+ .execute
253
180
  end
254
181
 
255
182
  # Cancels (voids) a payment. You can use this endpoint to cancel a payment
@@ -259,34 +186,19 @@ module Square
259
186
  # cancel.
260
187
  # @return [CancelPaymentResponse Hash] response from the API call
261
188
  def cancel_payment(payment_id:)
262
- # Prepare query url.
263
- _query_builder = config.get_base_uri
264
- _query_builder << '/v2/payments/{payment_id}/cancel'
265
- _query_builder = APIHelper.append_url_with_template_parameters(
266
- _query_builder,
267
- 'payment_id' => { 'value' => payment_id, 'encode' => true }
268
- )
269
- _query_url = APIHelper.clean_url _query_builder
270
-
271
- # Prepare headers.
272
- _headers = {
273
- 'accept' => 'application/json'
274
- }
275
-
276
- # Prepare and execute HttpRequest.
277
- _request = config.http_client.post(
278
- _query_url,
279
- headers: _headers
280
- )
281
- OAuth2.apply(config, _request)
282
- _response = execute_request(_request)
283
-
284
- # Return appropriate response type.
285
- decoded = APIHelper.json_deserialize(_response.raw_body)
286
- _errors = APIHelper.map_response(decoded, ['errors'])
287
- ApiResponse.new(
288
- _response, data: decoded, errors: _errors
289
- )
189
+ new_api_call_builder
190
+ .request(new_request_builder(HttpMethodEnum::POST,
191
+ '/v2/payments/{payment_id}/cancel',
192
+ 'default')
193
+ .template_param(new_parameter(payment_id, key: 'payment_id')
194
+ .should_encode(true))
195
+ .header_param(new_parameter('application/json', key: 'accept'))
196
+ .auth(Single.new('global')))
197
+ .response(new_response_handler
198
+ .deserializer(APIHelper.method(:json_deserialize))
199
+ .is_api_response(true)
200
+ .convertor(ApiResponse.method(:create)))
201
+ .execute
290
202
  end
291
203
 
292
204
  # Completes (captures) a payment.
@@ -302,36 +214,22 @@ module Square
302
214
  # @return [CompletePaymentResponse Hash] response from the API call
303
215
  def complete_payment(payment_id:,
304
216
  body:)
305
- # Prepare query url.
306
- _query_builder = config.get_base_uri
307
- _query_builder << '/v2/payments/{payment_id}/complete'
308
- _query_builder = APIHelper.append_url_with_template_parameters(
309
- _query_builder,
310
- 'payment_id' => { 'value' => payment_id, 'encode' => true }
311
- )
312
- _query_url = APIHelper.clean_url _query_builder
313
-
314
- # Prepare headers.
315
- _headers = {
316
- 'accept' => 'application/json',
317
- 'Content-Type' => 'application/json'
318
- }
319
-
320
- # Prepare and execute HttpRequest.
321
- _request = config.http_client.post(
322
- _query_url,
323
- headers: _headers,
324
- parameters: body.to_json
325
- )
326
- OAuth2.apply(config, _request)
327
- _response = execute_request(_request)
328
-
329
- # Return appropriate response type.
330
- decoded = APIHelper.json_deserialize(_response.raw_body)
331
- _errors = APIHelper.map_response(decoded, ['errors'])
332
- ApiResponse.new(
333
- _response, data: decoded, errors: _errors
334
- )
217
+ new_api_call_builder
218
+ .request(new_request_builder(HttpMethodEnum::POST,
219
+ '/v2/payments/{payment_id}/complete',
220
+ 'default')
221
+ .template_param(new_parameter(payment_id, key: 'payment_id')
222
+ .should_encode(true))
223
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
224
+ .body_param(new_parameter(body))
225
+ .header_param(new_parameter('application/json', key: 'accept'))
226
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
227
+ .auth(Single.new('global')))
228
+ .response(new_response_handler
229
+ .deserializer(APIHelper.method(:json_deserialize))
230
+ .is_api_response(true)
231
+ .convertor(ApiResponse.method(:create)))
232
+ .execute
335
233
  end
336
234
  end
337
235
  end
@@ -1,10 +1,6 @@
1
1
  module Square
2
2
  # PayoutsApi
3
3
  class PayoutsApi < BaseApi
4
- def initialize(config, http_call_back: nil)
5
- super(config, http_call_back: http_call_back)
6
- end
7
-
8
4
  # Retrieves a list of all payouts for the default location.
9
5
  # You can filter payouts by location ID, status, time range, and order them
10
6
  # in ascending or descending order.
@@ -40,40 +36,24 @@ module Square
40
36
  sort_order: nil,
41
37
  cursor: nil,
42
38
  limit: nil)
43
- # Prepare query url.
44
- _query_builder = config.get_base_uri
45
- _query_builder << '/v2/payouts'
46
- _query_builder = APIHelper.append_url_with_query_parameters(
47
- _query_builder,
48
- 'location_id' => location_id,
49
- 'status' => status,
50
- 'begin_time' => begin_time,
51
- 'end_time' => end_time,
52
- 'sort_order' => sort_order,
53
- 'cursor' => cursor,
54
- 'limit' => limit
55
- )
56
- _query_url = APIHelper.clean_url _query_builder
57
-
58
- # Prepare headers.
59
- _headers = {
60
- 'accept' => 'application/json'
61
- }
62
-
63
- # Prepare and execute HttpRequest.
64
- _request = config.http_client.get(
65
- _query_url,
66
- headers: _headers
67
- )
68
- OAuth2.apply(config, _request)
69
- _response = execute_request(_request)
70
-
71
- # Return appropriate response type.
72
- decoded = APIHelper.json_deserialize(_response.raw_body)
73
- _errors = APIHelper.map_response(decoded, ['errors'])
74
- ApiResponse.new(
75
- _response, data: decoded, errors: _errors
76
- )
39
+ new_api_call_builder
40
+ .request(new_request_builder(HttpMethodEnum::GET,
41
+ '/v2/payouts',
42
+ 'default')
43
+ .query_param(new_parameter(location_id, key: 'location_id'))
44
+ .query_param(new_parameter(status, key: 'status'))
45
+ .query_param(new_parameter(begin_time, key: 'begin_time'))
46
+ .query_param(new_parameter(end_time, key: 'end_time'))
47
+ .query_param(new_parameter(sort_order, key: 'sort_order'))
48
+ .query_param(new_parameter(cursor, key: 'cursor'))
49
+ .query_param(new_parameter(limit, key: 'limit'))
50
+ .header_param(new_parameter('application/json', key: 'accept'))
51
+ .auth(Single.new('global')))
52
+ .response(new_response_handler
53
+ .deserializer(APIHelper.method(:json_deserialize))
54
+ .is_api_response(true)
55
+ .convertor(ApiResponse.method(:create)))
56
+ .execute
77
57
  end
78
58
 
79
59
  # Retrieves details of a specific payout identified by a payout ID.
@@ -82,34 +62,19 @@ module Square
82
62
  # retrieve the information for.
83
63
  # @return [GetPayoutResponse Hash] response from the API call
84
64
  def get_payout(payout_id:)
85
- # Prepare query url.
86
- _query_builder = config.get_base_uri
87
- _query_builder << '/v2/payouts/{payout_id}'
88
- _query_builder = APIHelper.append_url_with_template_parameters(
89
- _query_builder,
90
- 'payout_id' => { 'value' => payout_id, 'encode' => true }
91
- )
92
- _query_url = APIHelper.clean_url _query_builder
93
-
94
- # Prepare headers.
95
- _headers = {
96
- 'accept' => 'application/json'
97
- }
98
-
99
- # Prepare and execute HttpRequest.
100
- _request = config.http_client.get(
101
- _query_url,
102
- headers: _headers
103
- )
104
- OAuth2.apply(config, _request)
105
- _response = execute_request(_request)
106
-
107
- # Return appropriate response type.
108
- decoded = APIHelper.json_deserialize(_response.raw_body)
109
- _errors = APIHelper.map_response(decoded, ['errors'])
110
- ApiResponse.new(
111
- _response, data: decoded, errors: _errors
112
- )
65
+ new_api_call_builder
66
+ .request(new_request_builder(HttpMethodEnum::GET,
67
+ '/v2/payouts/{payout_id}',
68
+ 'default')
69
+ .template_param(new_parameter(payout_id, key: 'payout_id')
70
+ .should_encode(true))
71
+ .header_param(new_parameter('application/json', key: 'accept'))
72
+ .auth(Single.new('global')))
73
+ .response(new_response_handler
74
+ .deserializer(APIHelper.method(:json_deserialize))
75
+ .is_api_response(true)
76
+ .convertor(ApiResponse.method(:create)))
77
+ .execute
113
78
  end
114
79
 
115
80
  # Retrieves a list of all payout entries for a specific payout.
@@ -134,40 +99,22 @@ module Square
134
99
  sort_order: nil,
135
100
  cursor: nil,
136
101
  limit: nil)
137
- # Prepare query url.
138
- _query_builder = config.get_base_uri
139
- _query_builder << '/v2/payouts/{payout_id}/payout-entries'
140
- _query_builder = APIHelper.append_url_with_template_parameters(
141
- _query_builder,
142
- 'payout_id' => { 'value' => payout_id, 'encode' => true }
143
- )
144
- _query_builder = APIHelper.append_url_with_query_parameters(
145
- _query_builder,
146
- 'sort_order' => sort_order,
147
- 'cursor' => cursor,
148
- 'limit' => limit
149
- )
150
- _query_url = APIHelper.clean_url _query_builder
151
-
152
- # Prepare headers.
153
- _headers = {
154
- 'accept' => 'application/json'
155
- }
156
-
157
- # Prepare and execute HttpRequest.
158
- _request = config.http_client.get(
159
- _query_url,
160
- headers: _headers
161
- )
162
- OAuth2.apply(config, _request)
163
- _response = execute_request(_request)
164
-
165
- # Return appropriate response type.
166
- decoded = APIHelper.json_deserialize(_response.raw_body)
167
- _errors = APIHelper.map_response(decoded, ['errors'])
168
- ApiResponse.new(
169
- _response, data: decoded, errors: _errors
170
- )
102
+ new_api_call_builder
103
+ .request(new_request_builder(HttpMethodEnum::GET,
104
+ '/v2/payouts/{payout_id}/payout-entries',
105
+ 'default')
106
+ .template_param(new_parameter(payout_id, key: 'payout_id')
107
+ .should_encode(true))
108
+ .query_param(new_parameter(sort_order, key: 'sort_order'))
109
+ .query_param(new_parameter(cursor, key: 'cursor'))
110
+ .query_param(new_parameter(limit, key: 'limit'))
111
+ .header_param(new_parameter('application/json', key: 'accept'))
112
+ .auth(Single.new('global')))
113
+ .response(new_response_handler
114
+ .deserializer(APIHelper.method(:json_deserialize))
115
+ .is_api_response(true)
116
+ .convertor(ApiResponse.method(:create)))
117
+ .execute
171
118
  end
172
119
  end
173
120
  end