square.rb 33.0.0.20231018 → 42.1.0.20250416
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/square/api/apple_pay_api.rb +15 -11
- data/lib/square/api/bank_accounts_api.rb +12 -12
- data/lib/square/api/base_api.rb +2 -1
- data/lib/square/api/booking_custom_attributes_api.rb +44 -44
- data/lib/square/api/bookings_api.rb +53 -53
- data/lib/square/api/cards_api.rb +16 -16
- data/lib/square/api/cash_drawers_api.rb +12 -12
- data/lib/square/api/catalog_api.rb +67 -57
- data/lib/square/api/checkout_api.rb +111 -26
- data/lib/square/api/customer_custom_attributes_api.rb +40 -40
- data/lib/square/api/customer_groups_api.rb +20 -20
- data/lib/square/api/customer_segments_api.rb +8 -8
- data/lib/square/api/customers_api.rb +144 -54
- data/lib/square/api/devices_api.rb +20 -20
- data/lib/square/api/disputes_api.rb +36 -36
- data/lib/square/api/employees_api.rb +8 -8
- data/lib/square/api/events_api.rb +84 -0
- data/lib/square/api/gift_card_activities_api.rb +10 -11
- data/lib/square/api/gift_cards_api.rb +36 -33
- data/lib/square/api/inventory_api.rb +52 -52
- data/lib/square/api/invoices_api.rb +109 -41
- data/lib/square/api/labor_api.rb +81 -80
- data/lib/square/api/location_custom_attributes_api.rb +44 -44
- data/lib/square/api/locations_api.rb +18 -17
- data/lib/square/api/loyalty_api.rb +72 -72
- data/lib/square/api/merchant_custom_attributes_api.rb +44 -44
- data/lib/square/api/merchants_api.rb +8 -8
- data/lib/square/api/mobile_authorization_api.rb +4 -4
- data/lib/square/api/o_auth_api.rb +15 -69
- data/lib/square/api/order_custom_attributes_api.rb +44 -44
- data/lib/square/api/orders_api.rb +32 -32
- data/lib/square/api/payments_api.rb +67 -31
- data/lib/square/api/payouts_api.rb +12 -12
- data/lib/square/api/refunds_api.rb +31 -13
- data/lib/square/api/sites_api.rb +4 -4
- data/lib/square/api/snippets_api.rb +12 -12
- data/lib/square/api/subscriptions_api.rb +48 -48
- data/lib/square/api/team_api.rb +146 -40
- data/lib/square/api/terminal_api.rb +95 -53
- data/lib/square/api/transactions_api.rb +16 -16
- data/lib/square/api/v1_transactions_api.rb +13 -292
- data/lib/square/api/vendors_api.rb +28 -28
- data/lib/square/api/webhook_subscriptions_api.rb +32 -32
- data/lib/square/client.rb +32 -24
- data/lib/square/configuration.rb +43 -15
- data/lib/square/http/api_response.rb +1 -1
- data/lib/square/http/auth/o_auth2.rb +21 -2
- data/lib/square.rb +4 -3
- data/test/api/api_test_base.rb +1 -1
- data/test/api/test_locations_api.rb +1 -1
- data/test/api/test_refunds_api.rb +4 -1
- data/test/webhooks/test_webhooks_helper.rb +17 -0
- metadata +12 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77c2bdeadc2cefd90cf043acfde740a8dc81febbf047b997214d402b20a4be26
|
4
|
+
data.tar.gz: 4d2aa8fbb3c12485fd0edb6fcdafff4723405067df639faf8f82ee7cf2bd0b65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ffc679938a0656374252391dff967676155325e0727e8b9bff3a685875cd3da09d67da112aa2b2ff0e431c2d7651ea4fe1bcd00fda9925e46a49e4ca73ea47b
|
7
|
+
data.tar.gz: d630339a17cb8a968550b16ffc9543ade635507914ff7258ddec32668630ac9e03bfd59ad7f98d562b4a4608b7b4e8c13aedd99c4b11bbc2fb9d6fadf6e13b52
|
data/LICENSE
CHANGED
@@ -9,20 +9,24 @@ module Square
|
|
9
9
|
# This endpoint provides an easy way for platform developers to bulk
|
10
10
|
# activate
|
11
11
|
# Apple Pay on the Web with Square for merchants using their platform.
|
12
|
-
# Note:
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
12
|
+
# Note: You will need to host a valid domain verification file on your
|
13
|
+
# domain to support Apple Pay. The
|
14
|
+
# current version of this file is always available at
|
15
|
+
# https://app.squareup.com/digital-wallets/apple-pay/apple-developer-merchan
|
16
|
+
# tid-domain-association,
|
17
|
+
# and should be hosted at
|
18
|
+
# `.well_known/apple-developer-merchantid-domain-association` on your
|
19
|
+
# domain. This file is subject to change; we strongly recommend checking
|
20
|
+
# for updates regularly and avoiding
|
21
|
+
# long-lived caches that might not keep in sync with the correct file
|
22
|
+
# version.
|
19
23
|
# To learn more about the Web Payments SDK and how to add Apple Pay, see
|
20
24
|
# [Take an Apple Pay
|
21
25
|
# Payment](https://developer.squareup.com/docs/web-payments/apple-pay).
|
22
26
|
# @param [RegisterDomainRequest] body Required parameter: An object
|
23
27
|
# containing the fields to POST for the request. See the corresponding
|
24
28
|
# object definition for field details.
|
25
|
-
# @return [
|
29
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
26
30
|
def register_domain(body:)
|
27
31
|
new_api_call_builder
|
28
32
|
.request(new_request_builder(HttpMethodEnum::POST,
|
@@ -34,9 +38,9 @@ module Square
|
|
34
38
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
35
39
|
.auth(Single.new('global')))
|
36
40
|
.response(new_response_handler
|
37
|
-
|
38
|
-
|
39
|
-
|
41
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
42
|
+
.is_api_response(true)
|
43
|
+
.convertor(ApiResponse.method(:create)))
|
40
44
|
.execute
|
41
45
|
end
|
42
46
|
end
|
@@ -15,7 +15,7 @@ module Square
|
|
15
15
|
# @param [String] location_id Optional parameter: Location ID. You can
|
16
16
|
# specify this optional filter to retrieve only the linked bank accounts
|
17
17
|
# belonging to a specific location.
|
18
|
-
# @return [
|
18
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
19
19
|
def list_bank_accounts(cursor: nil,
|
20
20
|
limit: nil,
|
21
21
|
location_id: nil)
|
@@ -29,9 +29,9 @@ module Square
|
|
29
29
|
.header_param(new_parameter('application/json', key: 'accept'))
|
30
30
|
.auth(Single.new('global')))
|
31
31
|
.response(new_response_handler
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
33
|
+
.is_api_response(true)
|
34
|
+
.convertor(ApiResponse.method(:create)))
|
35
35
|
.execute
|
36
36
|
end
|
37
37
|
|
@@ -42,7 +42,7 @@ module Square
|
|
42
42
|
# account by using an ID issued by V1 Bank Accounts
|
43
43
|
# API](https://developer.squareup.com/docs/bank-accounts-api#retrieve-a-bank
|
44
44
|
# -account-by-using-an-id-issued-by-v1-bank-accounts-api).
|
45
|
-
# @return [
|
45
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
46
46
|
def get_bank_account_by_v1_id(v1_bank_account_id:)
|
47
47
|
new_api_call_builder
|
48
48
|
.request(new_request_builder(HttpMethodEnum::GET,
|
@@ -53,9 +53,9 @@ module Square
|
|
53
53
|
.header_param(new_parameter('application/json', key: 'accept'))
|
54
54
|
.auth(Single.new('global')))
|
55
55
|
.response(new_response_handler
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
57
|
+
.is_api_response(true)
|
58
|
+
.convertor(ApiResponse.method(:create)))
|
59
59
|
.execute
|
60
60
|
end
|
61
61
|
|
@@ -63,7 +63,7 @@ module Square
|
|
63
63
|
# linked to a Square account.
|
64
64
|
# @param [String] bank_account_id Required parameter: Square-issued ID of
|
65
65
|
# the desired `BankAccount`.
|
66
|
-
# @return [
|
66
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
67
67
|
def get_bank_account(bank_account_id:)
|
68
68
|
new_api_call_builder
|
69
69
|
.request(new_request_builder(HttpMethodEnum::GET,
|
@@ -74,9 +74,9 @@ module Square
|
|
74
74
|
.header_param(new_parameter('application/json', key: 'accept'))
|
75
75
|
.auth(Single.new('global')))
|
76
76
|
.response(new_response_handler
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
78
|
+
.is_api_response(true)
|
79
|
+
.convertor(ApiResponse.method(:create)))
|
80
80
|
.execute
|
81
81
|
end
|
82
82
|
end
|
data/lib/square/api/base_api.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
module Square
|
2
2
|
# BaseApi.
|
3
3
|
class BaseApi
|
4
|
+
include CoreLibrary
|
4
5
|
attr_accessor :config, :http_call_back
|
5
6
|
|
6
7
|
def self.user_agent
|
7
|
-
'Square-Ruby-SDK/
|
8
|
+
'Square-Ruby-SDK/42.1.0.20250416 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
|
8
9
|
end
|
9
10
|
|
10
11
|
def self.user_agent_parameters
|
@@ -18,7 +18,7 @@ module Square
|
|
18
18
|
# more information, see
|
19
19
|
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
20
20
|
# atterns/pagination).
|
21
|
-
# @return [
|
21
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
22
22
|
def list_booking_custom_attribute_definitions(limit: nil,
|
23
23
|
cursor: nil)
|
24
24
|
new_api_call_builder
|
@@ -30,9 +30,9 @@ module Square
|
|
30
30
|
.header_param(new_parameter('application/json', key: 'accept'))
|
31
31
|
.auth(Single.new('global')))
|
32
32
|
.response(new_response_handler
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
34
|
+
.is_api_response(true)
|
35
|
+
.convertor(ApiResponse.method(:create)))
|
36
36
|
.execute
|
37
37
|
end
|
38
38
|
|
@@ -47,7 +47,7 @@ module Square
|
|
47
47
|
# @param [CreateBookingCustomAttributeDefinitionRequest] body Required
|
48
48
|
# parameter: An object containing the fields to POST for the request. See
|
49
49
|
# the corresponding object definition for field details.
|
50
|
-
# @return [
|
50
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
51
51
|
def create_booking_custom_attribute_definition(body:)
|
52
52
|
new_api_call_builder
|
53
53
|
.request(new_request_builder(HttpMethodEnum::POST,
|
@@ -59,9 +59,9 @@ module Square
|
|
59
59
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
60
60
|
.auth(Single.new('global')))
|
61
61
|
.response(new_response_handler
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
63
|
+
.is_api_response(true)
|
64
|
+
.convertor(ApiResponse.method(:create)))
|
65
65
|
.execute
|
66
66
|
end
|
67
67
|
|
@@ -75,7 +75,7 @@ module Square
|
|
75
75
|
# or *Appointments Premium*.
|
76
76
|
# @param [String] key Required parameter: The key of the custom attribute
|
77
77
|
# definition to delete.
|
78
|
-
# @return [
|
78
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
79
79
|
def delete_booking_custom_attribute_definition(key:)
|
80
80
|
new_api_call_builder
|
81
81
|
.request(new_request_builder(HttpMethodEnum::DELETE,
|
@@ -86,9 +86,9 @@ module Square
|
|
86
86
|
.header_param(new_parameter('application/json', key: 'accept'))
|
87
87
|
.auth(Single.new('global')))
|
88
88
|
.response(new_response_handler
|
89
|
-
|
90
|
-
|
91
|
-
|
89
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
90
|
+
.is_api_response(true)
|
91
|
+
.convertor(ApiResponse.method(:create)))
|
92
92
|
.execute
|
93
93
|
end
|
94
94
|
|
@@ -106,7 +106,7 @@ module Square
|
|
106
106
|
# the request, Square returns the specified version or a higher version if
|
107
107
|
# one exists. If the specified version is higher than the current version,
|
108
108
|
# Square returns a `BAD_REQUEST` error.
|
109
|
-
# @return [
|
109
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
110
110
|
def retrieve_booking_custom_attribute_definition(key:,
|
111
111
|
version: nil)
|
112
112
|
new_api_call_builder
|
@@ -119,9 +119,9 @@ module Square
|
|
119
119
|
.header_param(new_parameter('application/json', key: 'accept'))
|
120
120
|
.auth(Single.new('global')))
|
121
121
|
.response(new_response_handler
|
122
|
-
|
123
|
-
|
124
|
-
|
122
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
123
|
+
.is_api_response(true)
|
124
|
+
.convertor(ApiResponse.method(:create)))
|
125
125
|
.execute
|
126
126
|
end
|
127
127
|
|
@@ -138,7 +138,7 @@ module Square
|
|
138
138
|
# @param [UpdateBookingCustomAttributeDefinitionRequest] body Required
|
139
139
|
# parameter: An object containing the fields to POST for the request. See
|
140
140
|
# the corresponding object definition for field details.
|
141
|
-
# @return [
|
141
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
142
142
|
def update_booking_custom_attribute_definition(key:,
|
143
143
|
body:)
|
144
144
|
new_api_call_builder
|
@@ -153,9 +153,9 @@ module Square
|
|
153
153
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
154
154
|
.auth(Single.new('global')))
|
155
155
|
.response(new_response_handler
|
156
|
-
|
157
|
-
|
158
|
-
|
156
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
157
|
+
.is_api_response(true)
|
158
|
+
.convertor(ApiResponse.method(:create)))
|
159
159
|
.execute
|
160
160
|
end
|
161
161
|
|
@@ -170,7 +170,7 @@ module Square
|
|
170
170
|
# @param [BulkDeleteBookingCustomAttributesRequest] body Required parameter:
|
171
171
|
# An object containing the fields to POST for the request. See the
|
172
172
|
# corresponding object definition for field details.
|
173
|
-
# @return [
|
173
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
174
174
|
def bulk_delete_booking_custom_attributes(body:)
|
175
175
|
new_api_call_builder
|
176
176
|
.request(new_request_builder(HttpMethodEnum::POST,
|
@@ -182,9 +182,9 @@ module Square
|
|
182
182
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
183
183
|
.auth(Single.new('global')))
|
184
184
|
.response(new_response_handler
|
185
|
-
|
186
|
-
|
187
|
-
|
185
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
186
|
+
.is_api_response(true)
|
187
|
+
.convertor(ApiResponse.method(:create)))
|
188
188
|
.execute
|
189
189
|
end
|
190
190
|
|
@@ -199,7 +199,7 @@ module Square
|
|
199
199
|
# @param [BulkUpsertBookingCustomAttributesRequest] body Required parameter:
|
200
200
|
# An object containing the fields to POST for the request. See the
|
201
201
|
# corresponding object definition for field details.
|
202
|
-
# @return [
|
202
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
203
203
|
def bulk_upsert_booking_custom_attributes(body:)
|
204
204
|
new_api_call_builder
|
205
205
|
.request(new_request_builder(HttpMethodEnum::POST,
|
@@ -211,9 +211,9 @@ module Square
|
|
211
211
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
212
212
|
.auth(Single.new('global')))
|
213
213
|
.response(new_response_handler
|
214
|
-
|
215
|
-
|
216
|
-
|
214
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
215
|
+
.is_api_response(true)
|
216
|
+
.convertor(ApiResponse.method(:create)))
|
217
217
|
.execute
|
218
218
|
end
|
219
219
|
|
@@ -242,7 +242,7 @@ module Square
|
|
242
242
|
# each custom attribute. Set this parameter to `true` to get the name and
|
243
243
|
# description of each custom attribute, information about the data type, or
|
244
244
|
# other definition details. The default value is `false`.
|
245
|
-
# @return [
|
245
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
246
246
|
def list_booking_custom_attributes(booking_id:,
|
247
247
|
limit: nil,
|
248
248
|
cursor: nil,
|
@@ -259,9 +259,9 @@ module Square
|
|
259
259
|
.header_param(new_parameter('application/json', key: 'accept'))
|
260
260
|
.auth(Single.new('global')))
|
261
261
|
.response(new_response_handler
|
262
|
-
|
263
|
-
|
264
|
-
|
262
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
263
|
+
.is_api_response(true)
|
264
|
+
.convertor(ApiResponse.method(:create)))
|
265
265
|
.execute
|
266
266
|
end
|
267
267
|
|
@@ -279,7 +279,7 @@ module Square
|
|
279
279
|
# delete. This key must match the `key` of a custom attribute definition in
|
280
280
|
# the Square seller account. If the requesting application is not the
|
281
281
|
# definition owner, you must use the qualified key.
|
282
|
-
# @return [
|
282
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
283
283
|
def delete_booking_custom_attribute(booking_id:,
|
284
284
|
key:)
|
285
285
|
new_api_call_builder
|
@@ -293,9 +293,9 @@ module Square
|
|
293
293
|
.header_param(new_parameter('application/json', key: 'accept'))
|
294
294
|
.auth(Single.new('global')))
|
295
295
|
.response(new_response_handler
|
296
|
-
|
297
|
-
|
298
|
-
|
296
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
297
|
+
.is_api_response(true)
|
298
|
+
.convertor(ApiResponse.method(:create)))
|
299
299
|
.execute
|
300
300
|
end
|
301
301
|
|
@@ -322,7 +322,7 @@ module Square
|
|
322
322
|
# Square returns the specified version or a higher version if one exists. If
|
323
323
|
# the specified version is higher than the current version, Square returns a
|
324
324
|
# `BAD_REQUEST` error.
|
325
|
-
# @return [
|
325
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
326
326
|
def retrieve_booking_custom_attribute(booking_id:,
|
327
327
|
key:,
|
328
328
|
with_definition: false,
|
@@ -340,9 +340,9 @@ module Square
|
|
340
340
|
.header_param(new_parameter('application/json', key: 'accept'))
|
341
341
|
.auth(Single.new('global')))
|
342
342
|
.response(new_response_handler
|
343
|
-
|
344
|
-
|
345
|
-
|
343
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
344
|
+
.is_api_response(true)
|
345
|
+
.convertor(ApiResponse.method(:create)))
|
346
346
|
.execute
|
347
347
|
end
|
348
348
|
|
@@ -363,7 +363,7 @@ module Square
|
|
363
363
|
# @param [UpsertBookingCustomAttributeRequest] body Required parameter: An
|
364
364
|
# object containing the fields to POST for the request. See the
|
365
365
|
# corresponding object definition for field details.
|
366
|
-
# @return [
|
366
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
367
367
|
def upsert_booking_custom_attribute(booking_id:,
|
368
368
|
key:,
|
369
369
|
body:)
|
@@ -381,9 +381,9 @@ module Square
|
|
381
381
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
382
382
|
.auth(Single.new('global')))
|
383
383
|
.response(new_response_handler
|
384
|
-
|
385
|
-
|
386
|
-
|
384
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
385
|
+
.is_api_response(true)
|
386
|
+
.convertor(ApiResponse.method(:create)))
|
387
387
|
.execute
|
388
388
|
end
|
389
389
|
end
|