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
@@ -24,7 +24,7 @@ module Square
|
|
24
24
|
# more information, see
|
25
25
|
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
26
26
|
# atterns/pagination).
|
27
|
-
# @return [
|
27
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
28
28
|
def list_location_custom_attribute_definitions(visibility_filter: nil,
|
29
29
|
limit: nil,
|
30
30
|
cursor: nil)
|
@@ -38,9 +38,9 @@ module Square
|
|
38
38
|
.header_param(new_parameter('application/json', key: 'accept'))
|
39
39
|
.auth(Single.new('global')))
|
40
40
|
.response(new_response_handler
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
42
|
+
.is_api_response(true)
|
43
|
+
.convertor(ApiResponse.method(:create)))
|
44
44
|
.execute
|
45
45
|
end
|
46
46
|
|
@@ -59,7 +59,7 @@ module Square
|
|
59
59
|
# @param [CreateLocationCustomAttributeDefinitionRequest] body Required
|
60
60
|
# parameter: An object containing the fields to POST for the request. See
|
61
61
|
# the corresponding object definition for field details.
|
62
|
-
# @return [
|
62
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
63
63
|
def create_location_custom_attribute_definition(body:)
|
64
64
|
new_api_call_builder
|
65
65
|
.request(new_request_builder(HttpMethodEnum::POST,
|
@@ -71,9 +71,9 @@ module Square
|
|
71
71
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
72
72
|
.auth(Single.new('global')))
|
73
73
|
.response(new_response_handler
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
75
|
+
.is_api_response(true)
|
76
|
+
.convertor(ApiResponse.method(:create)))
|
77
77
|
.execute
|
78
78
|
end
|
79
79
|
|
@@ -85,7 +85,7 @@ module Square
|
|
85
85
|
# Only the definition owner can delete a custom attribute definition.
|
86
86
|
# @param [String] key Required parameter: The key of the custom attribute
|
87
87
|
# definition to delete.
|
88
|
-
# @return [
|
88
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
89
89
|
def delete_location_custom_attribute_definition(key:)
|
90
90
|
new_api_call_builder
|
91
91
|
.request(new_request_builder(HttpMethodEnum::DELETE,
|
@@ -96,9 +96,9 @@ module Square
|
|
96
96
|
.header_param(new_parameter('application/json', key: 'accept'))
|
97
97
|
.auth(Single.new('global')))
|
98
98
|
.response(new_response_handler
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
100
|
+
.is_api_response(true)
|
101
|
+
.convertor(ApiResponse.method(:create)))
|
102
102
|
.execute
|
103
103
|
end
|
104
104
|
|
@@ -116,7 +116,7 @@ module Square
|
|
116
116
|
# the request, Square returns the specified version or a higher version if
|
117
117
|
# one exists. If the specified version is higher than the current version,
|
118
118
|
# Square returns a `BAD_REQUEST` error.
|
119
|
-
# @return [
|
119
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
120
120
|
def retrieve_location_custom_attribute_definition(key:,
|
121
121
|
version: nil)
|
122
122
|
new_api_call_builder
|
@@ -129,9 +129,9 @@ module Square
|
|
129
129
|
.header_param(new_parameter('application/json', key: 'accept'))
|
130
130
|
.auth(Single.new('global')))
|
131
131
|
.response(new_response_handler
|
132
|
-
|
133
|
-
|
134
|
-
|
132
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
133
|
+
.is_api_response(true)
|
134
|
+
.convertor(ApiResponse.method(:create)))
|
135
135
|
.execute
|
136
136
|
end
|
137
137
|
|
@@ -146,7 +146,7 @@ module Square
|
|
146
146
|
# @param [UpdateLocationCustomAttributeDefinitionRequest] body Required
|
147
147
|
# parameter: An object containing the fields to POST for the request. See
|
148
148
|
# the corresponding object definition for field details.
|
149
|
-
# @return [
|
149
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
150
150
|
def update_location_custom_attribute_definition(key:,
|
151
151
|
body:)
|
152
152
|
new_api_call_builder
|
@@ -161,9 +161,9 @@ module Square
|
|
161
161
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
162
162
|
.auth(Single.new('global')))
|
163
163
|
.response(new_response_handler
|
164
|
-
|
165
|
-
|
166
|
-
|
164
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
165
|
+
.is_api_response(true)
|
166
|
+
.convertor(ApiResponse.method(:create)))
|
167
167
|
.execute
|
168
168
|
end
|
169
169
|
|
@@ -175,7 +175,7 @@ module Square
|
|
175
175
|
# @param [BulkDeleteLocationCustomAttributesRequest] body Required
|
176
176
|
# parameter: An object containing the fields to POST for the request. See
|
177
177
|
# the corresponding object definition for field details.
|
178
|
-
# @return [
|
178
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
179
179
|
def bulk_delete_location_custom_attributes(body:)
|
180
180
|
new_api_call_builder
|
181
181
|
.request(new_request_builder(HttpMethodEnum::POST,
|
@@ -187,9 +187,9 @@ module Square
|
|
187
187
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
188
188
|
.auth(Single.new('global')))
|
189
189
|
.response(new_response_handler
|
190
|
-
|
191
|
-
|
192
|
-
|
190
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
191
|
+
.is_api_response(true)
|
192
|
+
.convertor(ApiResponse.method(:create)))
|
193
193
|
.execute
|
194
194
|
end
|
195
195
|
|
@@ -215,7 +215,7 @@ module Square
|
|
215
215
|
# @param [BulkUpsertLocationCustomAttributesRequest] body Required
|
216
216
|
# parameter: An object containing the fields to POST for the request. See
|
217
217
|
# the corresponding object definition for field details.
|
218
|
-
# @return [
|
218
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
219
219
|
def bulk_upsert_location_custom_attributes(body:)
|
220
220
|
new_api_call_builder
|
221
221
|
.request(new_request_builder(HttpMethodEnum::POST,
|
@@ -227,9 +227,9 @@ module Square
|
|
227
227
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
228
228
|
.auth(Single.new('global')))
|
229
229
|
.response(new_response_handler
|
230
|
-
|
231
|
-
|
232
|
-
|
230
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
231
|
+
.is_api_response(true)
|
232
|
+
.convertor(ApiResponse.method(:create)))
|
233
233
|
.execute
|
234
234
|
end
|
235
235
|
|
@@ -265,7 +265,7 @@ module Square
|
|
265
265
|
# each custom attribute. Set this parameter to `true` to get the name and
|
266
266
|
# description of each custom attribute, information about the data type, or
|
267
267
|
# other definition details. The default value is `false`.
|
268
|
-
# @return [
|
268
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
269
269
|
def list_location_custom_attributes(location_id:,
|
270
270
|
visibility_filter: nil,
|
271
271
|
limit: nil,
|
@@ -284,9 +284,9 @@ module Square
|
|
284
284
|
.header_param(new_parameter('application/json', key: 'accept'))
|
285
285
|
.auth(Single.new('global')))
|
286
286
|
.response(new_response_handler
|
287
|
-
|
288
|
-
|
289
|
-
|
287
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
288
|
+
.is_api_response(true)
|
289
|
+
.convertor(ApiResponse.method(:create)))
|
290
290
|
.execute
|
291
291
|
end
|
292
292
|
|
@@ -301,7 +301,7 @@ module Square
|
|
301
301
|
# delete. This key must match the `key` of a custom attribute definition in
|
302
302
|
# the Square seller account. If the requesting application is not the
|
303
303
|
# definition owner, you must use the qualified key.
|
304
|
-
# @return [
|
304
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
305
305
|
def delete_location_custom_attribute(location_id:,
|
306
306
|
key:)
|
307
307
|
new_api_call_builder
|
@@ -315,9 +315,9 @@ module Square
|
|
315
315
|
.header_param(new_parameter('application/json', key: 'accept'))
|
316
316
|
.auth(Single.new('global')))
|
317
317
|
.response(new_response_handler
|
318
|
-
|
319
|
-
|
320
|
-
|
318
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
319
|
+
.is_api_response(true)
|
320
|
+
.convertor(ApiResponse.method(:create)))
|
321
321
|
.execute
|
322
322
|
end
|
323
323
|
|
@@ -347,7 +347,7 @@ module Square
|
|
347
347
|
# Square returns the specified version or a higher version if one exists. If
|
348
348
|
# the specified version is higher than the current version, Square returns a
|
349
349
|
# `BAD_REQUEST` error.
|
350
|
-
# @return [
|
350
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
351
351
|
def retrieve_location_custom_attribute(location_id:,
|
352
352
|
key:,
|
353
353
|
with_definition: false,
|
@@ -365,9 +365,9 @@ module Square
|
|
365
365
|
.header_param(new_parameter('application/json', key: 'accept'))
|
366
366
|
.auth(Single.new('global')))
|
367
367
|
.response(new_response_handler
|
368
|
-
|
369
|
-
|
370
|
-
|
368
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
369
|
+
.is_api_response(true)
|
370
|
+
.convertor(ApiResponse.method(:create)))
|
371
371
|
.execute
|
372
372
|
end
|
373
373
|
|
@@ -392,7 +392,7 @@ module Square
|
|
392
392
|
# @param [UpsertLocationCustomAttributeRequest] body Required parameter: An
|
393
393
|
# object containing the fields to POST for the request. See the
|
394
394
|
# corresponding object definition for field details.
|
395
|
-
# @return [
|
395
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
396
396
|
def upsert_location_custom_attribute(location_id:,
|
397
397
|
key:,
|
398
398
|
body:)
|
@@ -410,9 +410,9 @@ module Square
|
|
410
410
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
411
411
|
.auth(Single.new('global')))
|
412
412
|
.response(new_response_handler
|
413
|
-
|
414
|
-
|
415
|
-
|
413
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
414
|
+
.is_api_response(true)
|
415
|
+
.convertor(ApiResponse.method(:create)))
|
416
416
|
.execute
|
417
417
|
end
|
418
418
|
end
|
@@ -3,8 +3,9 @@ module Square
|
|
3
3
|
class LocationsApi < BaseApi
|
4
4
|
# Provides details about all of the seller's
|
5
5
|
# [locations](https://developer.squareup.com/docs/locations-api),
|
6
|
-
# including those with an inactive status.
|
7
|
-
#
|
6
|
+
# including those with an inactive status. Locations are listed
|
7
|
+
# alphabetically by `name`.
|
8
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
8
9
|
def list_locations
|
9
10
|
new_api_call_builder
|
10
11
|
.request(new_request_builder(HttpMethodEnum::GET,
|
@@ -13,9 +14,9 @@ module Square
|
|
13
14
|
.header_param(new_parameter('application/json', key: 'accept'))
|
14
15
|
.auth(Single.new('global')))
|
15
16
|
.response(new_response_handler
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
18
|
+
.is_api_response(true)
|
19
|
+
.convertor(ApiResponse.method(:create)))
|
19
20
|
.execute
|
20
21
|
end
|
21
22
|
|
@@ -32,7 +33,7 @@ module Square
|
|
32
33
|
# @param [CreateLocationRequest] body Required parameter: An object
|
33
34
|
# containing the fields to POST for the request. See the corresponding
|
34
35
|
# object definition for field details.
|
35
|
-
# @return [
|
36
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
36
37
|
def create_location(body:)
|
37
38
|
new_api_call_builder
|
38
39
|
.request(new_request_builder(HttpMethodEnum::POST,
|
@@ -44,9 +45,9 @@ module Square
|
|
44
45
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
45
46
|
.auth(Single.new('global')))
|
46
47
|
.response(new_response_handler
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
49
|
+
.is_api_response(true)
|
50
|
+
.convertor(ApiResponse.method(:create)))
|
50
51
|
.execute
|
51
52
|
end
|
52
53
|
|
@@ -56,7 +57,7 @@ module Square
|
|
56
57
|
# -location).
|
57
58
|
# @param [String] location_id Required parameter: The ID of the location to
|
58
59
|
# retrieve. Specify the string "main" to return the main location.
|
59
|
-
# @return [
|
60
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
60
61
|
def retrieve_location(location_id:)
|
61
62
|
new_api_call_builder
|
62
63
|
.request(new_request_builder(HttpMethodEnum::GET,
|
@@ -67,9 +68,9 @@ module Square
|
|
67
68
|
.header_param(new_parameter('application/json', key: 'accept'))
|
68
69
|
.auth(Single.new('global')))
|
69
70
|
.response(new_response_handler
|
70
|
-
|
71
|
-
|
72
|
-
|
71
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
72
|
+
.is_api_response(true)
|
73
|
+
.convertor(ApiResponse.method(:create)))
|
73
74
|
.execute
|
74
75
|
end
|
75
76
|
|
@@ -79,7 +80,7 @@ module Square
|
|
79
80
|
# @param [UpdateLocationRequest] body Required parameter: An object
|
80
81
|
# containing the fields to POST for the request. See the corresponding
|
81
82
|
# object definition for field details.
|
82
|
-
# @return [
|
83
|
+
# @return [ApiResponse] the complete http response with raw body and status code.
|
83
84
|
def update_location(location_id:,
|
84
85
|
body:)
|
85
86
|
new_api_call_builder
|
@@ -94,9 +95,9 @@ module Square
|
|
94
95
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
95
96
|
.auth(Single.new('global')))
|
96
97
|
.response(new_response_handler
|
97
|
-
|
98
|
-
|
99
|
-
|
98
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
99
|
+
.is_api_response(true)
|
100
|
+
.convertor(ApiResponse.method(:create)))
|
100
101
|
.execute
|
101
102
|
end
|
102
103
|
end
|