square.rb 8.0.0.20201216 → 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/LICENSE +1 -1
- data/README.md +9 -0
- data/lib/square.rb +0 -1
- data/lib/square/api/apple_pay_api.rb +8 -7
- 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 +34 -38
- data/lib/square/api/checkout_api.rb +2 -2
- 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 +16 -16
- 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 +60 -18
- data/lib/square/api/refunds_api.rb +10 -2
- data/lib/square/api/subscriptions_api.rb +36 -1
- data/lib/square/api/team_api.rb +10 -10
- data/lib/square/api/terminal_api.rb +15 -14
- data/lib/square/api/transactions_api.rb +29 -18
- data/lib/square/api/v1_employees_api.rb +2 -391
- data/lib/square/api/v1_transactions_api.rb +2 -83
- data/lib/square/api_helper.rb +5 -5
- data/lib/square/client.rb +4 -8
- data/lib/square/configuration.rb +20 -5
- data/test/api/test_locations_api.rb +1 -1
- metadata +2 -3
- data/lib/square/api/v1_items_api.rb +0 -1766
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1c9c3a6b13fa697e2fffc362d766cb1b7ded51f360ad7fcf342039d2623911d
|
4
|
+
data.tar.gz: 11954b03a0f85edec268ef6d4f7bb020386dfba4134f28a720c5b6c39b3c2315
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc03189601f3985171af4af574f987b31d4c3132ffb96b7d4ada0996056309183a50d1f02a8af602a9a63543f0737903f336185a7e4284db324df74ff114f6e5
|
7
|
+
data.tar.gz: 042712b0f44ce7a117e7b1cd7f9286d4ada8c033d54b9e347e62a4dc491463fa984f5f0590c9a6d29ef0f3bade77199ee76eab60f4c7960c12a6e95d551acc15
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -196,6 +196,15 @@ client = Square::Client.new(
|
|
196
196
|
environment: 'production'
|
197
197
|
)
|
198
198
|
```
|
199
|
+
|
200
|
+
- To set a custom environment provide a `custom_url`, and set environment to `custom`:
|
201
|
+
|
202
|
+
```ruby
|
203
|
+
client = Square::Client.new(
|
204
|
+
access_token:'ACCESS TOKEN HERE',
|
205
|
+
environment: 'custom',
|
206
|
+
custom_url: 'https://your.customdomain.com'
|
207
|
+
)
|
199
208
|
|
200
209
|
### Get an Instance of an API object and call its methods
|
201
210
|
|
data/lib/square.rb
CHANGED
@@ -33,7 +33,6 @@ require_relative 'square/api/mobile_authorization_api.rb'
|
|
33
33
|
require_relative 'square/api/o_auth_api.rb'
|
34
34
|
require_relative 'square/api/v1_employees_api.rb'
|
35
35
|
require_relative 'square/api/v1_transactions_api.rb'
|
36
|
-
require_relative 'square/api/v1_items_api.rb'
|
37
36
|
require_relative 'square/api/apple_pay_api.rb'
|
38
37
|
require_relative 'square/api/bank_accounts_api.rb'
|
39
38
|
require_relative 'square/api/bookings_api.rb'
|
@@ -5,17 +5,18 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Activates a domain for use with
|
9
|
-
#
|
8
|
+
# Activates a domain for use with Apple Pay on the Web and Square. A
|
9
|
+
# validation
|
10
|
+
# is performed on this domain by Apple to ensure that it is properly set up
|
10
11
|
# as
|
11
12
|
# an Apple Pay enabled domain.
|
12
13
|
# This endpoint provides an easy way for platform developers to bulk
|
13
14
|
# activate
|
14
|
-
#
|
15
|
-
# To learn more about
|
16
|
-
# [
|
17
|
-
#
|
18
|
-
# -
|
15
|
+
# Apple Pay on the Web with Square for merchants using their platform.
|
16
|
+
# To learn more about Web Apple Pay, see
|
17
|
+
# [Add the Apple Pay on the Web
|
18
|
+
# Button](https://developer.squareup.com/docs/payment-form/add-digital-walle
|
19
|
+
# ts/apple-pay).
|
19
20
|
# @param [RegisterDomainRequest] body Required parameter: An object
|
20
21
|
# containing the fields to POST for the request. See the corresponding
|
21
22
|
# object definition for field details.
|
@@ -5,8 +5,8 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Returns a list of [BankAccount](
|
9
|
-
#
|
8
|
+
# Returns a list of [BankAccount]($m/BankAccount) objects linked to a Square
|
9
|
+
# account.
|
10
10
|
# @param [String] cursor Optional parameter: The pagination cursor returned
|
11
11
|
# by a previous call to this endpoint. Use it in the next `ListBankAccounts`
|
12
12
|
# request to retrieve the next set of results. See the
|
@@ -55,8 +55,8 @@ module Square
|
|
55
55
|
)
|
56
56
|
end
|
57
57
|
|
58
|
-
# Returns details of a [BankAccount](
|
59
|
-
#
|
58
|
+
# Returns details of a [BankAccount]($m/BankAccount) identified by V1 bank
|
59
|
+
# account ID.
|
60
60
|
# @param [String] v1_bank_account_id Required parameter: Connect V1 ID of
|
61
61
|
# the desired `BankAccount`. For more information, see [Retrieve a bank
|
62
62
|
# account by using an ID issued by V1 Bank Accounts
|
@@ -94,7 +94,7 @@ module Square
|
|
94
94
|
)
|
95
95
|
end
|
96
96
|
|
97
|
-
# Returns details of a [BankAccount](
|
97
|
+
# Returns details of a [BankAccount]($m/BankAccount)
|
98
98
|
# linked to a Square account.
|
99
99
|
# @param [String] bank_account_id Required parameter: Square-issued ID of
|
100
100
|
# the desired `BankAccount`.
|
data/lib/square/api/base_api.rb
CHANGED
@@ -188,8 +188,7 @@ module Square
|
|
188
188
|
|
189
189
|
# Retrieves a booking.
|
190
190
|
# @param [String] booking_id Required parameter: The ID of the
|
191
|
-
# [Booking](
|
192
|
-
# booking.
|
191
|
+
# [Booking]($m/Booking) object representing the to-be-retrieved booking.
|
193
192
|
# @return [RetrieveBookingResponse Hash] response from the API call
|
194
193
|
def retrieve_booking(booking_id:)
|
195
194
|
# Prepare query url.
|
@@ -224,7 +223,7 @@ module Square
|
|
224
223
|
|
225
224
|
# Updates a booking.
|
226
225
|
# @param [String] booking_id Required parameter: The ID of the
|
227
|
-
# [Booking](
|
226
|
+
# [Booking]($m/Booking) object representing the to-be-updated booking.
|
228
227
|
# @param [UpdateBookingRequest] body Required parameter: An object
|
229
228
|
# containing the fields to POST for the request. See the corresponding
|
230
229
|
# object definition for field details.
|
@@ -265,8 +264,7 @@ module Square
|
|
265
264
|
|
266
265
|
# Cancels an existing booking.
|
267
266
|
# @param [String] booking_id Required parameter: The ID of the
|
268
|
-
# [Booking](
|
269
|
-
# booking.
|
267
|
+
# [Booking]($m/Booking) object representing the to-be-cancelled booking.
|
270
268
|
# @param [CancelBookingRequest] body Required parameter: An object
|
271
269
|
# containing the fields to POST for the request. See the corresponding
|
272
270
|
# object definition for field details.
|
@@ -63,8 +63,8 @@ module Square
|
|
63
63
|
end
|
64
64
|
|
65
65
|
# Provides the summary details for a single cash drawer shift. See
|
66
|
-
# [ListCashDrawerShiftEvents](
|
67
|
-
#
|
66
|
+
# [ListCashDrawerShiftEvents]($e/CashDrawers/ListCashDrawerShiftEvents) for
|
67
|
+
# a list of cash drawer shift events.
|
68
68
|
# @param [String] location_id Required parameter: The ID of the location to
|
69
69
|
# retrieve cash drawer shifts from.
|
70
70
|
# @param [String] shift_id Required parameter: The shift ID.
|
@@ -5,12 +5,12 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Deletes a set of [CatalogItem](
|
8
|
+
# Deletes a set of [CatalogItem]($m/CatalogItem)s based on the
|
9
9
|
# provided list of target IDs and returns a set of successfully deleted IDs
|
10
10
|
# in
|
11
11
|
# the response. Deletion is a cascading event such that all children of the
|
12
12
|
# targeted object are also deleted. For example, deleting a CatalogItem will
|
13
|
-
# also delete all of its [CatalogItemVariation](
|
13
|
+
# also delete all of its [CatalogItemVariation]($m/CatalogItemVariation)
|
14
14
|
# children.
|
15
15
|
# `BatchDeleteCatalogObjects` succeeds even if only a portion of the
|
16
16
|
# targeted
|
@@ -50,13 +50,11 @@ module Square
|
|
50
50
|
end
|
51
51
|
|
52
52
|
# Returns a set of objects based on the provided ID.
|
53
|
-
# Each [CatalogItem](
|
54
|
-
# its
|
53
|
+
# Each [CatalogItem]($m/CatalogItem) returned in the set includes all of its
|
55
54
|
# child information including: all of its
|
56
|
-
# [CatalogItemVariation](
|
57
|
-
# its [CatalogModifierList](
|
58
|
-
#
|
59
|
-
# any [CatalogTax](#type-catalogtax) objects that apply to it.
|
55
|
+
# [CatalogItemVariation]($m/CatalogItemVariation) objects, references to
|
56
|
+
# its [CatalogModifierList]($m/CatalogModifierList) objects, and the ids of
|
57
|
+
# any [CatalogTax]($m/CatalogTax) objects that apply to it.
|
60
58
|
# @param [BatchRetrieveCatalogObjectsRequest] body Required parameter: An
|
61
59
|
# object containing the fields to POST for the request. See the
|
62
60
|
# corresponding object definition for field details.
|
@@ -138,8 +136,8 @@ module Square
|
|
138
136
|
end
|
139
137
|
|
140
138
|
# Uploads an image file to be represented by a
|
141
|
-
# [CatalogImage](
|
142
|
-
# [CatalogObject](
|
139
|
+
# [CatalogImage]($m/CatalogImage) object linked to an existing
|
140
|
+
# [CatalogObject]($m/CatalogObject) instance. A call to this endpoint can
|
143
141
|
# upload an image, link an image to
|
144
142
|
# a catalog object, or do both.
|
145
143
|
# This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data
|
@@ -228,19 +226,19 @@ module Square
|
|
228
226
|
)
|
229
227
|
end
|
230
228
|
|
231
|
-
# Returns a list of [CatalogObject](
|
229
|
+
# Returns a list of [CatalogObject]($m/CatalogObject)s that includes
|
232
230
|
# all objects of a set of desired types (for example, all
|
233
|
-
# [CatalogItem](
|
234
|
-
# and [CatalogTax](
|
231
|
+
# [CatalogItem]($m/CatalogItem)
|
232
|
+
# and [CatalogTax]($m/CatalogTax) objects) in the catalog. The `types`
|
235
233
|
# parameter
|
236
234
|
# is specified as a comma-separated list of valid
|
237
|
-
# [CatalogObject](
|
235
|
+
# [CatalogObject]($m/CatalogObject) types:
|
238
236
|
# `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`,
|
239
237
|
# `DISCOUNT`, `TAX`, `IMAGE`.
|
240
238
|
# __Important:__ ListCatalog does not return deleted catalog items. To
|
241
239
|
# retrieve
|
242
240
|
# deleted catalog items, use
|
243
|
-
# [SearchCatalogObjects](
|
241
|
+
# [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects)
|
244
242
|
# and set the `include_deleted_objects` attribute value to `true`.
|
245
243
|
# @param [String] cursor Optional parameter: The pagination cursor returned
|
246
244
|
# in the previous response. Leave unset for an initial request. See
|
@@ -254,7 +252,7 @@ module Square
|
|
254
252
|
# @param [Long] catalog_version Optional parameter: The specific version of
|
255
253
|
# the catalog objects to be included in the response. This allows you to
|
256
254
|
# retrieve historical versions of objects. The specified version value is
|
257
|
-
# matched against the [CatalogObject](
|
255
|
+
# matched against the [CatalogObject]($m/CatalogObject)s' `version`
|
258
256
|
# attribute.
|
259
257
|
# @return [ListCatalogResponse Hash] response from the API call
|
260
258
|
def list_catalog(cursor: nil,
|
@@ -292,7 +290,7 @@ module Square
|
|
292
290
|
)
|
293
291
|
end
|
294
292
|
|
295
|
-
# Creates or updates the target [CatalogObject](
|
293
|
+
# Creates or updates the target [CatalogObject]($m/CatalogObject).
|
296
294
|
# @param [UpsertCatalogObjectRequest] body Required parameter: An object
|
297
295
|
# containing the fields to POST for the request. See the corresponding
|
298
296
|
# object definition for field details.
|
@@ -326,14 +324,14 @@ module Square
|
|
326
324
|
)
|
327
325
|
end
|
328
326
|
|
329
|
-
# Deletes a single [CatalogObject](
|
327
|
+
# Deletes a single [CatalogObject]($m/CatalogObject) based on the
|
330
328
|
# provided ID and returns the set of successfully deleted IDs in the
|
331
329
|
# response.
|
332
330
|
# Deletion is a cascading event such that all children of the targeted
|
333
331
|
# object
|
334
|
-
# are also deleted. For example, deleting a [CatalogItem](
|
332
|
+
# are also deleted. For example, deleting a [CatalogItem]($m/CatalogItem)
|
335
333
|
# will also delete all of its
|
336
|
-
# [CatalogItemVariation](
|
334
|
+
# [CatalogItemVariation]($m/CatalogItemVariation) children.
|
337
335
|
# @param [String] object_id Required parameter: The ID of the catalog object
|
338
336
|
# to be deleted. When an object is deleted, other objects in the graph that
|
339
337
|
# depend on that object will be deleted as well (for example, deleting a
|
@@ -370,14 +368,13 @@ module Square
|
|
370
368
|
)
|
371
369
|
end
|
372
370
|
|
373
|
-
# Returns a single [CatalogItem](
|
374
|
-
# [CatalogObject](
|
375
|
-
#
|
376
|
-
#
|
377
|
-
# information including: [CatalogItemVariation](#type-catalogitemvariation)
|
371
|
+
# Returns a single [CatalogItem]($m/CatalogItem) as a
|
372
|
+
# [CatalogObject]($m/CatalogObject) based on the provided ID. The returned
|
373
|
+
# object includes all of the relevant [CatalogItem]($m/CatalogItem)
|
374
|
+
# information including: [CatalogItemVariation]($m/CatalogItemVariation)
|
378
375
|
# children, references to its
|
379
|
-
# [CatalogModifierList](
|
380
|
-
# any [CatalogTax](
|
376
|
+
# [CatalogModifierList]($m/CatalogModifierList) objects, and the ids of
|
377
|
+
# any [CatalogTax]($m/CatalogTax) objects that apply to it.
|
381
378
|
# @param [String] object_id Required parameter: The object ID of any type of
|
382
379
|
# catalog objects to be retrieved.
|
383
380
|
# @param [Boolean] include_related_objects Optional parameter: If `true`,
|
@@ -392,8 +389,7 @@ module Square
|
|
392
389
|
# @param [Long] catalog_version Optional parameter: Requests objects as of a
|
393
390
|
# specific version of the catalog. This allows you to retrieve historical
|
394
391
|
# versions of objects. The value to retrieve a specific version of an object
|
395
|
-
# can be found in the version field of
|
396
|
-
# [CatalogObject](#type-catalogobject)s.
|
392
|
+
# can be found in the version field of [CatalogObject]($m/CatalogObject)s.
|
397
393
|
# @return [RetrieveCatalogObjectResponse Hash] response from the API call
|
398
394
|
def retrieve_catalog_object(object_id:,
|
399
395
|
include_related_objects: false,
|
@@ -433,12 +429,12 @@ module Square
|
|
433
429
|
)
|
434
430
|
end
|
435
431
|
|
436
|
-
# Searches for [CatalogObject](
|
432
|
+
# Searches for [CatalogObject]($m/CatalogObject) of any type by matching
|
437
433
|
# supported search attribute values,
|
438
434
|
# excluding custom attribute values on items or item variations, against one
|
439
|
-
# or more of the specified query expressions
|
435
|
+
# or more of the specified query expressions.
|
440
436
|
# This (`SearchCatalogObjects`) endpoint differs from the
|
441
|
-
# [SearchCatalogItems](
|
437
|
+
# [SearchCatalogItems]($e/Catalog/SearchCatalogItems)
|
442
438
|
# endpoint in the following aspects:
|
443
439
|
# - `SearchCatalogItems` can only search for items or item variations,
|
444
440
|
# whereas `SearchCatalogObjects` can search for any type of catalog objects.
|
@@ -486,9 +482,9 @@ module Square
|
|
486
482
|
# Searches for catalog items or item variations by matching supported search
|
487
483
|
# attribute values, including
|
488
484
|
# custom attribute values, against one or more of the specified query
|
489
|
-
# expressions
|
485
|
+
# expressions.
|
490
486
|
# This (`SearchCatalogItems`) endpoint differs from the
|
491
|
-
# [SearchCatalogObjects](
|
487
|
+
# [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects)
|
492
488
|
# endpoint in the following aspects:
|
493
489
|
# - `SearchCatalogItems` can only search for items or item variations,
|
494
490
|
# whereas `SearchCatalogObjects` can search for any type of catalog objects.
|
@@ -533,8 +529,8 @@ module Square
|
|
533
529
|
)
|
534
530
|
end
|
535
531
|
|
536
|
-
# Updates the [CatalogModifierList](
|
537
|
-
# that apply to the targeted [CatalogItem](
|
532
|
+
# Updates the [CatalogModifierList]($m/CatalogModifierList) objects
|
533
|
+
# that apply to the targeted [CatalogItem]($m/CatalogItem) without having
|
538
534
|
# to perform an upsert on the entire item.
|
539
535
|
# @param [UpdateItemModifierListsRequest] body Required parameter: An object
|
540
536
|
# containing the fields to POST for the request. See the corresponding
|
@@ -569,8 +565,8 @@ module Square
|
|
569
565
|
)
|
570
566
|
end
|
571
567
|
|
572
|
-
# Updates the [CatalogTax](
|
573
|
-
# targeted [CatalogItem](
|
568
|
+
# Updates the [CatalogTax]($m/CatalogTax) objects that apply to the
|
569
|
+
# targeted [CatalogItem]($m/CatalogItem) without having to perform an
|
574
570
|
# upsert on the entire item.
|
575
571
|
# @param [UpdateItemTaxesRequest] body Required parameter: An object
|
576
572
|
# containing the fields to POST for the request. See the corresponding
|
@@ -5,8 +5,8 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Links a `checkoutId` to a `checkout_page_url` that customers
|
9
|
-
#
|
8
|
+
# Links a `checkoutId` to a `checkout_page_url` that customers are
|
9
|
+
# directed to in order to provide their payment information using a
|
10
10
|
# payment processing workflow hosted on connect.squareup.com.
|
11
11
|
# @param [String] location_id Required parameter: The ID of the business
|
12
12
|
# location to associate the checkout with.
|
@@ -7,10 +7,10 @@ module Square
|
|
7
7
|
|
8
8
|
# Retrieves the list of customer groups of a business.
|
9
9
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
10
|
-
# a previous call to this endpoint. Provide this to retrieve the next
|
11
|
-
# results for your original query.
|
12
|
-
#
|
13
|
-
#
|
10
|
+
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
11
|
+
# set of results for your original query. For more information, see
|
12
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
13
|
+
# ion).
|
14
14
|
# @return [ListCustomerGroupsResponse Hash] response from the API call
|
15
15
|
def list_customer_groups(cursor: nil)
|
16
16
|
# Prepare query url.
|
@@ -7,10 +7,10 @@ module Square
|
|
7
7
|
|
8
8
|
# Retrieves the list of customer segments of a business.
|
9
9
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
10
|
-
# previous calls to
|
11
|
-
# of query results.
|
12
|
-
#
|
13
|
-
#
|
10
|
+
# previous calls to `ListCustomerSegments`. This cursor is used to retrieve
|
11
|
+
# the next set of query results. For more information, see
|
12
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
13
|
+
# ion).
|
14
14
|
# @return [ListCustomerSegmentsResponse Hash] response from the API call
|
15
15
|
def list_customer_segments(cursor: nil)
|
16
16
|
# Prepare query url.
|
@@ -13,14 +13,14 @@ module Square
|
|
13
13
|
# profiles can take closer to one minute or longer, especially during
|
14
14
|
# network incidents and outages.
|
15
15
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
16
|
-
# a previous call to this endpoint. Provide this to retrieve the next
|
17
|
-
# results for your original query.
|
18
|
-
#
|
19
|
-
#
|
16
|
+
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
17
|
+
# set of results for your original query. For more information, see
|
18
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
19
|
+
# ion).
|
20
20
|
# @param [CustomerSortField] sort_field Optional parameter: Indicates how
|
21
|
-
#
|
21
|
+
# customers should be sorted. Default: `DEFAULT`.
|
22
22
|
# @param [SortOrder] sort_order Optional parameter: Indicates whether
|
23
|
-
#
|
23
|
+
# customers should be sorted in ascending (`ASC`) or descending (`DESC`)
|
24
24
|
# order. Default: `ASC`.
|
25
25
|
# @return [ListCustomersResponse Hash] response from the API call
|
26
26
|
def list_customers(cursor: nil,
|
@@ -60,8 +60,8 @@ module Square
|
|
60
60
|
|
61
61
|
# Creates a new customer for a business, which can have associated cards on
|
62
62
|
# file.
|
63
|
-
# You must provide
|
64
|
-
#
|
63
|
+
# You must provide at least one of the following values in your request to
|
64
|
+
# this
|
65
65
|
# endpoint:
|
66
66
|
# - `given_name`
|
67
67
|
# - `family_name`
|
@@ -145,15 +145,27 @@ module Square
|
|
145
145
|
)
|
146
146
|
end
|
147
147
|
|
148
|
-
# Deletes a customer from a business,
|
149
|
-
#
|
150
|
-
#
|
151
|
-
#
|
152
|
-
#
|
148
|
+
# Deletes a customer profile from a business, including any linked cards on
|
149
|
+
# file.
|
150
|
+
# As a best practice, you should include the `version` field in the request
|
151
|
+
# to enable [optimistic
|
152
|
+
# concurrency](https://developer.squareup.com/docs/working-with-apis/optimis
|
153
|
+
# tic-concurrency) control. The value must be set to the current version of
|
154
|
+
# the customer profile.
|
155
|
+
# To delete a customer profile that was created by merging existing
|
156
|
+
# profiles, you must use the ID of the newly created profile.
|
153
157
|
# @param [String] customer_id Required parameter: The ID of the customer to
|
154
158
|
# delete.
|
159
|
+
# @param [Long] version Optional parameter: The current version of the
|
160
|
+
# customer profile. As a best practice, you should include this parameter
|
161
|
+
# to enable [optimistic
|
162
|
+
# concurrency](https://developer.squareup.com/docs/working-with-apis/optimis
|
163
|
+
# tic-concurrency) control. For more information, see [Delete a customer
|
164
|
+
# profile](https://developer.squareup.com/docs/customers-api/use-the-api/kee
|
165
|
+
# p-records#delete-customer-profile).
|
155
166
|
# @return [DeleteCustomerResponse Hash] response from the API call
|
156
|
-
def delete_customer(customer_id
|
167
|
+
def delete_customer(customer_id:,
|
168
|
+
version: nil)
|
157
169
|
# Prepare query url.
|
158
170
|
_query_builder = config.get_base_uri
|
159
171
|
_query_builder << '/v2/customers/{customer_id}'
|
@@ -161,6 +173,10 @@ module Square
|
|
161
173
|
_query_builder,
|
162
174
|
'customer_id' => { 'value' => customer_id, 'encode' => true }
|
163
175
|
)
|
176
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
177
|
+
_query_builder,
|
178
|
+
'version' => version
|
179
|
+
)
|
164
180
|
_query_url = APIHelper.clean_url _query_builder
|
165
181
|
|
166
182
|
# Prepare headers.
|
@@ -219,16 +235,21 @@ module Square
|
|
219
235
|
)
|
220
236
|
end
|
221
237
|
|
222
|
-
# Updates
|
223
|
-
#
|
224
|
-
#
|
225
|
-
# the
|
226
|
-
#
|
227
|
-
#
|
228
|
-
#
|
229
|
-
#
|
230
|
-
#
|
231
|
-
#
|
238
|
+
# Updates a customer profile. To change an attribute, specify the new value.
|
239
|
+
# To remove an attribute, specify the value as an empty string or empty
|
240
|
+
# object.
|
241
|
+
# As a best practice, you should include the `version` field in the request
|
242
|
+
# to enable [optimistic
|
243
|
+
# concurrency](https://developer.squareup.com/docs/working-with-apis/optimis
|
244
|
+
# tic-concurrency) control. The value must be set to the current version of
|
245
|
+
# the customer profile.
|
246
|
+
# To update a customer profile that was created by merging existing
|
247
|
+
# profiles, you must use the ID of the newly created profile.
|
248
|
+
# You cannot use this endpoint to change cards on file. To change a card on
|
249
|
+
# file, call [DeleteCustomerCard]($e/Customers/DeleteCustomerCard) to delete
|
250
|
+
# the existing card and then call
|
251
|
+
# [CreateCustomerCard]($e/Customers/CreateCustomerCard) to create a new
|
252
|
+
# card.
|
232
253
|
# @param [String] customer_id Required parameter: The ID of the customer to
|
233
254
|
# update.
|
234
255
|
# @param [UpdateCustomerRequest] body Required parameter: An object
|