square.rb 6.4.0.20200923 → 6.5.0.20201028
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -30
- data/lib/square.rb +61 -61
- 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 +1 -1
- data/lib/square/api/cash_drawers_api.rb +11 -5
- data/lib/square/api/catalog_api.rb +47 -25
- 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 +37 -19
- data/lib/square/api/employees_api.rb +7 -3
- data/lib/square/api/inventory_api.rb +25 -11
- data/lib/square/api/invoices_api.rb +29 -13
- 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 +59 -65
- data/lib/square/api/merchants_api.rb +7 -3
- 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 +55 -8
- data/lib/square/api/payments_api.rb +68 -55
- data/lib/square/api/refunds_api.rb +12 -6
- data/lib/square/api/subscriptions_api.rb +22 -10
- 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 +2 -2
- data/lib/square/configuration.rb +1 -1
- 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/test_locations_api.rb +1 -1
- metadata +3 -3
@@ -6,8 +6,7 @@ module Square
|
|
6
6
|
end
|
7
7
|
|
8
8
|
# Provides information of all locations of a business.
|
9
|
-
#
|
10
|
-
# parameter.
|
9
|
+
# Many Square API endpoints require a `location_id` parameter.
|
11
10
|
# The `id` field of the [`Location`](#type-location) objects returned by
|
12
11
|
# this
|
13
12
|
# endpoint correspond to that `location_id` parameter.
|
@@ -34,12 +33,12 @@ module Square
|
|
34
33
|
# Return appropriate response type.
|
35
34
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
36
35
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
37
|
-
ApiResponse.new(
|
36
|
+
ApiResponse.new(
|
37
|
+
_response, data: decoded, errors: _errors
|
38
|
+
)
|
38
39
|
end
|
39
40
|
|
40
41
|
# Creates a location.
|
41
|
-
# For more information about locations, see [Locations API
|
42
|
-
# Overview](https://developer.squareup.com/docs/locations-api).
|
43
42
|
# @param [CreateLocationRequest] body Required parameter: An object
|
44
43
|
# containing the fields to POST for the request. See the corresponding
|
45
44
|
# object definition for field details.
|
@@ -68,14 +67,14 @@ module Square
|
|
68
67
|
# Return appropriate response type.
|
69
68
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
70
69
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
71
|
-
ApiResponse.new(
|
70
|
+
ApiResponse.new(
|
71
|
+
_response, data: decoded, errors: _errors
|
72
|
+
)
|
72
73
|
end
|
73
74
|
|
74
75
|
# Retrieves details of a location. You can specify "main"
|
75
76
|
# as the location ID to retrieve details of the
|
76
|
-
# main location.
|
77
|
-
# see [Locations API
|
78
|
-
# Overview](https://developer.squareup.com/docs/docs/locations-api).
|
77
|
+
# main location.
|
79
78
|
# @param [String] location_id Required parameter: The ID of the location to
|
80
79
|
# retrieve. If you specify the string "main", then the endpoint returns the
|
81
80
|
# main location.
|
@@ -86,7 +85,7 @@ module Square
|
|
86
85
|
_query_builder << '/v2/locations/{location_id}'
|
87
86
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
88
87
|
_query_builder,
|
89
|
-
'location_id' => location_id
|
88
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
90
89
|
)
|
91
90
|
_query_url = APIHelper.clean_url _query_builder
|
92
91
|
|
@@ -106,7 +105,9 @@ module Square
|
|
106
105
|
# Return appropriate response type.
|
107
106
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
108
107
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
109
|
-
ApiResponse.new(
|
108
|
+
ApiResponse.new(
|
109
|
+
_response, data: decoded, errors: _errors
|
110
|
+
)
|
110
111
|
end
|
111
112
|
|
112
113
|
# Updates a location.
|
@@ -123,7 +124,7 @@ module Square
|
|
123
124
|
_query_builder << '/v2/locations/{location_id}'
|
124
125
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
125
126
|
_query_builder,
|
126
|
-
'location_id' => location_id
|
127
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
127
128
|
)
|
128
129
|
_query_url = APIHelper.clean_url _query_builder
|
129
130
|
|
@@ -145,7 +146,9 @@ module Square
|
|
145
146
|
# Return appropriate response type.
|
146
147
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
147
148
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
148
|
-
ApiResponse.new(
|
149
|
+
ApiResponse.new(
|
150
|
+
_response, data: decoded, errors: _errors
|
151
|
+
)
|
149
152
|
end
|
150
153
|
end
|
151
154
|
end
|
@@ -5,10 +5,7 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Creates a loyalty account.
|
9
|
-
# [Create a loyalty
|
10
|
-
# account](https://developer.squareup.com/docs/docs/loyalty-api/overview/#lo
|
11
|
-
# yalty-overview-create-account).
|
8
|
+
# Creates a loyalty account.
|
12
9
|
# @param [CreateLoyaltyAccountRequest] body Required parameter: An object
|
13
10
|
# containing the fields to POST for the request. See the corresponding
|
14
11
|
# object definition for field details.
|
@@ -37,13 +34,16 @@ module Square
|
|
37
34
|
# Return appropriate response type.
|
38
35
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
39
36
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
40
|
-
ApiResponse.new(
|
37
|
+
ApiResponse.new(
|
38
|
+
_response, data: decoded, errors: _errors
|
39
|
+
)
|
41
40
|
end
|
42
41
|
|
43
|
-
# Searches for loyalty accounts.
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
42
|
+
# Searches for loyalty accounts in a loyalty program.
|
43
|
+
# You can search for a loyalty account using the phone number or customer ID
|
44
|
+
# associated with the account. To return all loyalty accounts, specify an
|
45
|
+
# empty `query` object or omit it entirely.
|
46
|
+
# Search results are sorted by `created_at` in ascending order.
|
47
47
|
# @param [SearchLoyaltyAccountsRequest] body Required parameter: An object
|
48
48
|
# containing the fields to POST for the request. See the corresponding
|
49
49
|
# object definition for field details.
|
@@ -72,7 +72,9 @@ module Square
|
|
72
72
|
# Return appropriate response type.
|
73
73
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
74
74
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
75
|
-
ApiResponse.new(
|
75
|
+
ApiResponse.new(
|
76
|
+
_response, data: decoded, errors: _errors
|
77
|
+
)
|
76
78
|
end
|
77
79
|
|
78
80
|
# Retrieves a loyalty account.
|
@@ -85,7 +87,7 @@ module Square
|
|
85
87
|
_query_builder << '/v2/loyalty/accounts/{account_id}'
|
86
88
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
87
89
|
_query_builder,
|
88
|
-
'account_id' => account_id
|
90
|
+
'account_id' => { 'value' => account_id, 'encode' => true }
|
89
91
|
)
|
90
92
|
_query_url = APIHelper.clean_url _query_builder
|
91
93
|
|
@@ -105,7 +107,9 @@ module Square
|
|
105
107
|
# Return appropriate response type.
|
106
108
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
107
109
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
108
|
-
ApiResponse.new(
|
110
|
+
ApiResponse.new(
|
111
|
+
_response, data: decoded, errors: _errors
|
112
|
+
)
|
109
113
|
end
|
110
114
|
|
111
115
|
# Adds points to a loyalty account.
|
@@ -116,13 +120,11 @@ module Square
|
|
116
120
|
# - If you are not using the Orders API to manage orders,
|
117
121
|
# you first perform a client-side computation to compute the points.
|
118
122
|
# For spend-based and visit-based programs, you can call
|
119
|
-
#
|
123
|
+
# [CalculateLoyaltyPoints](#endpoint-Loyalty-CalculateLoyaltyPoints) to
|
124
|
+
# compute the points. For more information,
|
120
125
|
# see [Loyalty Program
|
121
126
|
# Overview](https://developer.squareup.com/docs/docs/loyalty/overview).
|
122
127
|
# You then provide the points in a request to this endpoint.
|
123
|
-
# For more information, see [Accumulate
|
124
|
-
# points](https://developer.squareup.com/docs/docs/loyalty-api/overview/#acc
|
125
|
-
# umulate-points).
|
126
128
|
# @param [String] account_id Required parameter: The [loyalty
|
127
129
|
# account](#type-LoyaltyAccount) ID to which to add the points.
|
128
130
|
# @param [AccumulateLoyaltyPointsRequest] body Required parameter: An object
|
@@ -136,7 +138,7 @@ module Square
|
|
136
138
|
_query_builder << '/v2/loyalty/accounts/{account_id}/accumulate'
|
137
139
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
138
140
|
_query_builder,
|
139
|
-
'account_id' => account_id
|
141
|
+
'account_id' => { 'value' => account_id, 'encode' => true }
|
140
142
|
)
|
141
143
|
_query_url = APIHelper.clean_url _query_builder
|
142
144
|
|
@@ -158,14 +160,15 @@ module Square
|
|
158
160
|
# Return appropriate response type.
|
159
161
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
160
162
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
161
|
-
ApiResponse.new(
|
163
|
+
ApiResponse.new(
|
164
|
+
_response, data: decoded, errors: _errors
|
165
|
+
)
|
162
166
|
end
|
163
167
|
|
164
168
|
# Adds points to or subtracts points from a buyer's account.
|
165
169
|
# Use this endpoint only when you need to manually adjust points. Otherwise,
|
166
170
|
# in your application flow, you call
|
167
|
-
# [AccumulateLoyaltyPoints](
|
168
|
-
# uare/loyalty-api/accumulate-loyalty-points)
|
171
|
+
# [AccumulateLoyaltyPoints](#endpoint-Loyalty-AccumulateLoyaltyPoints)
|
169
172
|
# to add points when a buyer pays for the purchase.
|
170
173
|
# @param [String] account_id Required parameter: The ID of the [loyalty
|
171
174
|
# account](#type-LoyaltyAccount) in which to adjust the points.
|
@@ -180,7 +183,7 @@ module Square
|
|
180
183
|
_query_builder << '/v2/loyalty/accounts/{account_id}/adjust'
|
181
184
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
182
185
|
_query_builder,
|
183
|
-
'account_id' => account_id
|
186
|
+
'account_id' => { 'value' => account_id, 'encode' => true }
|
184
187
|
)
|
185
188
|
_query_url = APIHelper.clean_url _query_builder
|
186
189
|
|
@@ -202,7 +205,9 @@ module Square
|
|
202
205
|
# Return appropriate response type.
|
203
206
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
204
207
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
205
|
-
ApiResponse.new(
|
208
|
+
ApiResponse.new(
|
209
|
+
_response, data: decoded, errors: _errors
|
210
|
+
)
|
206
211
|
end
|
207
212
|
|
208
213
|
# Searches for loyalty events.
|
@@ -212,10 +217,6 @@ module Square
|
|
212
217
|
# (for example, points earned, points redeemed, and points expired) is
|
213
218
|
# recorded in the ledger. Using this endpoint, you can search the ledger for
|
214
219
|
# events.
|
215
|
-
# For more information, see
|
216
|
-
# [Loyalty
|
217
|
-
# events](https://developer.squareup.com/docs/docs/loyalty-api/overview/#loy
|
218
|
-
# alty-events).
|
219
220
|
# @param [SearchLoyaltyEventsRequest] body Required parameter: An object
|
220
221
|
# containing the fields to POST for the request. See the corresponding
|
221
222
|
# object definition for field details.
|
@@ -244,15 +245,13 @@ module Square
|
|
244
245
|
# Return appropriate response type.
|
245
246
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
246
247
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
247
|
-
ApiResponse.new(
|
248
|
+
ApiResponse.new(
|
249
|
+
_response, data: decoded, errors: _errors
|
250
|
+
)
|
248
251
|
end
|
249
252
|
|
250
253
|
# Returns a list of loyalty programs in the seller's account.
|
251
|
-
# Currently, a seller can only have one loyalty program.
|
252
|
-
# information, see
|
253
|
-
# [Loyalty
|
254
|
-
# Overview](https://developer.squareup.com/docs/docs/loyalty/overview).
|
255
|
-
# .
|
254
|
+
# Currently, a seller can only have one loyalty program.
|
256
255
|
# @return [ListLoyaltyProgramsResponse Hash] response from the API call
|
257
256
|
def list_loyalty_programs
|
258
257
|
# Prepare query url.
|
@@ -276,7 +275,9 @@ module Square
|
|
276
275
|
# Return appropriate response type.
|
277
276
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
278
277
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
279
|
-
ApiResponse.new(
|
278
|
+
ApiResponse.new(
|
279
|
+
_response, data: decoded, errors: _errors
|
280
|
+
)
|
280
281
|
end
|
281
282
|
|
282
283
|
# Calculates the points a purchase earns.
|
@@ -303,7 +304,7 @@ module Square
|
|
303
304
|
_query_builder << '/v2/loyalty/programs/{program_id}/calculate'
|
304
305
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
305
306
|
_query_builder,
|
306
|
-
'program_id' => program_id
|
307
|
+
'program_id' => { 'value' => program_id, 'encode' => true }
|
307
308
|
)
|
308
309
|
_query_url = APIHelper.clean_url _query_builder
|
309
310
|
|
@@ -325,7 +326,9 @@ module Square
|
|
325
326
|
# Return appropriate response type.
|
326
327
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
327
328
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
328
|
-
ApiResponse.new(
|
329
|
+
ApiResponse.new(
|
330
|
+
_response, data: decoded, errors: _errors
|
331
|
+
)
|
329
332
|
end
|
330
333
|
|
331
334
|
# Creates a loyalty reward. In the process, the endpoint does following:
|
@@ -336,10 +339,6 @@ module Square
|
|
336
339
|
# discount to the order.
|
337
340
|
# After a reward is created, the points are locked and
|
338
341
|
# not available for the buyer to redeem another reward.
|
339
|
-
# For more information, see
|
340
|
-
# [Loyalty
|
341
|
-
# rewards](https://developer.squareup.com/docs/docs/loyalty-api/overview/#lo
|
342
|
-
# yalty-overview-loyalty-rewards).
|
343
342
|
# @param [CreateLoyaltyRewardRequest] body Required parameter: An object
|
344
343
|
# containing the fields to POST for the request. See the corresponding
|
345
344
|
# object definition for field details.
|
@@ -368,19 +367,16 @@ module Square
|
|
368
367
|
# Return appropriate response type.
|
369
368
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
370
369
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
371
|
-
ApiResponse.new(
|
370
|
+
ApiResponse.new(
|
371
|
+
_response, data: decoded, errors: _errors
|
372
|
+
)
|
372
373
|
end
|
373
374
|
|
374
375
|
# Searches for loyalty rewards in a loyalty account.
|
375
376
|
# In the current implementation, the endpoint supports search by the reward
|
376
377
|
# `status`.
|
377
378
|
# If you know a reward ID, use the
|
378
|
-
# [RetrieveLoyaltyReward](
|
379
|
-
# re/loyalty-api/retrieve-loyalty-reward) endpoint.
|
380
|
-
# For more information about loyalty rewards, see
|
381
|
-
# [Loyalty
|
382
|
-
# Rewards](https://developer.squareup.com/docs/docs/loyalty-api/overview/#lo
|
383
|
-
# yalty-rewards).
|
379
|
+
# [RetrieveLoyaltyReward](#endpoint-Loyalty-RetrieveLoyaltyReward) endpoint.
|
384
380
|
# @param [SearchLoyaltyRewardsRequest] body Required parameter: An object
|
385
381
|
# containing the fields to POST for the request. See the corresponding
|
386
382
|
# object definition for field details.
|
@@ -409,22 +405,18 @@ module Square
|
|
409
405
|
# Return appropriate response type.
|
410
406
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
411
407
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
412
|
-
ApiResponse.new(
|
408
|
+
ApiResponse.new(
|
409
|
+
_response, data: decoded, errors: _errors
|
410
|
+
)
|
413
411
|
end
|
414
412
|
|
415
413
|
# Deletes a loyalty reward by doing the following:
|
416
414
|
# - Returns the loyalty points back to the loyalty account.
|
417
415
|
# - If an order ID was specified when the reward was created
|
418
|
-
# (see
|
419
|
-
# [CreateLoyaltyReward](https://developer.squareup.com/docs/reference/square
|
420
|
-
# /loyalty-api/create-loyalty-reward)),
|
416
|
+
# (see [CreateLoyaltyReward](#endpoint-Loyalty-CreateLoyaltyReward)),
|
421
417
|
# it updates the order by removing the reward and related
|
422
418
|
# discounts.
|
423
419
|
# You cannot delete a reward that has reached the terminal state (REDEEMED).
|
424
|
-
# For more information, see
|
425
|
-
# [Loyalty
|
426
|
-
# rewards](https://developer.squareup.com/docs/docs/loyalty-api/overview/#lo
|
427
|
-
# yalty-overview-loyalty-rewards).
|
428
420
|
# @param [String] reward_id Required parameter: The ID of the [loyalty
|
429
421
|
# reward](#type-LoyaltyReward) to delete.
|
430
422
|
# @return [DeleteLoyaltyRewardResponse Hash] response from the API call
|
@@ -434,7 +426,7 @@ module Square
|
|
434
426
|
_query_builder << '/v2/loyalty/rewards/{reward_id}'
|
435
427
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
436
428
|
_query_builder,
|
437
|
-
'reward_id' => reward_id
|
429
|
+
'reward_id' => { 'value' => reward_id, 'encode' => true }
|
438
430
|
)
|
439
431
|
_query_url = APIHelper.clean_url _query_builder
|
440
432
|
|
@@ -454,7 +446,9 @@ module Square
|
|
454
446
|
# Return appropriate response type.
|
455
447
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
456
448
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
457
|
-
ApiResponse.new(
|
449
|
+
ApiResponse.new(
|
450
|
+
_response, data: decoded, errors: _errors
|
451
|
+
)
|
458
452
|
end
|
459
453
|
|
460
454
|
# Retrieves a loyalty reward.
|
@@ -467,7 +461,7 @@ module Square
|
|
467
461
|
_query_builder << '/v2/loyalty/rewards/{reward_id}'
|
468
462
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
469
463
|
_query_builder,
|
470
|
-
'reward_id' => reward_id
|
464
|
+
'reward_id' => { 'value' => reward_id, 'encode' => true }
|
471
465
|
)
|
472
466
|
_query_url = APIHelper.clean_url _query_builder
|
473
467
|
|
@@ -487,21 +481,19 @@ module Square
|
|
487
481
|
# Return appropriate response type.
|
488
482
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
489
483
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
490
|
-
ApiResponse.new(
|
484
|
+
ApiResponse.new(
|
485
|
+
_response, data: decoded, errors: _errors
|
486
|
+
)
|
491
487
|
end
|
492
488
|
|
493
489
|
# Redeems a loyalty reward.
|
494
|
-
# The endpoint sets the reward to the terminal state
|
490
|
+
# The endpoint sets the reward to the `REDEEMED` terminal state.
|
495
491
|
# If you are using your own order processing system (not using the
|
496
492
|
# Orders API), you call this endpoint after the buyer paid for the
|
497
493
|
# purchase.
|
498
494
|
# After the reward reaches the terminal state, it cannot be deleted.
|
499
495
|
# In other words, points used for the reward cannot be returned
|
500
496
|
# to the account.
|
501
|
-
# For more information, see
|
502
|
-
# [Loyalty
|
503
|
-
# rewards](https://developer.squareup.com/docs/docs/loyalty-api/overview/#lo
|
504
|
-
# yalty-overview-loyalty-rewards).
|
505
497
|
# @param [String] reward_id Required parameter: The ID of the [loyalty
|
506
498
|
# reward](#type-LoyaltyReward) to redeem.
|
507
499
|
# @param [RedeemLoyaltyRewardRequest] body Required parameter: An object
|
@@ -515,7 +507,7 @@ module Square
|
|
515
507
|
_query_builder << '/v2/loyalty/rewards/{reward_id}/redeem'
|
516
508
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
517
509
|
_query_builder,
|
518
|
-
'reward_id' => reward_id
|
510
|
+
'reward_id' => { 'value' => reward_id, 'encode' => true }
|
519
511
|
)
|
520
512
|
_query_url = APIHelper.clean_url _query_builder
|
521
513
|
|
@@ -537,7 +529,9 @@ module Square
|
|
537
529
|
# Return appropriate response type.
|
538
530
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
539
531
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
540
|
-
ApiResponse.new(
|
532
|
+
ApiResponse.new(
|
533
|
+
_response, data: decoded, errors: _errors
|
534
|
+
)
|
541
535
|
end
|
542
536
|
end
|
543
537
|
end
|
@@ -43,7 +43,9 @@ module Square
|
|
43
43
|
# Return appropriate response type.
|
44
44
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
45
45
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
46
|
-
ApiResponse.new(
|
46
|
+
ApiResponse.new(
|
47
|
+
_response, data: decoded, errors: _errors
|
48
|
+
)
|
47
49
|
end
|
48
50
|
|
49
51
|
# Retrieve a `Merchant` object for the given `merchant_id`.
|
@@ -57,7 +59,7 @@ module Square
|
|
57
59
|
_query_builder << '/v2/merchants/{merchant_id}'
|
58
60
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
59
61
|
_query_builder,
|
60
|
-
'merchant_id' => merchant_id
|
62
|
+
'merchant_id' => { 'value' => merchant_id, 'encode' => true }
|
61
63
|
)
|
62
64
|
_query_url = APIHelper.clean_url _query_builder
|
63
65
|
|
@@ -77,7 +79,9 @@ module Square
|
|
77
79
|
# Return appropriate response type.
|
78
80
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
79
81
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
80
|
-
ApiResponse.new(
|
82
|
+
ApiResponse.new(
|
83
|
+
_response, data: decoded, errors: _errors
|
84
|
+
)
|
81
85
|
end
|
82
86
|
end
|
83
87
|
end
|
@@ -46,7 +46,9 @@ module Square
|
|
46
46
|
# Return appropriate response type.
|
47
47
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
48
48
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
49
|
-
ApiResponse.new(
|
49
|
+
ApiResponse.new(
|
50
|
+
_response, data: decoded, errors: _errors
|
51
|
+
)
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
@@ -44,7 +44,7 @@ module Square
|
|
44
44
|
_query_builder << '/oauth2/clients/{client_id}/access-token/renew'
|
45
45
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
46
46
|
_query_builder,
|
47
|
-
'client_id' => client_id
|
47
|
+
'client_id' => { 'value' => client_id, 'encode' => true }
|
48
48
|
)
|
49
49
|
_query_url = APIHelper.clean_url _query_builder
|
50
50
|
|
@@ -66,7 +66,9 @@ module Square
|
|
66
66
|
# Return appropriate response type.
|
67
67
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
68
68
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
69
|
-
ApiResponse.new(
|
69
|
+
ApiResponse.new(
|
70
|
+
_response, data: decoded, errors: _errors
|
71
|
+
)
|
70
72
|
end
|
71
73
|
|
72
74
|
# Revokes an access token generated with the OAuth flow.
|
@@ -115,7 +117,9 @@ module Square
|
|
115
117
|
# Return appropriate response type.
|
116
118
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
117
119
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
118
|
-
ApiResponse.new(
|
120
|
+
ApiResponse.new(
|
121
|
+
_response, data: decoded, errors: _errors
|
122
|
+
)
|
119
123
|
end
|
120
124
|
|
121
125
|
# Returns an OAuth access token.
|
@@ -157,7 +161,9 @@ module Square
|
|
157
161
|
# Return appropriate response type.
|
158
162
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
159
163
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
160
|
-
ApiResponse.new(
|
164
|
+
ApiResponse.new(
|
165
|
+
_response, data: decoded, errors: _errors
|
166
|
+
)
|
161
167
|
end
|
162
168
|
end
|
163
169
|
end
|