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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/lib/square/api/apple_pay_api.rb +15 -11
  4. data/lib/square/api/bank_accounts_api.rb +12 -12
  5. data/lib/square/api/base_api.rb +2 -1
  6. data/lib/square/api/booking_custom_attributes_api.rb +44 -44
  7. data/lib/square/api/bookings_api.rb +53 -53
  8. data/lib/square/api/cards_api.rb +16 -16
  9. data/lib/square/api/cash_drawers_api.rb +12 -12
  10. data/lib/square/api/catalog_api.rb +67 -57
  11. data/lib/square/api/checkout_api.rb +111 -26
  12. data/lib/square/api/customer_custom_attributes_api.rb +40 -40
  13. data/lib/square/api/customer_groups_api.rb +20 -20
  14. data/lib/square/api/customer_segments_api.rb +8 -8
  15. data/lib/square/api/customers_api.rb +144 -54
  16. data/lib/square/api/devices_api.rb +20 -20
  17. data/lib/square/api/disputes_api.rb +36 -36
  18. data/lib/square/api/employees_api.rb +8 -8
  19. data/lib/square/api/events_api.rb +84 -0
  20. data/lib/square/api/gift_card_activities_api.rb +10 -11
  21. data/lib/square/api/gift_cards_api.rb +36 -33
  22. data/lib/square/api/inventory_api.rb +52 -52
  23. data/lib/square/api/invoices_api.rb +109 -41
  24. data/lib/square/api/labor_api.rb +81 -80
  25. data/lib/square/api/location_custom_attributes_api.rb +44 -44
  26. data/lib/square/api/locations_api.rb +18 -17
  27. data/lib/square/api/loyalty_api.rb +72 -72
  28. data/lib/square/api/merchant_custom_attributes_api.rb +44 -44
  29. data/lib/square/api/merchants_api.rb +8 -8
  30. data/lib/square/api/mobile_authorization_api.rb +4 -4
  31. data/lib/square/api/o_auth_api.rb +15 -69
  32. data/lib/square/api/order_custom_attributes_api.rb +44 -44
  33. data/lib/square/api/orders_api.rb +32 -32
  34. data/lib/square/api/payments_api.rb +67 -31
  35. data/lib/square/api/payouts_api.rb +12 -12
  36. data/lib/square/api/refunds_api.rb +31 -13
  37. data/lib/square/api/sites_api.rb +4 -4
  38. data/lib/square/api/snippets_api.rb +12 -12
  39. data/lib/square/api/subscriptions_api.rb +48 -48
  40. data/lib/square/api/team_api.rb +146 -40
  41. data/lib/square/api/terminal_api.rb +95 -53
  42. data/lib/square/api/transactions_api.rb +16 -16
  43. data/lib/square/api/v1_transactions_api.rb +13 -292
  44. data/lib/square/api/vendors_api.rb +28 -28
  45. data/lib/square/api/webhook_subscriptions_api.rb +32 -32
  46. data/lib/square/client.rb +32 -24
  47. data/lib/square/configuration.rb +43 -15
  48. data/lib/square/http/api_response.rb +1 -1
  49. data/lib/square/http/auth/o_auth2.rb +21 -2
  50. data/lib/square.rb +4 -3
  51. data/test/api/api_test_base.rb +1 -1
  52. data/test/api/test_locations_api.rb +1 -1
  53. data/test/api/test_refunds_api.rb +4 -1
  54. data/test/webhooks/test_webhooks_helper.rb +17 -0
  55. metadata +12 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1a9e797a4ed71794d0b22d02812a467b629f093bf7b52d0f431d1989b7674ae
4
- data.tar.gz: b9f99ab1089d405de8c1e73efb286beed4f3c0e609c40e84a0453e403c31c57f
3
+ metadata.gz: 77c2bdeadc2cefd90cf043acfde740a8dc81febbf047b997214d402b20a4be26
4
+ data.tar.gz: 4d2aa8fbb3c12485fd0edb6fcdafff4723405067df639faf8f82ee7cf2bd0b65
5
5
  SHA512:
6
- metadata.gz: 5d425e644acdb896add3713f6a5883d998e37a9cd7ffe444186cff00b169f7a1fc2d1fbb492a75eb853547e28e2fe623829ece836224c3175eb25767aa9b65ff
7
- data.tar.gz: 78de8fb5d730819d3e731776ed7c87c8448feec80666a1d5b9b4a594fa78f8aa1521f25c81fc7ec03bb17f762e7b80a12f436090d030d3c44c40a4468dafa210
6
+ metadata.gz: 0ffc679938a0656374252391dff967676155325e0727e8b9bff3a685875cd3da09d67da112aa2b2ff0e431c2d7651ea4fe1bcd00fda9925e46a49e4ca73ea47b
7
+ data.tar.gz: d630339a17cb8a968550b16ffc9543ade635507914ff7258ddec32668630ac9e03bfd59ad7f98d562b4a4608b7b4e8c13aedd99c4b11bbc2fb9d6fadf6e13b52
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2023 Square, Inc.
1
+ Copyright 2024 Square, Inc.
2
2
  Licensed under the Apache License, Version 2.0 (the "License");
3
3
  you may not use this file except in compliance with the License.
4
4
  You may obtain a copy of the License at
@@ -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: The SqPaymentForm library is deprecated as of May 13, 2021, and will
13
- # only receive critical security updates until it is retired on October 31,
14
- # 2022.
15
- # You must migrate your payment form code to the Web Payments SDK to
16
- # continue using your domain for Apple Pay. For more information on
17
- # migrating to the Web Payments SDK, see [Migrate to the Web Payments
18
- # SDK](https://developer.squareup.com/docs/web-payments/migrate).
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 [RegisterDomainResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
38
- .is_api_response(true)
39
- .convertor(ApiResponse.method(:create)))
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 [ListBankAccountsResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
33
- .is_api_response(true)
34
- .convertor(ApiResponse.method(:create)))
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 [GetBankAccountByV1IdResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
57
- .is_api_response(true)
58
- .convertor(ApiResponse.method(:create)))
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 [GetBankAccountResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
78
- .is_api_response(true)
79
- .convertor(ApiResponse.method(:create)))
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
@@ -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/33.0.0.20231018 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
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 [ListBookingCustomAttributeDefinitionsResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
34
- .is_api_response(true)
35
- .convertor(ApiResponse.method(:create)))
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 [CreateBookingCustomAttributeDefinitionResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
63
- .is_api_response(true)
64
- .convertor(ApiResponse.method(:create)))
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 [DeleteBookingCustomAttributeDefinitionResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
90
- .is_api_response(true)
91
- .convertor(ApiResponse.method(:create)))
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 [RetrieveBookingCustomAttributeDefinitionResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
123
- .is_api_response(true)
124
- .convertor(ApiResponse.method(:create)))
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 [UpdateBookingCustomAttributeDefinitionResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
157
- .is_api_response(true)
158
- .convertor(ApiResponse.method(:create)))
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 [BulkDeleteBookingCustomAttributesResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
186
- .is_api_response(true)
187
- .convertor(ApiResponse.method(:create)))
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 [BulkUpsertBookingCustomAttributesResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
215
- .is_api_response(true)
216
- .convertor(ApiResponse.method(:create)))
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 [ListBookingCustomAttributesResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
263
- .is_api_response(true)
264
- .convertor(ApiResponse.method(:create)))
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 [DeleteBookingCustomAttributeResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
297
- .is_api_response(true)
298
- .convertor(ApiResponse.method(:create)))
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 [RetrieveBookingCustomAttributeResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
344
- .is_api_response(true)
345
- .convertor(ApiResponse.method(:create)))
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 [UpsertBookingCustomAttributeResponse Hash] response from the API call
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
- .deserializer(APIHelper.method(:json_deserialize))
385
- .is_api_response(true)
386
- .convertor(ApiResponse.method(:create)))
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