square.rb 26.0.0.20221214 → 26.2.0.20230315
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/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 +419 -0
- 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 +82 -46
- 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 +7 -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 +12 -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
|
# CustomersApi
|
3
3
|
class CustomersApi < BaseApi
|
4
|
-
def initialize(config, http_call_back: nil)
|
5
|
-
super(config, http_call_back: http_call_back)
|
6
|
-
end
|
7
|
-
|
8
4
|
# Lists customer profiles associated with a Square account.
|
9
5
|
# Under normal operating conditions, newly created or updated customer
|
10
6
|
# profiles become available
|
@@ -35,37 +31,21 @@ module Square
|
|
35
31
|
limit: nil,
|
36
32
|
sort_field: nil,
|
37
33
|
sort_order: nil)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
}
|
54
|
-
|
55
|
-
# Prepare and execute HttpRequest.
|
56
|
-
_request = config.http_client.get(
|
57
|
-
_query_url,
|
58
|
-
headers: _headers
|
59
|
-
)
|
60
|
-
OAuth2.apply(config, _request)
|
61
|
-
_response = execute_request(_request)
|
62
|
-
|
63
|
-
# Return appropriate response type.
|
64
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
65
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
66
|
-
ApiResponse.new(
|
67
|
-
_response, data: decoded, errors: _errors
|
68
|
-
)
|
34
|
+
new_api_call_builder
|
35
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
36
|
+
'/v2/customers',
|
37
|
+
'default')
|
38
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
39
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
40
|
+
.query_param(new_parameter(sort_field, key: 'sort_field'))
|
41
|
+
.query_param(new_parameter(sort_order, key: 'sort_order'))
|
42
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
43
|
+
.auth(Single.new('global')))
|
44
|
+
.response(new_response_handler
|
45
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
46
|
+
.is_api_response(true)
|
47
|
+
.convertor(ApiResponse.method(:create)))
|
48
|
+
.execute
|
69
49
|
end
|
70
50
|
|
71
51
|
# Creates a new customer for a business.
|
@@ -82,32 +62,20 @@ module Square
|
|
82
62
|
# object definition for field details.
|
83
63
|
# @return [CreateCustomerResponse Hash] response from the API call
|
84
64
|
def create_customer(body:)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
headers: _headers,
|
100
|
-
parameters: body.to_json
|
101
|
-
)
|
102
|
-
OAuth2.apply(config, _request)
|
103
|
-
_response = execute_request(_request)
|
104
|
-
|
105
|
-
# Return appropriate response type.
|
106
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
107
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
108
|
-
ApiResponse.new(
|
109
|
-
_response, data: decoded, errors: _errors
|
110
|
-
)
|
65
|
+
new_api_call_builder
|
66
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
67
|
+
'/v2/customers',
|
68
|
+
'default')
|
69
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
70
|
+
.body_param(new_parameter(body))
|
71
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
72
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
73
|
+
.auth(Single.new('global')))
|
74
|
+
.response(new_response_handler
|
75
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
76
|
+
.is_api_response(true)
|
77
|
+
.convertor(ApiResponse.method(:create)))
|
78
|
+
.execute
|
111
79
|
end
|
112
80
|
|
113
81
|
# Searches the customer profiles associated with a Square account using one
|
@@ -126,32 +94,20 @@ module Square
|
|
126
94
|
# object definition for field details.
|
127
95
|
# @return [SearchCustomersResponse Hash] response from the API call
|
128
96
|
def search_customers(body:)
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
headers: _headers,
|
144
|
-
parameters: body.to_json
|
145
|
-
)
|
146
|
-
OAuth2.apply(config, _request)
|
147
|
-
_response = execute_request(_request)
|
148
|
-
|
149
|
-
# Return appropriate response type.
|
150
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
151
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
152
|
-
ApiResponse.new(
|
153
|
-
_response, data: decoded, errors: _errors
|
154
|
-
)
|
97
|
+
new_api_call_builder
|
98
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
99
|
+
'/v2/customers/search',
|
100
|
+
'default')
|
101
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
102
|
+
.body_param(new_parameter(body))
|
103
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
104
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
105
|
+
.auth(Single.new('global')))
|
106
|
+
.response(new_response_handler
|
107
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
108
|
+
.is_api_response(true)
|
109
|
+
.convertor(ApiResponse.method(:create)))
|
110
|
+
.execute
|
155
111
|
end
|
156
112
|
|
157
113
|
# Deletes a customer profile from a business. This operation also unlinks
|
@@ -177,38 +133,20 @@ module Square
|
|
177
133
|
# @return [DeleteCustomerResponse Hash] response from the API call
|
178
134
|
def delete_customer(customer_id:,
|
179
135
|
version: nil)
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
_headers = {
|
195
|
-
'accept' => 'application/json'
|
196
|
-
}
|
197
|
-
|
198
|
-
# Prepare and execute HttpRequest.
|
199
|
-
_request = config.http_client.delete(
|
200
|
-
_query_url,
|
201
|
-
headers: _headers
|
202
|
-
)
|
203
|
-
OAuth2.apply(config, _request)
|
204
|
-
_response = execute_request(_request)
|
205
|
-
|
206
|
-
# Return appropriate response type.
|
207
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
208
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
209
|
-
ApiResponse.new(
|
210
|
-
_response, data: decoded, errors: _errors
|
211
|
-
)
|
136
|
+
new_api_call_builder
|
137
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
138
|
+
'/v2/customers/{customer_id}',
|
139
|
+
'default')
|
140
|
+
.template_param(new_parameter(customer_id, key: 'customer_id')
|
141
|
+
.should_encode(true))
|
142
|
+
.query_param(new_parameter(version, key: 'version'))
|
143
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
144
|
+
.auth(Single.new('global')))
|
145
|
+
.response(new_response_handler
|
146
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
147
|
+
.is_api_response(true)
|
148
|
+
.convertor(ApiResponse.method(:create)))
|
149
|
+
.execute
|
212
150
|
end
|
213
151
|
|
214
152
|
# Returns details for a single customer.
|
@@ -216,34 +154,19 @@ module Square
|
|
216
154
|
# retrieve.
|
217
155
|
# @return [RetrieveCustomerResponse Hash] response from the API call
|
218
156
|
def retrieve_customer(customer_id:)
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
# Prepare and execute HttpRequest.
|
234
|
-
_request = config.http_client.get(
|
235
|
-
_query_url,
|
236
|
-
headers: _headers
|
237
|
-
)
|
238
|
-
OAuth2.apply(config, _request)
|
239
|
-
_response = execute_request(_request)
|
240
|
-
|
241
|
-
# Return appropriate response type.
|
242
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
243
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
244
|
-
ApiResponse.new(
|
245
|
-
_response, data: decoded, errors: _errors
|
246
|
-
)
|
157
|
+
new_api_call_builder
|
158
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
159
|
+
'/v2/customers/{customer_id}',
|
160
|
+
'default')
|
161
|
+
.template_param(new_parameter(customer_id, key: 'customer_id')
|
162
|
+
.should_encode(true))
|
163
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
164
|
+
.auth(Single.new('global')))
|
165
|
+
.response(new_response_handler
|
166
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
167
|
+
.is_api_response(true)
|
168
|
+
.convertor(ApiResponse.method(:create)))
|
169
|
+
.execute
|
247
170
|
end
|
248
171
|
|
249
172
|
# Updates a customer profile. This endpoint supports sparse updates, so only
|
@@ -269,36 +192,22 @@ module Square
|
|
269
192
|
# @return [UpdateCustomerResponse Hash] response from the API call
|
270
193
|
def update_customer(customer_id:,
|
271
194
|
body:)
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
_request = config.http_client.put(
|
289
|
-
_query_url,
|
290
|
-
headers: _headers,
|
291
|
-
parameters: body.to_json
|
292
|
-
)
|
293
|
-
OAuth2.apply(config, _request)
|
294
|
-
_response = execute_request(_request)
|
295
|
-
|
296
|
-
# Return appropriate response type.
|
297
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
298
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
299
|
-
ApiResponse.new(
|
300
|
-
_response, data: decoded, errors: _errors
|
301
|
-
)
|
195
|
+
new_api_call_builder
|
196
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
197
|
+
'/v2/customers/{customer_id}',
|
198
|
+
'default')
|
199
|
+
.template_param(new_parameter(customer_id, key: 'customer_id')
|
200
|
+
.should_encode(true))
|
201
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
202
|
+
.body_param(new_parameter(body))
|
203
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
204
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
205
|
+
.auth(Single.new('global')))
|
206
|
+
.response(new_response_handler
|
207
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
208
|
+
.is_api_response(true)
|
209
|
+
.convertor(ApiResponse.method(:create)))
|
210
|
+
.execute
|
302
211
|
end
|
303
212
|
|
304
213
|
# Adds a card on file to an existing customer.
|
@@ -315,36 +224,22 @@ module Square
|
|
315
224
|
def create_customer_card(customer_id:,
|
316
225
|
body:)
|
317
226
|
warn 'Endpoint create_customer_card in CustomersApi is deprecated'
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
_request = config.http_client.post(
|
335
|
-
_query_url,
|
336
|
-
headers: _headers,
|
337
|
-
parameters: body.to_json
|
338
|
-
)
|
339
|
-
OAuth2.apply(config, _request)
|
340
|
-
_response = execute_request(_request)
|
341
|
-
|
342
|
-
# Return appropriate response type.
|
343
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
344
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
345
|
-
ApiResponse.new(
|
346
|
-
_response, data: decoded, errors: _errors
|
347
|
-
)
|
227
|
+
new_api_call_builder
|
228
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
229
|
+
'/v2/customers/{customer_id}/cards',
|
230
|
+
'default')
|
231
|
+
.template_param(new_parameter(customer_id, key: 'customer_id')
|
232
|
+
.should_encode(true))
|
233
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
234
|
+
.body_param(new_parameter(body))
|
235
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
236
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
237
|
+
.auth(Single.new('global')))
|
238
|
+
.response(new_response_handler
|
239
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
240
|
+
.is_api_response(true)
|
241
|
+
.convertor(ApiResponse.method(:create)))
|
242
|
+
.execute
|
348
243
|
end
|
349
244
|
|
350
245
|
# Removes a card on file from a customer.
|
@@ -356,35 +251,21 @@ module Square
|
|
356
251
|
def delete_customer_card(customer_id:,
|
357
252
|
card_id:)
|
358
253
|
warn 'Endpoint delete_customer_card in CustomersApi is deprecated'
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
# Prepare and execute HttpRequest.
|
375
|
-
_request = config.http_client.delete(
|
376
|
-
_query_url,
|
377
|
-
headers: _headers
|
378
|
-
)
|
379
|
-
OAuth2.apply(config, _request)
|
380
|
-
_response = execute_request(_request)
|
381
|
-
|
382
|
-
# Return appropriate response type.
|
383
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
384
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
385
|
-
ApiResponse.new(
|
386
|
-
_response, data: decoded, errors: _errors
|
387
|
-
)
|
254
|
+
new_api_call_builder
|
255
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
256
|
+
'/v2/customers/{customer_id}/cards/{card_id}',
|
257
|
+
'default')
|
258
|
+
.template_param(new_parameter(customer_id, key: 'customer_id')
|
259
|
+
.should_encode(true))
|
260
|
+
.template_param(new_parameter(card_id, key: 'card_id')
|
261
|
+
.should_encode(true))
|
262
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
263
|
+
.auth(Single.new('global')))
|
264
|
+
.response(new_response_handler
|
265
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
266
|
+
.is_api_response(true)
|
267
|
+
.convertor(ApiResponse.method(:create)))
|
268
|
+
.execute
|
388
269
|
end
|
389
270
|
|
390
271
|
# Removes a group membership from a customer.
|
@@ -397,35 +278,21 @@ module Square
|
|
397
278
|
# @return [RemoveGroupFromCustomerResponse Hash] response from the API call
|
398
279
|
def remove_group_from_customer(customer_id:,
|
399
280
|
group_id:)
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
# Prepare and execute HttpRequest.
|
416
|
-
_request = config.http_client.delete(
|
417
|
-
_query_url,
|
418
|
-
headers: _headers
|
419
|
-
)
|
420
|
-
OAuth2.apply(config, _request)
|
421
|
-
_response = execute_request(_request)
|
422
|
-
|
423
|
-
# Return appropriate response type.
|
424
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
425
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
426
|
-
ApiResponse.new(
|
427
|
-
_response, data: decoded, errors: _errors
|
428
|
-
)
|
281
|
+
new_api_call_builder
|
282
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
283
|
+
'/v2/customers/{customer_id}/groups/{group_id}',
|
284
|
+
'default')
|
285
|
+
.template_param(new_parameter(customer_id, key: 'customer_id')
|
286
|
+
.should_encode(true))
|
287
|
+
.template_param(new_parameter(group_id, key: 'group_id')
|
288
|
+
.should_encode(true))
|
289
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
290
|
+
.auth(Single.new('global')))
|
291
|
+
.response(new_response_handler
|
292
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
293
|
+
.is_api_response(true)
|
294
|
+
.convertor(ApiResponse.method(:create)))
|
295
|
+
.execute
|
429
296
|
end
|
430
297
|
|
431
298
|
# Adds a group membership to a customer.
|
@@ -438,35 +305,21 @@ module Square
|
|
438
305
|
# @return [AddGroupToCustomerResponse Hash] response from the API call
|
439
306
|
def add_group_to_customer(customer_id:,
|
440
307
|
group_id:)
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
# Prepare and execute HttpRequest.
|
457
|
-
_request = config.http_client.put(
|
458
|
-
_query_url,
|
459
|
-
headers: _headers
|
460
|
-
)
|
461
|
-
OAuth2.apply(config, _request)
|
462
|
-
_response = execute_request(_request)
|
463
|
-
|
464
|
-
# Return appropriate response type.
|
465
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
466
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
467
|
-
ApiResponse.new(
|
468
|
-
_response, data: decoded, errors: _errors
|
469
|
-
)
|
308
|
+
new_api_call_builder
|
309
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
310
|
+
'/v2/customers/{customer_id}/groups/{group_id}',
|
311
|
+
'default')
|
312
|
+
.template_param(new_parameter(customer_id, key: 'customer_id')
|
313
|
+
.should_encode(true))
|
314
|
+
.template_param(new_parameter(group_id, key: 'group_id')
|
315
|
+
.should_encode(true))
|
316
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
317
|
+
.auth(Single.new('global')))
|
318
|
+
.response(new_response_handler
|
319
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
320
|
+
.is_api_response(true)
|
321
|
+
.convertor(ApiResponse.method(:create)))
|
322
|
+
.execute
|
470
323
|
end
|
471
324
|
end
|
472
325
|
end
|