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
@@ -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 [ListCustomerCustomAttributeDefinitionsResponse Hash] response from the API call
27
+ # @return [ApiResponse] the complete http response with raw body and status code.
28
28
  def list_customer_custom_attribute_definitions(limit: nil,
29
29
  cursor: nil)
30
30
  new_api_call_builder
@@ -36,9 +36,9 @@ module Square
36
36
  .header_param(new_parameter('application/json', key: 'accept'))
37
37
  .auth(Single.new('global')))
38
38
  .response(new_response_handler
39
- .deserializer(APIHelper.method(:json_deserialize))
40
- .is_api_response(true)
41
- .convertor(ApiResponse.method(:create)))
39
+ .deserializer(APIHelper.method(:json_deserialize))
40
+ .is_api_response(true)
41
+ .convertor(ApiResponse.method(:create)))
42
42
  .execute
43
43
  end
44
44
 
@@ -61,7 +61,7 @@ module Square
61
61
  # @param [CreateCustomerCustomAttributeDefinitionRequest] body Required
62
62
  # parameter: An object containing the fields to POST for the request. See
63
63
  # the corresponding object definition for field details.
64
- # @return [CreateCustomerCustomAttributeDefinitionResponse Hash] response from the API call
64
+ # @return [ApiResponse] the complete http response with raw body and status code.
65
65
  def create_customer_custom_attribute_definition(body:)
66
66
  new_api_call_builder
67
67
  .request(new_request_builder(HttpMethodEnum::POST,
@@ -73,9 +73,9 @@ module Square
73
73
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
74
74
  .auth(Single.new('global')))
75
75
  .response(new_response_handler
76
- .deserializer(APIHelper.method(:json_deserialize))
77
- .is_api_response(true)
78
- .convertor(ApiResponse.method(:create)))
76
+ .deserializer(APIHelper.method(:json_deserialize))
77
+ .is_api_response(true)
78
+ .convertor(ApiResponse.method(:create)))
79
79
  .execute
80
80
  end
81
81
 
@@ -87,7 +87,7 @@ module Square
87
87
  # Only the definition owner can delete a custom attribute definition.
88
88
  # @param [String] key Required parameter: The key of the custom attribute
89
89
  # definition to delete.
90
- # @return [DeleteCustomerCustomAttributeDefinitionResponse Hash] response from the API call
90
+ # @return [ApiResponse] the complete http response with raw body and status code.
91
91
  def delete_customer_custom_attribute_definition(key:)
92
92
  new_api_call_builder
93
93
  .request(new_request_builder(HttpMethodEnum::DELETE,
@@ -98,9 +98,9 @@ module Square
98
98
  .header_param(new_parameter('application/json', key: 'accept'))
99
99
  .auth(Single.new('global')))
100
100
  .response(new_response_handler
101
- .deserializer(APIHelper.method(:json_deserialize))
102
- .is_api_response(true)
103
- .convertor(ApiResponse.method(:create)))
101
+ .deserializer(APIHelper.method(:json_deserialize))
102
+ .is_api_response(true)
103
+ .convertor(ApiResponse.method(:create)))
104
104
  .execute
105
105
  end
106
106
 
@@ -121,7 +121,7 @@ module Square
121
121
  # the request, Square returns the specified version or a higher version if
122
122
  # one exists. If the specified version is higher than the current version,
123
123
  # Square returns a `BAD_REQUEST` error.
124
- # @return [RetrieveCustomerCustomAttributeDefinitionResponse Hash] response from the API call
124
+ # @return [ApiResponse] the complete http response with raw body and status code.
125
125
  def retrieve_customer_custom_attribute_definition(key:,
126
126
  version: nil)
127
127
  new_api_call_builder
@@ -134,9 +134,9 @@ module Square
134
134
  .header_param(new_parameter('application/json', key: 'accept'))
135
135
  .auth(Single.new('global')))
136
136
  .response(new_response_handler
137
- .deserializer(APIHelper.method(:json_deserialize))
138
- .is_api_response(true)
139
- .convertor(ApiResponse.method(:create)))
137
+ .deserializer(APIHelper.method(:json_deserialize))
138
+ .is_api_response(true)
139
+ .convertor(ApiResponse.method(:create)))
140
140
  .execute
141
141
  end
142
142
 
@@ -154,7 +154,7 @@ module Square
154
154
  # @param [UpdateCustomerCustomAttributeDefinitionRequest] body Required
155
155
  # parameter: An object containing the fields to POST for the request. See
156
156
  # the corresponding object definition for field details.
157
- # @return [UpdateCustomerCustomAttributeDefinitionResponse Hash] response from the API call
157
+ # @return [ApiResponse] the complete http response with raw body and status code.
158
158
  def update_customer_custom_attribute_definition(key:,
159
159
  body:)
160
160
  new_api_call_builder
@@ -169,9 +169,9 @@ module Square
169
169
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
170
170
  .auth(Single.new('global')))
171
171
  .response(new_response_handler
172
- .deserializer(APIHelper.method(:json_deserialize))
173
- .is_api_response(true)
174
- .convertor(ApiResponse.method(:create)))
172
+ .deserializer(APIHelper.method(:json_deserialize))
173
+ .is_api_response(true)
174
+ .convertor(ApiResponse.method(:create)))
175
175
  .execute
176
176
  end
177
177
 
@@ -200,7 +200,7 @@ module Square
200
200
  # @param [BulkUpsertCustomerCustomAttributesRequest] body Required
201
201
  # parameter: An object containing the fields to POST for the request. See
202
202
  # the corresponding object definition for field details.
203
- # @return [BulkUpsertCustomerCustomAttributesResponse Hash] response from the API call
203
+ # @return [ApiResponse] the complete http response with raw body and status code.
204
204
  def bulk_upsert_customer_custom_attributes(body:)
205
205
  new_api_call_builder
206
206
  .request(new_request_builder(HttpMethodEnum::POST,
@@ -212,9 +212,9 @@ module Square
212
212
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
213
213
  .auth(Single.new('global')))
214
214
  .response(new_response_handler
215
- .deserializer(APIHelper.method(:json_deserialize))
216
- .is_api_response(true)
217
- .convertor(ApiResponse.method(:create)))
215
+ .deserializer(APIHelper.method(:json_deserialize))
216
+ .is_api_response(true)
217
+ .convertor(ApiResponse.method(:create)))
218
218
  .execute
219
219
  end
220
220
 
@@ -248,7 +248,7 @@ module Square
248
248
  # each custom attribute. Set this parameter to `true` to get the name and
249
249
  # description of each custom attribute, information about the data type, or
250
250
  # other definition details. The default value is `false`.
251
- # @return [ListCustomerCustomAttributesResponse Hash] response from the API call
251
+ # @return [ApiResponse] the complete http response with raw body and status code.
252
252
  def list_customer_custom_attributes(customer_id:,
253
253
  limit: nil,
254
254
  cursor: nil,
@@ -265,9 +265,9 @@ module Square
265
265
  .header_param(new_parameter('application/json', key: 'accept'))
266
266
  .auth(Single.new('global')))
267
267
  .response(new_response_handler
268
- .deserializer(APIHelper.method(:json_deserialize))
269
- .is_api_response(true)
270
- .convertor(ApiResponse.method(:create)))
268
+ .deserializer(APIHelper.method(:json_deserialize))
269
+ .is_api_response(true)
270
+ .convertor(ApiResponse.method(:create)))
271
271
  .execute
272
272
  end
273
273
 
@@ -284,7 +284,7 @@ module Square
284
284
  # delete. This key must match the `key` of a custom attribute definition in
285
285
  # the Square seller account. If the requesting application is not the
286
286
  # definition owner, you must use the qualified key.
287
- # @return [DeleteCustomerCustomAttributeResponse Hash] response from the API call
287
+ # @return [ApiResponse] the complete http response with raw body and status code.
288
288
  def delete_customer_custom_attribute(customer_id:,
289
289
  key:)
290
290
  new_api_call_builder
@@ -298,9 +298,9 @@ module Square
298
298
  .header_param(new_parameter('application/json', key: 'accept'))
299
299
  .auth(Single.new('global')))
300
300
  .response(new_response_handler
301
- .deserializer(APIHelper.method(:json_deserialize))
302
- .is_api_response(true)
303
- .convertor(ApiResponse.method(:create)))
301
+ .deserializer(APIHelper.method(:json_deserialize))
302
+ .is_api_response(true)
303
+ .convertor(ApiResponse.method(:create)))
304
304
  .execute
305
305
  end
306
306
 
@@ -333,7 +333,7 @@ module Square
333
333
  # Square returns the specified version or a higher version if one exists. If
334
334
  # the specified version is higher than the current version, Square returns a
335
335
  # `BAD_REQUEST` error.
336
- # @return [RetrieveCustomerCustomAttributeResponse Hash] response from the API call
336
+ # @return [ApiResponse] the complete http response with raw body and status code.
337
337
  def retrieve_customer_custom_attribute(customer_id:,
338
338
  key:,
339
339
  with_definition: false,
@@ -351,9 +351,9 @@ module Square
351
351
  .header_param(new_parameter('application/json', key: 'accept'))
352
352
  .auth(Single.new('global')))
353
353
  .response(new_response_handler
354
- .deserializer(APIHelper.method(:json_deserialize))
355
- .is_api_response(true)
356
- .convertor(ApiResponse.method(:create)))
354
+ .deserializer(APIHelper.method(:json_deserialize))
355
+ .is_api_response(true)
356
+ .convertor(ApiResponse.method(:create)))
357
357
  .execute
358
358
  end
359
359
 
@@ -381,7 +381,7 @@ module Square
381
381
  # @param [UpsertCustomerCustomAttributeRequest] body Required parameter: An
382
382
  # object containing the fields to POST for the request. See the
383
383
  # corresponding object definition for field details.
384
- # @return [UpsertCustomerCustomAttributeResponse Hash] response from the API call
384
+ # @return [ApiResponse] the complete http response with raw body and status code.
385
385
  def upsert_customer_custom_attribute(customer_id:,
386
386
  key:,
387
387
  body:)
@@ -399,9 +399,9 @@ module Square
399
399
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
400
400
  .auth(Single.new('global')))
401
401
  .response(new_response_handler
402
- .deserializer(APIHelper.method(:json_deserialize))
403
- .is_api_response(true)
404
- .convertor(ApiResponse.method(:create)))
402
+ .deserializer(APIHelper.method(:json_deserialize))
403
+ .is_api_response(true)
404
+ .convertor(ApiResponse.method(:create)))
405
405
  .execute
406
406
  end
407
407
  end
@@ -14,7 +14,7 @@ module Square
14
14
  # The default value is 50. For more information, see
15
15
  # [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
16
16
  # atterns/pagination).
17
- # @return [ListCustomerGroupsResponse Hash] response from the API call
17
+ # @return [ApiResponse] the complete http response with raw body and status code.
18
18
  def list_customer_groups(cursor: nil,
19
19
  limit: nil)
20
20
  new_api_call_builder
@@ -26,9 +26,9 @@ module Square
26
26
  .header_param(new_parameter('application/json', key: 'accept'))
27
27
  .auth(Single.new('global')))
28
28
  .response(new_response_handler
29
- .deserializer(APIHelper.method(:json_deserialize))
30
- .is_api_response(true)
31
- .convertor(ApiResponse.method(:create)))
29
+ .deserializer(APIHelper.method(:json_deserialize))
30
+ .is_api_response(true)
31
+ .convertor(ApiResponse.method(:create)))
32
32
  .execute
33
33
  end
34
34
 
@@ -37,7 +37,7 @@ module Square
37
37
  # @param [CreateCustomerGroupRequest] body Required parameter: An object
38
38
  # containing the fields to POST for the request. See the corresponding
39
39
  # object definition for field details.
40
- # @return [CreateCustomerGroupResponse Hash] response from the API call
40
+ # @return [ApiResponse] the complete http response with raw body and status code.
41
41
  def create_customer_group(body:)
42
42
  new_api_call_builder
43
43
  .request(new_request_builder(HttpMethodEnum::POST,
@@ -49,16 +49,16 @@ module Square
49
49
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
50
50
  .auth(Single.new('global')))
51
51
  .response(new_response_handler
52
- .deserializer(APIHelper.method(:json_deserialize))
53
- .is_api_response(true)
54
- .convertor(ApiResponse.method(:create)))
52
+ .deserializer(APIHelper.method(:json_deserialize))
53
+ .is_api_response(true)
54
+ .convertor(ApiResponse.method(:create)))
55
55
  .execute
56
56
  end
57
57
 
58
58
  # Deletes a customer group as identified by the `group_id` value.
59
59
  # @param [String] group_id Required parameter: The ID of the customer group
60
60
  # to delete.
61
- # @return [DeleteCustomerGroupResponse Hash] response from the API call
61
+ # @return [ApiResponse] the complete http response with raw body and status code.
62
62
  def delete_customer_group(group_id:)
63
63
  new_api_call_builder
64
64
  .request(new_request_builder(HttpMethodEnum::DELETE,
@@ -69,16 +69,16 @@ module Square
69
69
  .header_param(new_parameter('application/json', key: 'accept'))
70
70
  .auth(Single.new('global')))
71
71
  .response(new_response_handler
72
- .deserializer(APIHelper.method(:json_deserialize))
73
- .is_api_response(true)
74
- .convertor(ApiResponse.method(:create)))
72
+ .deserializer(APIHelper.method(:json_deserialize))
73
+ .is_api_response(true)
74
+ .convertor(ApiResponse.method(:create)))
75
75
  .execute
76
76
  end
77
77
 
78
78
  # Retrieves a specific customer group as identified by the `group_id` value.
79
79
  # @param [String] group_id Required parameter: The ID of the customer group
80
80
  # to retrieve.
81
- # @return [RetrieveCustomerGroupResponse Hash] response from the API call
81
+ # @return [ApiResponse] the complete http response with raw body and status code.
82
82
  def retrieve_customer_group(group_id:)
83
83
  new_api_call_builder
84
84
  .request(new_request_builder(HttpMethodEnum::GET,
@@ -89,9 +89,9 @@ module Square
89
89
  .header_param(new_parameter('application/json', key: 'accept'))
90
90
  .auth(Single.new('global')))
91
91
  .response(new_response_handler
92
- .deserializer(APIHelper.method(:json_deserialize))
93
- .is_api_response(true)
94
- .convertor(ApiResponse.method(:create)))
92
+ .deserializer(APIHelper.method(:json_deserialize))
93
+ .is_api_response(true)
94
+ .convertor(ApiResponse.method(:create)))
95
95
  .execute
96
96
  end
97
97
 
@@ -101,7 +101,7 @@ module Square
101
101
  # @param [UpdateCustomerGroupRequest] body Required parameter: An object
102
102
  # containing the fields to POST for the request. See the corresponding
103
103
  # object definition for field details.
104
- # @return [UpdateCustomerGroupResponse Hash] response from the API call
104
+ # @return [ApiResponse] the complete http response with raw body and status code.
105
105
  def update_customer_group(group_id:,
106
106
  body:)
107
107
  new_api_call_builder
@@ -116,9 +116,9 @@ module Square
116
116
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
117
117
  .auth(Single.new('global')))
118
118
  .response(new_response_handler
119
- .deserializer(APIHelper.method(:json_deserialize))
120
- .is_api_response(true)
121
- .convertor(ApiResponse.method(:create)))
119
+ .deserializer(APIHelper.method(:json_deserialize))
120
+ .is_api_response(true)
121
+ .convertor(ApiResponse.method(:create)))
122
122
  .execute
123
123
  end
124
124
  end
@@ -14,7 +14,7 @@ module Square
14
14
  # VALUE_TOO_HIGH` error. The default value is 50. For more information, see
15
15
  # [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
16
16
  # atterns/pagination).
17
- # @return [ListCustomerSegmentsResponse Hash] response from the API call
17
+ # @return [ApiResponse] the complete http response with raw body and status code.
18
18
  def list_customer_segments(cursor: nil,
19
19
  limit: nil)
20
20
  new_api_call_builder
@@ -26,9 +26,9 @@ module Square
26
26
  .header_param(new_parameter('application/json', key: 'accept'))
27
27
  .auth(Single.new('global')))
28
28
  .response(new_response_handler
29
- .deserializer(APIHelper.method(:json_deserialize))
30
- .is_api_response(true)
31
- .convertor(ApiResponse.method(:create)))
29
+ .deserializer(APIHelper.method(:json_deserialize))
30
+ .is_api_response(true)
31
+ .convertor(ApiResponse.method(:create)))
32
32
  .execute
33
33
  end
34
34
 
@@ -36,7 +36,7 @@ module Square
36
36
  # value.
37
37
  # @param [String] segment_id Required parameter: The Square-issued ID of the
38
38
  # customer segment.
39
- # @return [RetrieveCustomerSegmentResponse Hash] response from the API call
39
+ # @return [ApiResponse] the complete http response with raw body and status code.
40
40
  def retrieve_customer_segment(segment_id:)
41
41
  new_api_call_builder
42
42
  .request(new_request_builder(HttpMethodEnum::GET,
@@ -47,9 +47,9 @@ module Square
47
47
  .header_param(new_parameter('application/json', key: 'accept'))
48
48
  .auth(Single.new('global')))
49
49
  .response(new_response_handler
50
- .deserializer(APIHelper.method(:json_deserialize))
51
- .is_api_response(true)
52
- .convertor(ApiResponse.method(:create)))
50
+ .deserializer(APIHelper.method(:json_deserialize))
51
+ .is_api_response(true)
52
+ .convertor(ApiResponse.method(:create)))
53
53
  .execute
54
54
  end
55
55
  end