square.rb 9.1.0.20210317 → 12.0.0.20210616
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/README.md +9 -3
- data/lib/square.rb +5 -0
- data/lib/square/api/bank_accounts_api.rb +5 -5
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/bookings_api.rb +3 -5
- data/lib/square/api/cards_api.rb +170 -0
- data/lib/square/api/cash_drawers_api.rb +2 -2
- data/lib/square/api/catalog_api.rb +40 -41
- data/lib/square/api/customer_groups_api.rb +4 -4
- data/lib/square/api/customer_segments_api.rb +4 -4
- data/lib/square/api/customers_api.rb +45 -26
- data/lib/square/api/devices_api.rb +2 -1
- data/lib/square/api/disputes_api.rb +100 -91
- data/lib/square/api/gift_card_activities_api.rb +127 -0
- data/lib/square/api/gift_cards_api.rb +291 -0
- data/lib/square/api/inventory_api.rb +16 -16
- data/lib/square/api/invoices_api.rb +14 -14
- data/lib/square/api/locations_api.rb +1 -2
- data/lib/square/api/loyalty_api.rb +66 -14
- data/lib/square/api/merchants_api.rb +1 -1
- data/lib/square/api/o_auth_api.rb +8 -9
- data/lib/square/api/orders_api.rb +35 -33
- data/lib/square/api/payments_api.rb +4 -1
- data/lib/square/api/refunds_api.rb +4 -1
- data/lib/square/api/sites_api.rb +42 -0
- data/lib/square/api/snippets_api.rb +146 -0
- data/lib/square/api/subscriptions_api.rb +36 -1
- data/lib/square/api/team_api.rb +40 -40
- data/lib/square/api/transactions_api.rb +32 -20
- data/lib/square/api/v1_employees_api.rb +2 -1
- data/lib/square/api/v1_transactions_api.rb +9 -0
- data/lib/square/api_helper.rb +5 -5
- data/lib/square/client.rb +37 -3
- data/lib/square/configuration.rb +23 -8
- data/lib/square/http/faraday_client.rb +5 -2
- data/test/api/test_locations_api.rb +1 -1
- metadata +11 -6
@@ -7,8 +7,7 @@ module Square
|
|
7
7
|
|
8
8
|
# Provides information of all locations of a business.
|
9
9
|
# Many Square API endpoints require a `location_id` parameter.
|
10
|
-
# The `id` field of the [`Location`](
|
11
|
-
# this
|
10
|
+
# The `id` field of the [`Location`]($m/Location) objects returned by this
|
12
11
|
# endpoint correspond to that `location_id` parameter.
|
13
12
|
# @return [ListLocationsResponse Hash] response from the API call
|
14
13
|
def list_locations
|
@@ -5,7 +5,8 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Creates a loyalty account.
|
8
|
+
# Creates a loyalty account. To create a loyalty account, you must provide
|
9
|
+
# the `program_id` and a `mapping` with the `phone_number` of the buyer.
|
9
10
|
# @param [CreateLoyaltyAccountRequest] body Required parameter: An object
|
10
11
|
# containing the fields to POST for the request. See the corresponding
|
11
12
|
# object definition for field details.
|
@@ -79,7 +80,7 @@ module Square
|
|
79
80
|
|
80
81
|
# Retrieves a loyalty account.
|
81
82
|
# @param [String] account_id Required parameter: The ID of the [loyalty
|
82
|
-
# account](
|
83
|
+
# account]($m/LoyaltyAccount) to retrieve.
|
83
84
|
# @return [RetrieveLoyaltyAccountResponse Hash] response from the API call
|
84
85
|
def retrieve_loyalty_account(account_id:)
|
85
86
|
# Prepare query url.
|
@@ -120,13 +121,13 @@ module Square
|
|
120
121
|
# - If you are not using the Orders API to manage orders,
|
121
122
|
# you first perform a client-side computation to compute the points.
|
122
123
|
# For spend-based and visit-based programs, you can call
|
123
|
-
# [CalculateLoyaltyPoints](
|
124
|
-
#
|
124
|
+
# [CalculateLoyaltyPoints]($e/Loyalty/CalculateLoyaltyPoints) to compute the
|
125
|
+
# points. For more information,
|
125
126
|
# see [Loyalty Program
|
126
127
|
# Overview](https://developer.squareup.com/docs/loyalty/overview).
|
127
128
|
# You then provide the points in a request to this endpoint.
|
128
129
|
# @param [String] account_id Required parameter: The [loyalty
|
129
|
-
# account](
|
130
|
+
# account]($m/LoyaltyAccount) ID to which to add the points.
|
130
131
|
# @param [AccumulateLoyaltyPointsRequest] body Required parameter: An object
|
131
132
|
# containing the fields to POST for the request. See the corresponding
|
132
133
|
# object definition for field details.
|
@@ -168,10 +169,10 @@ module Square
|
|
168
169
|
# Adds points to or subtracts points from a buyer's account.
|
169
170
|
# Use this endpoint only when you need to manually adjust points. Otherwise,
|
170
171
|
# in your application flow, you call
|
171
|
-
# [AccumulateLoyaltyPoints](
|
172
|
+
# [AccumulateLoyaltyPoints]($e/Loyalty/AccumulateLoyaltyPoints)
|
172
173
|
# to add points when a buyer pays for the purchase.
|
173
174
|
# @param [String] account_id Required parameter: The ID of the [loyalty
|
174
|
-
# account](
|
175
|
+
# account]($m/LoyaltyAccount) in which to adjust the points.
|
175
176
|
# @param [AdjustLoyaltyPointsRequest] body Required parameter: An object
|
176
177
|
# containing the fields to POST for the request. See the corresponding
|
177
178
|
# object definition for field details.
|
@@ -217,6 +218,7 @@ module Square
|
|
217
218
|
# (for example, points earned, points redeemed, and points expired) is
|
218
219
|
# recorded in the ledger. Using this endpoint, you can search the ledger for
|
219
220
|
# events.
|
221
|
+
# Search results are sorted by `created_at` in descending order.
|
220
222
|
# @param [SearchLoyaltyEventsRequest] body Required parameter: An object
|
221
223
|
# containing the fields to POST for the request. See the corresponding
|
222
224
|
# object definition for field details.
|
@@ -251,9 +253,16 @@ module Square
|
|
251
253
|
end
|
252
254
|
|
253
255
|
# Returns a list of loyalty programs in the seller's account.
|
254
|
-
#
|
256
|
+
# Loyalty programs define how buyers can earn points and redeem points for
|
257
|
+
# rewards. Square sellers can have only one loyalty program, which is
|
258
|
+
# created and managed from the Seller Dashboard. For more information, see
|
259
|
+
# [Loyalty Program
|
260
|
+
# Overview](https://developer.squareup.com/docs/loyalty/overview).
|
261
|
+
# Replaced with [RetrieveLoyaltyProgram]($e/Loyalty/RetrieveLoyaltyProgram)
|
262
|
+
# when used with the keyword `main`.
|
255
263
|
# @return [ListLoyaltyProgramsResponse Hash] response from the API call
|
256
264
|
def list_loyalty_programs
|
265
|
+
warn 'Endpoint list_loyalty_programs in LoyaltyApi is deprecated'
|
257
266
|
# Prepare query url.
|
258
267
|
_query_builder = config.get_base_uri
|
259
268
|
_query_builder << '/v2/loyalty/programs'
|
@@ -280,6 +289,48 @@ module Square
|
|
280
289
|
)
|
281
290
|
end
|
282
291
|
|
292
|
+
# Retrieves the loyalty program in a seller's account, specified by the
|
293
|
+
# program ID or the keyword `main`.
|
294
|
+
# Loyalty programs define how buyers can earn points and redeem points for
|
295
|
+
# rewards. Square sellers can have only one loyalty program, which is
|
296
|
+
# created and managed from the Seller Dashboard. For more information, see
|
297
|
+
# [Loyalty Program
|
298
|
+
# Overview](https://developer.squareup.com/docs/loyalty/overview).
|
299
|
+
# @param [String] program_id Required parameter: The ID of the loyalty
|
300
|
+
# program or the keyword `main`. Either value can be used to retrieve the
|
301
|
+
# single loyalty program that belongs to the seller.
|
302
|
+
# @return [RetrieveLoyaltyProgramResponse Hash] response from the API call
|
303
|
+
def retrieve_loyalty_program(program_id:)
|
304
|
+
# Prepare query url.
|
305
|
+
_query_builder = config.get_base_uri
|
306
|
+
_query_builder << '/v2/loyalty/programs/{program_id}'
|
307
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
308
|
+
_query_builder,
|
309
|
+
'program_id' => { 'value' => program_id, 'encode' => true }
|
310
|
+
)
|
311
|
+
_query_url = APIHelper.clean_url _query_builder
|
312
|
+
|
313
|
+
# Prepare headers.
|
314
|
+
_headers = {
|
315
|
+
'accept' => 'application/json'
|
316
|
+
}
|
317
|
+
|
318
|
+
# Prepare and execute HttpRequest.
|
319
|
+
_request = config.http_client.get(
|
320
|
+
_query_url,
|
321
|
+
headers: _headers
|
322
|
+
)
|
323
|
+
OAuth2.apply(config, _request)
|
324
|
+
_response = execute_request(_request)
|
325
|
+
|
326
|
+
# Return appropriate response type.
|
327
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
328
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
329
|
+
ApiResponse.new(
|
330
|
+
_response, data: decoded, errors: _errors
|
331
|
+
)
|
332
|
+
end
|
333
|
+
|
283
334
|
# Calculates the points a purchase earns.
|
284
335
|
# - If you are using the Orders API to manage orders, you provide `order_id`
|
285
336
|
# in the request. The
|
@@ -291,7 +342,7 @@ module Square
|
|
291
342
|
# can earn with the
|
292
343
|
# specific purchase.
|
293
344
|
# @param [String] program_id Required parameter: The [loyalty
|
294
|
-
# program](
|
345
|
+
# program]($m/LoyaltyProgram) ID, which defines the rules for accruing
|
295
346
|
# points.
|
296
347
|
# @param [CalculateLoyaltyPointsRequest] body Required parameter: An object
|
297
348
|
# containing the fields to POST for the request. See the corresponding
|
@@ -376,7 +427,8 @@ module Square
|
|
376
427
|
# In the current implementation, the endpoint supports search by the reward
|
377
428
|
# `status`.
|
378
429
|
# If you know a reward ID, use the
|
379
|
-
# [RetrieveLoyaltyReward](
|
430
|
+
# [RetrieveLoyaltyReward]($e/Loyalty/RetrieveLoyaltyReward) endpoint.
|
431
|
+
# Search results are sorted by `updated_at` in descending order.
|
380
432
|
# @param [SearchLoyaltyRewardsRequest] body Required parameter: An object
|
381
433
|
# containing the fields to POST for the request. See the corresponding
|
382
434
|
# object definition for field details.
|
@@ -413,12 +465,12 @@ module Square
|
|
413
465
|
# Deletes a loyalty reward by doing the following:
|
414
466
|
# - Returns the loyalty points back to the loyalty account.
|
415
467
|
# - If an order ID was specified when the reward was created
|
416
|
-
# (see [CreateLoyaltyReward](
|
468
|
+
# (see [CreateLoyaltyReward]($e/Loyalty/CreateLoyaltyReward)),
|
417
469
|
# it updates the order by removing the reward and related
|
418
470
|
# discounts.
|
419
471
|
# You cannot delete a reward that has reached the terminal state (REDEEMED).
|
420
472
|
# @param [String] reward_id Required parameter: The ID of the [loyalty
|
421
|
-
# reward](
|
473
|
+
# reward]($m/LoyaltyReward) to delete.
|
422
474
|
# @return [DeleteLoyaltyRewardResponse Hash] response from the API call
|
423
475
|
def delete_loyalty_reward(reward_id:)
|
424
476
|
# Prepare query url.
|
@@ -453,7 +505,7 @@ module Square
|
|
453
505
|
|
454
506
|
# Retrieves a loyalty reward.
|
455
507
|
# @param [String] reward_id Required parameter: The ID of the [loyalty
|
456
|
-
# reward](
|
508
|
+
# reward]($m/LoyaltyReward) to retrieve.
|
457
509
|
# @return [RetrieveLoyaltyRewardResponse Hash] response from the API call
|
458
510
|
def retrieve_loyalty_reward(reward_id:)
|
459
511
|
# Prepare query url.
|
@@ -495,7 +547,7 @@ module Square
|
|
495
547
|
# In other words, points used for the reward cannot be returned
|
496
548
|
# to the account.
|
497
549
|
# @param [String] reward_id Required parameter: The ID of the [loyalty
|
498
|
-
# reward](
|
550
|
+
# reward]($m/LoyaltyReward) to redeem.
|
499
551
|
# @param [RedeemLoyaltyRewardRequest] body Required parameter: An object
|
500
552
|
# containing the fields to POST for the request. See the corresponding
|
501
553
|
# object definition for field details.
|
@@ -12,7 +12,7 @@ module Square
|
|
12
12
|
# information or specify an OAuth token
|
13
13
|
# to get the information for the merchant that granted you access.
|
14
14
|
# If you know the merchant ID, you can also use the
|
15
|
-
# [RetrieveMerchant](
|
15
|
+
# [RetrieveMerchant]($e/Merchants/RetrieveMerchant)
|
16
16
|
# endpoint to get the merchant information.
|
17
17
|
# @param [Integer] cursor Optional parameter: The cursor generated by the
|
18
18
|
# previous response.
|
@@ -7,9 +7,9 @@ module Square
|
|
7
7
|
|
8
8
|
# `RenewToken` is deprecated. For information about refreshing OAuth access
|
9
9
|
# tokens, see
|
10
|
-
# [Renew OAuth
|
11
|
-
#
|
12
|
-
#
|
10
|
+
# [Migrate from Renew to Refresh OAuth
|
11
|
+
# Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refresh-t
|
12
|
+
# okens).
|
13
13
|
# Renews an OAuth access token before it expires.
|
14
14
|
# OAuth access tokens besides your application's personal access token
|
15
15
|
# expire after __30 days__.
|
@@ -25,10 +25,10 @@ module Square
|
|
25
25
|
# ```
|
26
26
|
# Replace `APPLICATION_SECRET` with the application secret on the
|
27
27
|
# Credentials
|
28
|
-
# page in the [
|
28
|
+
# page in the [developer dashboard](https://developer.squareup.com/apps).
|
29
29
|
# @param [String] client_id Required parameter: Your application ID,
|
30
|
-
# available from the [
|
31
|
-
# dashboard](https://
|
30
|
+
# available from the [developer
|
31
|
+
# dashboard](https://developer.squareup.com/apps).
|
32
32
|
# @param [RenewTokenRequest] body Required parameter: An object containing
|
33
33
|
# the fields to POST for the request. See the corresponding object
|
34
34
|
# definition for field details.
|
@@ -83,9 +83,8 @@ module Square
|
|
83
83
|
# ```
|
84
84
|
# Authorization: Client APPLICATION_SECRET
|
85
85
|
# ```
|
86
|
-
# Replace `APPLICATION_SECRET` with the application secret on the
|
87
|
-
#
|
88
|
-
# page in the [Developer Dashboard](https://developer.squareup.com/apps).
|
86
|
+
# Replace `APPLICATION_SECRET` with the application secret on the OAuth
|
87
|
+
# page in the [developer dashboard](https://developer.squareup.com/apps).
|
89
88
|
# @param [RevokeTokenRequest] body Required parameter: An object containing
|
90
89
|
# the fields to POST for the request. See the corresponding object
|
91
90
|
# definition for field details.
|
@@ -5,14 +5,14 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Creates a new [
|
8
|
+
# Creates a new [order]($m/Order) that can include information about
|
9
9
|
# products for
|
10
10
|
# purchase and settings to apply to the purchase.
|
11
|
-
# To pay for a created order,
|
12
|
-
#
|
13
|
-
#
|
14
|
-
# You can modify open orders using the
|
15
|
-
#
|
11
|
+
# To pay for a created order, see
|
12
|
+
# [Pay for
|
13
|
+
# Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
|
14
|
+
# You can modify open orders using the [UpdateOrder]($e/Orders/UpdateOrder)
|
15
|
+
# endpoint.
|
16
16
|
# @param [CreateOrderRequest] body Required parameter: An object containing
|
17
17
|
# the fields to POST for the request. See the corresponding object
|
18
18
|
# definition for field details.
|
@@ -46,8 +46,8 @@ module Square
|
|
46
46
|
)
|
47
47
|
end
|
48
48
|
|
49
|
-
# Retrieves a set of [
|
50
|
-
# If a given
|
49
|
+
# Retrieves a set of [orders]($m/Order) by their IDs.
|
50
|
+
# If a given order ID does not exist, the ID is ignored instead of
|
51
51
|
# generating an error.
|
52
52
|
# @param [BatchRetrieveOrdersRequest] body Required parameter: An object
|
53
53
|
# containing the fields to POST for the request. See the corresponding
|
@@ -82,7 +82,7 @@ module Square
|
|
82
82
|
)
|
83
83
|
end
|
84
84
|
|
85
|
-
#
|
85
|
+
# Enables applications to preview order pricing without creating an order.
|
86
86
|
# @param [CalculateOrderRequest] body Required parameter: An object
|
87
87
|
# containing the fields to POST for the request. See the corresponding
|
88
88
|
# object definition for field details.
|
@@ -118,17 +118,18 @@ module Square
|
|
118
118
|
|
119
119
|
# Search all orders for one or more locations. Orders include all sales,
|
120
120
|
# returns, and exchanges regardless of how or when they entered the Square
|
121
|
-
#
|
122
|
-
# SearchOrders requests need to specify which locations to search and
|
123
|
-
# a
|
124
|
-
# [
|
125
|
-
# how to sort or filter the results. Your SearchOrdersQuery can:
|
121
|
+
# ecosystem (such as Point of Sale, Invoices, and Connect APIs).
|
122
|
+
# `SearchOrders` requests need to specify which locations to search and
|
123
|
+
# define a
|
124
|
+
# [SearchOrdersQuery]($m/SearchOrdersQuery) object that controls
|
125
|
+
# how to sort or filter the results. Your `SearchOrdersQuery` can:
|
126
126
|
# Set filter criteria.
|
127
|
-
# Set sort order.
|
128
|
-
# Determine whether to return results as complete Order objects
|
129
|
-
# [OrderEntry](
|
127
|
+
# Set the sort order.
|
128
|
+
# Determine whether to return results as complete `Order` objects or as
|
129
|
+
# [OrderEntry]($m/OrderEntry) objects.
|
130
130
|
# Note that details for orders processed with Square Point of Sale while in
|
131
|
-
# offline mode
|
131
|
+
# offline mode might not be transmitted to Square for up to 72 hours.
|
132
|
+
# Offline
|
132
133
|
# orders have a `created_at` value that reflects the time the order was
|
133
134
|
# created,
|
134
135
|
# not the time it was subsequently transmitted to Square.
|
@@ -165,7 +166,7 @@ module Square
|
|
165
166
|
)
|
166
167
|
end
|
167
168
|
|
168
|
-
# Retrieves an [Order](
|
169
|
+
# Retrieves an [Order]($m/Order) by ID.
|
169
170
|
# @param [String] order_id Required parameter: The ID of the order to
|
170
171
|
# retrieve.
|
171
172
|
# @return [RetrieveOrderResponse Hash] response from the API call
|
@@ -200,23 +201,24 @@ module Square
|
|
200
201
|
)
|
201
202
|
end
|
202
203
|
|
203
|
-
# Updates an open [
|
204
|
+
# Updates an open [order]($m/Order) by adding, replacing, or deleting
|
204
205
|
# fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated.
|
205
|
-
# An UpdateOrder request requires the following:
|
206
|
+
# An `UpdateOrder` request requires the following:
|
206
207
|
# - The `order_id` in the endpoint path, identifying the order to update.
|
207
208
|
# - The latest `version` of the order to update.
|
208
209
|
# - The [sparse
|
209
210
|
# order](https://developer.squareup.com/docs/orders-api/manage-orders#sparse
|
210
211
|
# -order-objects)
|
211
|
-
# containing only the fields to update and the version the update
|
212
|
-
#
|
212
|
+
# containing only the fields to update and the version to which the update
|
213
|
+
# is
|
214
|
+
# being applied.
|
213
215
|
# - If deleting fields, the [dot notation
|
214
216
|
# paths](https://developer.squareup.com/docs/orders-api/manage-orders#on-dot
|
215
217
|
# -notation)
|
216
|
-
# identifying fields to clear.
|
217
|
-
# To pay for an order,
|
218
|
-
#
|
219
|
-
#
|
218
|
+
# identifying the fields to clear.
|
219
|
+
# To pay for an order, see
|
220
|
+
# [Pay for
|
221
|
+
# Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
|
220
222
|
# @param [String] order_id Required parameter: The ID of the order to
|
221
223
|
# update.
|
222
224
|
# @param [UpdateOrderRequest] body Required parameter: An object containing
|
@@ -257,24 +259,24 @@ module Square
|
|
257
259
|
)
|
258
260
|
end
|
259
261
|
|
260
|
-
# Pay for an [order](
|
261
|
-
# [payments](
|
262
|
+
# Pay for an [order]($m/Order) using one or more approved
|
263
|
+
# [payments]($m/Payment)
|
262
264
|
# or settle an order with a total of `0`.
|
263
265
|
# The total of the `payment_ids` listed in the request must be equal to the
|
264
266
|
# order
|
265
267
|
# total. Orders with a total amount of `0` can be marked as paid by
|
266
268
|
# specifying an empty
|
267
269
|
# array of `payment_ids` in the request.
|
268
|
-
# To be used with PayOrder
|
270
|
+
# To be used with `PayOrder`, a payment must:
|
269
271
|
# - Reference the order by specifying the `order_id` when [creating the
|
270
|
-
# payment](
|
272
|
+
# payment]($e/Payments/CreatePayment).
|
271
273
|
# Any approved payments that reference the same `order_id` not specified in
|
272
274
|
# the
|
273
|
-
# `payment_ids`
|
275
|
+
# `payment_ids` is canceled.
|
274
276
|
# - Be approved with [delayed
|
275
277
|
# capture](https://developer.squareup.com/docs/payments-api/take-payments#de
|
276
278
|
# layed-capture).
|
277
|
-
# Using a delayed capture payment with PayOrder
|
279
|
+
# Using a delayed capture payment with `PayOrder` completes the approved
|
278
280
|
# payment.
|
279
281
|
# @param [String] order_id Required parameter: The ID of the order being
|
280
282
|
# paid.
|
@@ -6,6 +6,9 @@ module Square
|
|
6
6
|
end
|
7
7
|
|
8
8
|
# Retrieves a list of payments taken by the account making the request.
|
9
|
+
# Results are eventually consistent, and new payments or changes to payments
|
10
|
+
# might take several
|
11
|
+
# seconds to appear.
|
9
12
|
# The maximum results per page is 100.
|
10
13
|
# @param [String] begin_time Optional parameter: The timestamp for the
|
11
14
|
# beginning of the reporting period, in RFC 3339 format. Inclusive. Default:
|
@@ -88,7 +91,7 @@ module Square
|
|
88
91
|
# Square gift card) or record a payment that the seller received outside of
|
89
92
|
# Square
|
90
93
|
# (cash payment from a buyer or a payment that an external entity
|
91
|
-
#
|
94
|
+
# processed on behalf of the seller).
|
92
95
|
# The endpoint creates a
|
93
96
|
# `Payment` object and returns it in the response.
|
94
97
|
# @param [CreatePaymentRequest] body Required parameter: An object
|
@@ -6,6 +6,9 @@ module Square
|
|
6
6
|
end
|
7
7
|
|
8
8
|
# Retrieves a list of refunds for the account making the request.
|
9
|
+
# Results are eventually consistent, and new refunds or changes to refunds
|
10
|
+
# might take several
|
11
|
+
# seconds to appear.
|
9
12
|
# The maximum results per page is 100.
|
10
13
|
# @param [String] begin_time Optional parameter: The timestamp for the
|
11
14
|
# beginning of the requested reporting period, in RFC 3339 format. Default:
|
@@ -26,7 +29,7 @@ module Square
|
|
26
29
|
# associated with the seller.
|
27
30
|
# @param [String] status Optional parameter: If provided, only refunds with
|
28
31
|
# the given status are returned. For a list of refund status values, see
|
29
|
-
# [PaymentRefund](
|
32
|
+
# [PaymentRefund]($m/PaymentRefund). Default: If omitted, refunds are
|
30
33
|
# returned regardless of their status.
|
31
34
|
# @param [String] source_type Optional parameter: If provided, only refunds
|
32
35
|
# with the given source type are returned. - `CARD` - List refunds only for
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Square
|
2
|
+
# SitesApi
|
3
|
+
class SitesApi < BaseApi
|
4
|
+
def initialize(config, http_call_back: nil)
|
5
|
+
super(config, http_call_back: http_call_back)
|
6
|
+
end
|
7
|
+
|
8
|
+
# Lists the Square Online sites that belong to a seller.
|
9
|
+
# __Note:__ Square Online APIs are publicly available as part of an early
|
10
|
+
# access program. For more information, see [Early access program for Square
|
11
|
+
# Online
|
12
|
+
# APIs](https://developer.squareup.com/docs/online-api#early-access-program-
|
13
|
+
# for-square-online-apis).
|
14
|
+
# @return [ListSitesResponse Hash] response from the API call
|
15
|
+
def list_sites
|
16
|
+
# Prepare query url.
|
17
|
+
_query_builder = config.get_base_uri
|
18
|
+
_query_builder << '/v2/sites'
|
19
|
+
_query_url = APIHelper.clean_url _query_builder
|
20
|
+
|
21
|
+
# Prepare headers.
|
22
|
+
_headers = {
|
23
|
+
'accept' => 'application/json'
|
24
|
+
}
|
25
|
+
|
26
|
+
# Prepare and execute HttpRequest.
|
27
|
+
_request = config.http_client.get(
|
28
|
+
_query_url,
|
29
|
+
headers: _headers
|
30
|
+
)
|
31
|
+
OAuth2.apply(config, _request)
|
32
|
+
_response = execute_request(_request)
|
33
|
+
|
34
|
+
# Return appropriate response type.
|
35
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
36
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
37
|
+
ApiResponse.new(
|
38
|
+
_response, data: decoded, errors: _errors
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|