square.rb 9.1.1.20210317 → 10.0.0.202104217
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/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/cash_drawers_api.rb +2 -2
- data/lib/square/api/catalog_api.rb +32 -36
- 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 -24
- data/lib/square/api/devices_api.rb +2 -1
- data/lib/square/api/disputes_api.rb +4 -6
- 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 +59 -13
- data/lib/square/api/merchants_api.rb +1 -1
- data/lib/square/api/orders_api.rb +17 -15
- data/lib/square/api/payments_api.rb +4 -1
- data/lib/square/api/refunds_api.rb +4 -1
- data/lib/square/api/subscriptions_api.rb +36 -1
- data/lib/square/api/team_api.rb +10 -10
- data/lib/square/api/transactions_api.rb +29 -18
- data/lib/square/api/v1_employees_api.rb +2 -1
- data/lib/square/client.rb +2 -2
- data/lib/square/configuration.rb +1 -1
- data/test/api/test_locations_api.rb +1 -1
- metadata +2 -2
@@ -7,7 +7,7 @@ module Square
|
|
7
7
|
|
8
8
|
# Returns a list of invoices for a given location. The response
|
9
9
|
# is paginated. If truncated, the response includes a `cursor` that you
|
10
|
-
# use in a subsequent request to
|
10
|
+
# use in a subsequent request to retrieve the next set of invoices.
|
11
11
|
# @param [String] location_id Required parameter: The ID of the location for
|
12
12
|
# which to list invoices.
|
13
13
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
@@ -16,7 +16,7 @@ module Square
|
|
16
16
|
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
17
17
|
# ion).
|
18
18
|
# @param [Integer] limit Optional parameter: The maximum number of invoices
|
19
|
-
# to return (200 is the maximum `limit`). If not provided, the server
|
19
|
+
# to return (200 is the maximum `limit`). If not provided, the server uses
|
20
20
|
# a default limit of 100 invoices.
|
21
21
|
# @return [ListInvoicesResponse Hash] response from the API call
|
22
22
|
def list_invoices(location_id:,
|
@@ -54,7 +54,7 @@ module Square
|
|
54
54
|
)
|
55
55
|
end
|
56
56
|
|
57
|
-
# Creates a draft [invoice](
|
57
|
+
# Creates a draft [invoice]($m/Invoice)
|
58
58
|
# for an order created using the Orders API.
|
59
59
|
# A draft invoice remains in your account and no action is taken.
|
60
60
|
# You must publish the invoice before Square can process it (send it to the
|
@@ -98,7 +98,7 @@ module Square
|
|
98
98
|
# location and
|
99
99
|
# optionally one customer.
|
100
100
|
# The response is paginated. If truncated, the response includes a `cursor`
|
101
|
-
# that you use in a subsequent request to
|
101
|
+
# that you use in a subsequent request to retrieve the next set of invoices.
|
102
102
|
# @param [SearchInvoicesRequest] body Required parameter: An object
|
103
103
|
# containing the fields to POST for the request. See the corresponding
|
104
104
|
# object definition for field details.
|
@@ -133,15 +133,15 @@ module Square
|
|
133
133
|
end
|
134
134
|
|
135
135
|
# Deletes the specified invoice. When an invoice is deleted, the
|
136
|
-
# associated
|
136
|
+
# associated order status changes to CANCELED. You can only delete a draft
|
137
137
|
# invoice (you cannot delete a published invoice, including one that is
|
138
138
|
# scheduled for processing).
|
139
139
|
# @param [String] invoice_id Required parameter: The ID of the invoice to
|
140
140
|
# delete.
|
141
141
|
# @param [Integer] version Optional parameter: The version of the
|
142
|
-
# [invoice](
|
143
|
-
#
|
144
|
-
# [ListInvoices](
|
142
|
+
# [invoice]($m/Invoice) to delete. If you do not know the version, you can
|
143
|
+
# call [GetInvoice]($e/Invoices/GetInvoice) or
|
144
|
+
# [ListInvoices]($e/Invoices/ListInvoices).
|
145
145
|
# @return [DeleteInvoiceResponse Hash] response from the API call
|
146
146
|
def delete_invoice(invoice_id:,
|
147
147
|
version: nil)
|
@@ -180,7 +180,7 @@ module Square
|
|
180
180
|
end
|
181
181
|
|
182
182
|
# Retrieves an invoice by invoice ID.
|
183
|
-
# @param [String] invoice_id Required parameter: The
|
183
|
+
# @param [String] invoice_id Required parameter: The ID of the invoice to
|
184
184
|
# retrieve.
|
185
185
|
# @return [GetInvoiceResponse Hash] response from the API call
|
186
186
|
def get_invoice(invoice_id:)
|
@@ -216,10 +216,10 @@ module Square
|
|
216
216
|
|
217
217
|
# Updates an invoice by modifying fields, clearing fields, or both. For most
|
218
218
|
# updates, you can use a sparse
|
219
|
-
# `Invoice` object to add fields or change values
|
219
|
+
# `Invoice` object to add fields or change values and use the
|
220
220
|
# `fields_to_clear` field to specify fields to clear.
|
221
221
|
# However, some restrictions apply. For example, you cannot change the
|
222
|
-
# `order_id` or `location_id` field
|
222
|
+
# `order_id` or `location_id` field and you
|
223
223
|
# must provide the complete `custom_fields` list to update a custom field.
|
224
224
|
# Published invoices have additional restrictions.
|
225
225
|
# @param [String] invoice_id Required parameter: The ID of the invoice to
|
@@ -267,7 +267,7 @@ module Square
|
|
267
267
|
# You cannot cancel an invoice in the `DRAFT` state or in a terminal state:
|
268
268
|
# `PAID`, `REFUNDED`, `CANCELED`, or `FAILED`.
|
269
269
|
# @param [String] invoice_id Required parameter: The ID of the
|
270
|
-
# [invoice](
|
270
|
+
# [invoice]($m/Invoice) to cancel.
|
271
271
|
# @param [CancelInvoiceRequest] body Required parameter: An object
|
272
272
|
# containing the fields to POST for the request. See the corresponding
|
273
273
|
# object definition for field details.
|
@@ -318,8 +318,8 @@ module Square
|
|
318
318
|
# `UNPAID` if
|
319
319
|
# Square emails the invoice or `PARTIALLY_PAID` if Square charge a card on
|
320
320
|
# file for a portion of the
|
321
|
-
# invoice amount
|
322
|
-
# @param [String] invoice_id Required parameter: The
|
321
|
+
# invoice amount.
|
322
|
+
# @param [String] invoice_id Required parameter: The ID of the invoice to
|
323
323
|
# publish.
|
324
324
|
# @param [PublishInvoiceRequest] body Required parameter: An object
|
325
325
|
# containing the fields to POST for the request. See the corresponding
|
@@ -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,9 @@ 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 either the `mapping` field (preferred) or the
|
10
|
+
# `mappings` field.
|
9
11
|
# @param [CreateLoyaltyAccountRequest] body Required parameter: An object
|
10
12
|
# containing the fields to POST for the request. See the corresponding
|
11
13
|
# object definition for field details.
|
@@ -79,7 +81,7 @@ module Square
|
|
79
81
|
|
80
82
|
# Retrieves a loyalty account.
|
81
83
|
# @param [String] account_id Required parameter: The ID of the [loyalty
|
82
|
-
# account](
|
84
|
+
# account]($m/LoyaltyAccount) to retrieve.
|
83
85
|
# @return [RetrieveLoyaltyAccountResponse Hash] response from the API call
|
84
86
|
def retrieve_loyalty_account(account_id:)
|
85
87
|
# Prepare query url.
|
@@ -120,13 +122,13 @@ module Square
|
|
120
122
|
# - If you are not using the Orders API to manage orders,
|
121
123
|
# you first perform a client-side computation to compute the points.
|
122
124
|
# For spend-based and visit-based programs, you can call
|
123
|
-
# [CalculateLoyaltyPoints](
|
124
|
-
#
|
125
|
+
# [CalculateLoyaltyPoints]($e/Loyalty/CalculateLoyaltyPoints) to compute the
|
126
|
+
# points. For more information,
|
125
127
|
# see [Loyalty Program
|
126
128
|
# Overview](https://developer.squareup.com/docs/loyalty/overview).
|
127
129
|
# You then provide the points in a request to this endpoint.
|
128
130
|
# @param [String] account_id Required parameter: The [loyalty
|
129
|
-
# account](
|
131
|
+
# account]($m/LoyaltyAccount) ID to which to add the points.
|
130
132
|
# @param [AccumulateLoyaltyPointsRequest] body Required parameter: An object
|
131
133
|
# containing the fields to POST for the request. See the corresponding
|
132
134
|
# object definition for field details.
|
@@ -168,10 +170,10 @@ module Square
|
|
168
170
|
# Adds points to or subtracts points from a buyer's account.
|
169
171
|
# Use this endpoint only when you need to manually adjust points. Otherwise,
|
170
172
|
# in your application flow, you call
|
171
|
-
# [AccumulateLoyaltyPoints](
|
173
|
+
# [AccumulateLoyaltyPoints]($e/Loyalty/AccumulateLoyaltyPoints)
|
172
174
|
# to add points when a buyer pays for the purchase.
|
173
175
|
# @param [String] account_id Required parameter: The ID of the [loyalty
|
174
|
-
# account](
|
176
|
+
# account]($m/LoyaltyAccount) in which to adjust the points.
|
175
177
|
# @param [AdjustLoyaltyPointsRequest] body Required parameter: An object
|
176
178
|
# containing the fields to POST for the request. See the corresponding
|
177
179
|
# object definition for field details.
|
@@ -217,6 +219,7 @@ module Square
|
|
217
219
|
# (for example, points earned, points redeemed, and points expired) is
|
218
220
|
# recorded in the ledger. Using this endpoint, you can search the ledger for
|
219
221
|
# events.
|
222
|
+
# Search results are sorted by `created_at` in descending order.
|
220
223
|
# @param [SearchLoyaltyEventsRequest] body Required parameter: An object
|
221
224
|
# containing the fields to POST for the request. See the corresponding
|
222
225
|
# object definition for field details.
|
@@ -280,6 +283,48 @@ module Square
|
|
280
283
|
)
|
281
284
|
end
|
282
285
|
|
286
|
+
# Retrieves the loyalty program in a seller's account, specified by the
|
287
|
+
# program ID or the keyword `main`.
|
288
|
+
# Loyalty programs define how buyers can earn points and redeem points for
|
289
|
+
# rewards. Square sellers can have only one loyalty program, which is
|
290
|
+
# created and managed from the Seller Dashboard. For more information, see
|
291
|
+
# [Loyalty Program
|
292
|
+
# Overview](https://developer.squareup.com/docs/loyalty/overview).
|
293
|
+
# @param [String] program_id Required parameter: The ID of the loyalty
|
294
|
+
# program or the keyword `main`. Either value can be used to retrieve the
|
295
|
+
# single loyalty program that belongs to the seller.
|
296
|
+
# @return [RetrieveLoyaltyProgramResponse Hash] response from the API call
|
297
|
+
def retrieve_loyalty_program(program_id:)
|
298
|
+
# Prepare query url.
|
299
|
+
_query_builder = config.get_base_uri
|
300
|
+
_query_builder << '/v2/loyalty/programs/{program_id}'
|
301
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
302
|
+
_query_builder,
|
303
|
+
'program_id' => { 'value' => program_id, 'encode' => true }
|
304
|
+
)
|
305
|
+
_query_url = APIHelper.clean_url _query_builder
|
306
|
+
|
307
|
+
# Prepare headers.
|
308
|
+
_headers = {
|
309
|
+
'accept' => 'application/json'
|
310
|
+
}
|
311
|
+
|
312
|
+
# Prepare and execute HttpRequest.
|
313
|
+
_request = config.http_client.get(
|
314
|
+
_query_url,
|
315
|
+
headers: _headers
|
316
|
+
)
|
317
|
+
OAuth2.apply(config, _request)
|
318
|
+
_response = execute_request(_request)
|
319
|
+
|
320
|
+
# Return appropriate response type.
|
321
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
322
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
323
|
+
ApiResponse.new(
|
324
|
+
_response, data: decoded, errors: _errors
|
325
|
+
)
|
326
|
+
end
|
327
|
+
|
283
328
|
# Calculates the points a purchase earns.
|
284
329
|
# - If you are using the Orders API to manage orders, you provide `order_id`
|
285
330
|
# in the request. The
|
@@ -291,7 +336,7 @@ module Square
|
|
291
336
|
# can earn with the
|
292
337
|
# specific purchase.
|
293
338
|
# @param [String] program_id Required parameter: The [loyalty
|
294
|
-
# program](
|
339
|
+
# program]($m/LoyaltyProgram) ID, which defines the rules for accruing
|
295
340
|
# points.
|
296
341
|
# @param [CalculateLoyaltyPointsRequest] body Required parameter: An object
|
297
342
|
# containing the fields to POST for the request. See the corresponding
|
@@ -376,7 +421,8 @@ module Square
|
|
376
421
|
# In the current implementation, the endpoint supports search by the reward
|
377
422
|
# `status`.
|
378
423
|
# If you know a reward ID, use the
|
379
|
-
# [RetrieveLoyaltyReward](
|
424
|
+
# [RetrieveLoyaltyReward]($e/Loyalty/RetrieveLoyaltyReward) endpoint.
|
425
|
+
# Search results are sorted by `updated_at` in descending order.
|
380
426
|
# @param [SearchLoyaltyRewardsRequest] body Required parameter: An object
|
381
427
|
# containing the fields to POST for the request. See the corresponding
|
382
428
|
# object definition for field details.
|
@@ -413,12 +459,12 @@ module Square
|
|
413
459
|
# Deletes a loyalty reward by doing the following:
|
414
460
|
# - Returns the loyalty points back to the loyalty account.
|
415
461
|
# - If an order ID was specified when the reward was created
|
416
|
-
# (see [CreateLoyaltyReward](
|
462
|
+
# (see [CreateLoyaltyReward]($e/Loyalty/CreateLoyaltyReward)),
|
417
463
|
# it updates the order by removing the reward and related
|
418
464
|
# discounts.
|
419
465
|
# You cannot delete a reward that has reached the terminal state (REDEEMED).
|
420
466
|
# @param [String] reward_id Required parameter: The ID of the [loyalty
|
421
|
-
# reward](
|
467
|
+
# reward]($m/LoyaltyReward) to delete.
|
422
468
|
# @return [DeleteLoyaltyRewardResponse Hash] response from the API call
|
423
469
|
def delete_loyalty_reward(reward_id:)
|
424
470
|
# Prepare query url.
|
@@ -453,7 +499,7 @@ module Square
|
|
453
499
|
|
454
500
|
# Retrieves a loyalty reward.
|
455
501
|
# @param [String] reward_id Required parameter: The ID of the [loyalty
|
456
|
-
# reward](
|
502
|
+
# reward]($m/LoyaltyReward) to retrieve.
|
457
503
|
# @return [RetrieveLoyaltyRewardResponse Hash] response from the API call
|
458
504
|
def retrieve_loyalty_reward(reward_id:)
|
459
505
|
# Prepare query url.
|
@@ -495,7 +541,7 @@ module Square
|
|
495
541
|
# In other words, points used for the reward cannot be returned
|
496
542
|
# to the account.
|
497
543
|
# @param [String] reward_id Required parameter: The ID of the [loyalty
|
498
|
-
# reward](
|
544
|
+
# reward]($m/LoyaltyReward) to redeem.
|
499
545
|
# @param [RedeemLoyaltyRewardRequest] body Required parameter: An object
|
500
546
|
# containing the fields to POST for the request. See the corresponding
|
501
547
|
# 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.
|
@@ -5,14 +5,15 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Creates a new [Order](
|
9
|
-
#
|
8
|
+
# Creates a new [Order]($m/Order) which can include information on products
|
9
|
+
# for
|
10
10
|
# purchase and settings to apply to the purchase.
|
11
|
-
# To pay for a created order, please refer to the
|
11
|
+
# To pay for a created order, please refer to the
|
12
|
+
# [Pay for
|
12
13
|
# Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders)
|
13
14
|
# guide.
|
14
|
-
# You can modify open orders using the
|
15
|
-
#
|
15
|
+
# You can modify open orders using the [UpdateOrder]($e/Orders/UpdateOrder)
|
16
|
+
# endpoint.
|
16
17
|
# @param [CreateOrderRequest] body Required parameter: An object containing
|
17
18
|
# the fields to POST for the request. See the corresponding object
|
18
19
|
# definition for field details.
|
@@ -46,7 +47,7 @@ module Square
|
|
46
47
|
)
|
47
48
|
end
|
48
49
|
|
49
|
-
# Retrieves a set of [Order](
|
50
|
+
# Retrieves a set of [Order]($m/Order)s by their IDs.
|
50
51
|
# If a given Order ID does not exist, the ID is ignored instead of
|
51
52
|
# generating an error.
|
52
53
|
# @param [BatchRetrieveOrdersRequest] body Required parameter: An object
|
@@ -82,7 +83,7 @@ module Square
|
|
82
83
|
)
|
83
84
|
end
|
84
85
|
|
85
|
-
#
|
86
|
+
# Enables applications to preview order pricing without creating an order.
|
86
87
|
# @param [CalculateOrderRequest] body Required parameter: An object
|
87
88
|
# containing the fields to POST for the request. See the corresponding
|
88
89
|
# object definition for field details.
|
@@ -121,12 +122,12 @@ module Square
|
|
121
122
|
# Ecosystem (e.g. Point of Sale, Invoices, Connect APIs, etc).
|
122
123
|
# SearchOrders requests need to specify which locations to search and define
|
123
124
|
# a
|
124
|
-
# [`SearchOrdersQuery`](
|
125
|
+
# [`SearchOrdersQuery`]($m/SearchOrdersQuery) object which controls
|
125
126
|
# how to sort or filter the results. Your SearchOrdersQuery can:
|
126
127
|
# Set filter criteria.
|
127
128
|
# Set sort order.
|
128
129
|
# Determine whether to return results as complete Order objects, or as
|
129
|
-
# [OrderEntry](
|
130
|
+
# [OrderEntry]($m/OrderEntry) objects.
|
130
131
|
# Note that details for orders processed with Square Point of Sale while in
|
131
132
|
# offline mode may not be transmitted to Square for up to 72 hours. Offline
|
132
133
|
# orders have a `created_at` value that reflects the time the order was
|
@@ -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,7 +201,7 @@ module Square
|
|
200
201
|
)
|
201
202
|
end
|
202
203
|
|
203
|
-
# Updates an open [Order](
|
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
206
|
# An UpdateOrder request requires the following:
|
206
207
|
# - The `order_id` in the endpoint path, identifying the order to update.
|
@@ -214,7 +215,8 @@ module Square
|
|
214
215
|
# paths](https://developer.squareup.com/docs/orders-api/manage-orders#on-dot
|
215
216
|
# -notation)
|
216
217
|
# identifying fields to clear.
|
217
|
-
# To pay for an order, please refer to the
|
218
|
+
# To pay for an order, please refer to the
|
219
|
+
# [Pay for
|
218
220
|
# Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders)
|
219
221
|
# guide.
|
220
222
|
# @param [String] order_id Required parameter: The ID of the order to
|
@@ -257,8 +259,8 @@ 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
|
@@ -267,7 +269,7 @@ module Square
|
|
267
269
|
# array of `payment_ids` in the request.
|
268
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
275
|
# `payment_ids` will be canceled.
|
@@ -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
|
@@ -220,7 +220,7 @@ module Square
|
|
220
220
|
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
221
221
|
# ion).
|
222
222
|
# @param [Integer] limit Optional parameter: The upper limit on the number
|
223
|
-
# of subscription events to return
|
223
|
+
# of subscription events to return in the response. Default: `200`
|
224
224
|
# @return [ListSubscriptionEventsResponse Hash] response from the API call
|
225
225
|
def list_subscription_events(subscription_id:,
|
226
226
|
cursor: nil,
|
@@ -259,5 +259,40 @@ module Square
|
|
259
259
|
_response, data: decoded, errors: _errors
|
260
260
|
)
|
261
261
|
end
|
262
|
+
|
263
|
+
# Resumes a deactivated subscription.
|
264
|
+
# @param [String] subscription_id Required parameter: The ID of the
|
265
|
+
# subscription to resume.
|
266
|
+
# @return [ResumeSubscriptionResponse Hash] response from the API call
|
267
|
+
def resume_subscription(subscription_id:)
|
268
|
+
# Prepare query url.
|
269
|
+
_query_builder = config.get_base_uri
|
270
|
+
_query_builder << '/v2/subscriptions/{subscription_id}/resume'
|
271
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
272
|
+
_query_builder,
|
273
|
+
'subscription_id' => { 'value' => subscription_id, 'encode' => true }
|
274
|
+
)
|
275
|
+
_query_url = APIHelper.clean_url _query_builder
|
276
|
+
|
277
|
+
# Prepare headers.
|
278
|
+
_headers = {
|
279
|
+
'accept' => 'application/json'
|
280
|
+
}
|
281
|
+
|
282
|
+
# Prepare and execute HttpRequest.
|
283
|
+
_request = config.http_client.post(
|
284
|
+
_query_url,
|
285
|
+
headers: _headers
|
286
|
+
)
|
287
|
+
OAuth2.apply(config, _request)
|
288
|
+
_response = execute_request(_request)
|
289
|
+
|
290
|
+
# Return appropriate response type.
|
291
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
292
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
293
|
+
ApiResponse.new(
|
294
|
+
_response, data: decoded, errors: _errors
|
295
|
+
)
|
296
|
+
end
|
262
297
|
end
|
263
298
|
end
|