square.rb 19.0.0.20220420 → 21.0.0.20220720

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 431d8365d32b12be40203cfb143d88518f74cee228a0b36755cdc5fc8b782200
4
- data.tar.gz: 5349f02eb93bf190d16d17ea0f13d3c434fdcb75a37825e1cdcb6406744c7385
3
+ metadata.gz: b8c49dc5dec3f51ebfdb70e1789d9ffd0c1826b9f953c7a1e0fa59b62dae9d4f
4
+ data.tar.gz: b49dd9dbf71cdb0c1371dc0f5fb9505a26aaffe5c1905a366a3e46ecae5ea7fe
5
5
  SHA512:
6
- metadata.gz: 65afbe4492802c447ee9aa509cc282720a88e7e34f398609818e4cc60b2262d05584bdb736793d44f4a2d49299f350a4c8241666ebe452634e2ac73097424633
7
- data.tar.gz: a0a524485adeb61c20502b6956df68fc908c0e9e52459421be2382ad962ccd17a0e4f128d1bf7ed341a2f9bed95c31da735512ddd73327d7ba739c52ae38d1f9
6
+ metadata.gz: bf2fcb52842fd5fc4f4b0cce1196a0276b882ec2d27d9a1d1eb6c717c0130eca6c52c0fda1d176bf4cc7f78f64b018162a58e484aa548534f58bf5738cee0e8d
7
+ data.tar.gz: d2efdfc7be2f8afde9906e01bc3b6dac865fd092f0394ea5ebe3e427101752251100ff409e8a9fff7b5c7d7af5d52278ec641289b90a52a8c6aa70715ce6c39c
data/README.md CHANGED
@@ -62,6 +62,7 @@ rake
62
62
  * [Checkout]
63
63
  * [Apple Pay]
64
64
  * [Cards]
65
+ * [Payouts]
65
66
 
66
67
  ### Terminal
67
68
  * [Terminal]
@@ -81,6 +82,7 @@ rake
81
82
 
82
83
  ### Customers
83
84
  * [Customers]
85
+ * [Customer Custom Attributes]
84
86
  * [Customer Groups]
85
87
  * [Customer Segments]
86
88
 
@@ -99,6 +101,7 @@ rake
99
101
  * [Locations]
100
102
  * [Devices]
101
103
  * [Cash Drawers]
104
+ * [Vendors]
102
105
 
103
106
  ### Team
104
107
  * [Team]
@@ -134,6 +137,7 @@ rake
134
137
  [Terminal]: doc/api/terminal.md
135
138
  [Team]: doc/api/team.md
136
139
  [Cash Drawers]: doc/api/cash-drawers.md
140
+ [Vendors]: doc/api/vendors.md
137
141
  [Customer Groups]: doc/api/customer-groups.md
138
142
  [Customer Segments]: doc/api/customer-segments.md
139
143
  [Bank Accounts]: doc/api/bank-accounts.md
@@ -141,6 +145,7 @@ rake
141
145
  [Checkout]: doc/api/checkout.md
142
146
  [Catalog]: doc/api/catalog.md
143
147
  [Customers]: doc/api/customers.md
148
+ [Customer Custom Attributes]: doc/api/customer-custom-attributes.md
144
149
  [Employees]: doc/api/employees.md
145
150
  [Inventory]: doc/api/inventory.md
146
151
  [Labor]: doc/api/labor.md
@@ -162,5 +167,6 @@ rake
162
167
  [Sites]: doc/api/sites.md
163
168
  [Snippets]: doc/api/snippets.md
164
169
  [Cards]: doc/api/cards.md
170
+ [Payouts]: doc/api/payouts.md
165
171
  [Gift Cards]: doc/api/gift-cards.md
166
172
  [Gift Card Activities]: doc/api/gift-card-activities.md
@@ -20,6 +20,13 @@ module Square
20
20
  end
21
21
  end
22
22
 
23
+ def validate_parameters_types(args)
24
+ args.each do |_name, type|
25
+ key, val = type.first
26
+ APIHelper.validate_types(key, val) unless key.nil?
27
+ end
28
+ end
29
+
23
30
  def execute_request(request, binary: false)
24
31
  @http_call_back&.on_before_request(request)
25
32
 
@@ -38,7 +45,7 @@ module Square
38
45
  end
39
46
 
40
47
  def get_user_agent
41
- user_agent = 'Square-Ruby-SDK/19.0.0.20220420 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
48
+ user_agent = 'Square-Ruby-SDK/21.0.0.20220720 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
42
49
  user_agent['{engine}'] = RUBY_ENGINE
43
50
  user_agent['{engine-version}'] = RUBY_ENGINE_VERSION
44
51
  user_agent['{os-info}'] = RUBY_PLATFORM
@@ -74,6 +74,9 @@ module Square
74
74
  # `APPOINTMENTS_WRITE` for the OAuth scope.
75
75
  # To call this endpoint with seller-level permissions, set
76
76
  # `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
77
+ # For calls to this endpoint with seller-level permissions to succeed, the
78
+ # seller must have subscribed to *Appointments Plus*
79
+ # or *Appointments Premium*.
77
80
  # @param [CreateBookingRequest] body Required parameter: An object
78
81
  # containing the fields to POST for the request. See the corresponding
79
82
  # object definition for field details.
@@ -175,9 +178,9 @@ module Square
175
178
  end
176
179
 
177
180
  # Lists booking profiles for team members.
178
- # @param [Boolean] bookable_only Optional parameter: Indicates whether to
179
- # include only bookable team members in the returned result (`true`) or not
180
- # (`false`).
181
+ # @param [TrueClass|FalseClass] bookable_only Optional parameter: Indicates
182
+ # whether to include only bookable team members in the returned result
183
+ # (`true`) or not (`false`).
181
184
  # @param [Integer] limit Optional parameter: The maximum number of results
182
185
  # to return in a paged response.
183
186
  # @param [String] cursor Optional parameter: The pagination cursor from the
@@ -303,6 +306,9 @@ module Square
303
306
  # `APPOINTMENTS_WRITE` for the OAuth scope.
304
307
  # To call this endpoint with seller-level permissions, set
305
308
  # `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
309
+ # For calls to this endpoint with seller-level permissions to succeed, the
310
+ # seller must have subscribed to *Appointments Plus*
311
+ # or *Appointments Premium*.
306
312
  # @param [String] booking_id Required parameter: The ID of the
307
313
  # [Booking]($m/Booking) object representing the to-be-updated booking.
308
314
  # @param [UpdateBookingRequest] body Required parameter: An object
@@ -348,6 +354,9 @@ module Square
348
354
  # `APPOINTMENTS_WRITE` for the OAuth scope.
349
355
  # To call this endpoint with seller-level permissions, set
350
356
  # `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
357
+ # For calls to this endpoint with seller-level permissions to succeed, the
358
+ # seller must have subscribed to *Appointments Plus*
359
+ # or *Appointments Premium*.
351
360
  # @param [String] booking_id Required parameter: The ID of the
352
361
  # [Booking]($m/Booking) object representing the to-be-cancelled booking.
353
362
  # @param [CancelBookingRequest] body Required parameter: An object
@@ -15,8 +15,9 @@ module Square
15
15
  # @param [String] customer_id Optional parameter: Limit results to cards
16
16
  # associated with the customer supplied. By default, all cards owned by the
17
17
  # merchant are returned.
18
- # @param [Boolean] include_disabled Optional parameter: Includes disabled
19
- # cards. By default, all enabled cards owned by the merchant are returned.
18
+ # @param [TrueClass|FalseClass] include_disabled Optional parameter:
19
+ # Includes disabled cards. By default, all enabled cards owned by the
20
+ # merchant are returned.
20
21
  # @param [String] reference_id Optional parameter: Limit results to cards
21
22
  # associated with the reference_id supplied.
22
23
  # @param [SortOrder] sort_order Optional parameter: Sorts the returned list
@@ -316,11 +316,11 @@ module Square
316
316
  # Square API used to make the request. Object types that are nested onto
317
317
  # other object types are not included in the defaults. At the current API
318
318
  # version the default object types are: ITEM, CATEGORY, TAX, DISCOUNT,
319
- # MODIFIER_LIST, DINING_OPTION, TAX_EXEMPTION, SERVICE_CHARGE, PRICING_RULE,
320
- # PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT, SUBSCRIPTION_PLAN,
321
- # ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS.
322
- # @param [Long] catalog_version Optional parameter: The specific version of
323
- # the catalog objects to be included in the response. This allows you to
319
+ # MODIFIER_LIST, PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT,
320
+ # SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION,
321
+ # QUICK_AMOUNT_SETTINGS.
322
+ # @param [Integer] catalog_version Optional parameter: The specific version
323
+ # of the catalog objects to be included in the response. This allows you to
324
324
  # retrieve historical versions of objects. The specified version value is
325
325
  # matched against the [CatalogObject]($m/CatalogObject)s' `version`
326
326
  # attribute. If not included, results will be from the current version of
@@ -448,26 +448,26 @@ module Square
448
448
  # any [CatalogTax]($m/CatalogTax) objects that apply to it.
449
449
  # @param [String] object_id Required parameter: The object ID of any type of
450
450
  # catalog objects to be retrieved.
451
- # @param [Boolean] include_related_objects Optional parameter: If `true`,
452
- # the response will include additional objects that are related to the
453
- # requested objects. Related objects are defined as any objects referenced
454
- # by ID by the results in the `objects` field of the response. These objects
455
- # are put in the `related_objects` field. Setting this to `true` is helpful
456
- # when the objects are needed for immediate display to a user. This process
457
- # only goes one level deep. Objects referenced by the related objects will
458
- # not be included. For example, if the `objects` field of the response
459
- # contains a CatalogItem, its associated CatalogCategory objects, CatalogTax
460
- # objects, CatalogImage objects and CatalogModifierLists will be returned in
461
- # the `related_objects` field of the response. If the `objects` field of the
462
- # response contains a CatalogItemVariation, its parent CatalogItem will be
463
- # returned in the `related_objects` field of the response. Default value:
464
- # `false`
465
- # @param [Long] catalog_version Optional parameter: Requests objects as of a
466
- # specific version of the catalog. This allows you to retrieve historical
467
- # versions of objects. The value to retrieve a specific version of an object
468
- # can be found in the version field of [CatalogObject]($m/CatalogObject)s.
469
- # If not included, results will be from the current version of the
470
- # catalog.
451
+ # @param [TrueClass|FalseClass] include_related_objects Optional parameter:
452
+ # If `true`, the response will include additional objects that are related
453
+ # to the requested objects. Related objects are defined as any objects
454
+ # referenced by ID by the results in the `objects` field of the response.
455
+ # These objects are put in the `related_objects` field. Setting this to
456
+ # `true` is helpful when the objects are needed for immediate display to a
457
+ # user. This process only goes one level deep. Objects referenced by the
458
+ # related objects will not be included. For example, if the `objects` field
459
+ # of the response contains a CatalogItem, its associated CatalogCategory
460
+ # objects, CatalogTax objects, CatalogImage objects and CatalogModifierLists
461
+ # will be returned in the `related_objects` field of the response. If the
462
+ # `objects` field of the response contains a CatalogItemVariation, its
463
+ # parent CatalogItem will be returned in the `related_objects` field of the
464
+ # response. Default value: `false`
465
+ # @param [Integer] catalog_version Optional parameter: Requests objects as
466
+ # of a specific version of the catalog. This allows you to retrieve
467
+ # historical versions of objects. The value to retrieve a specific version
468
+ # of an object can be found in the version field of
469
+ # [CatalogObject]($m/CatalogObject)s. If not included, results will be from
470
+ # the current version of the catalog.
471
471
  # @return [RetrieveCatalogObjectResponse Hash] response from the API call
472
472
  def retrieve_catalog_object(object_id:,
473
473
  include_related_objects: false,
@@ -8,6 +8,13 @@ module Square
8
8
  # Links a `checkoutId` to a `checkout_page_url` that customers are
9
9
  # directed to in order to provide their payment information using a
10
10
  # payment processing workflow hosted on connect.squareup.com.
11
+ # NOTE: The Checkout API has been updated with new features.
12
+ # For more information, see [Checkout API
13
+ # highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-
14
+ # highlights).
15
+ # We recommend that you use the
16
+ # new [CreatePaymentLink]($e/Checkout/CreatePaymentLink)
17
+ # endpoint in place of this previously released endpoint.
11
18
  # @param [String] location_id Required parameter: The ID of the business
12
19
  # location to associate the checkout with.
13
20
  # @param [CreateCheckoutRequest] body Required parameter: An object
@@ -47,5 +54,200 @@ module Square
47
54
  _response, data: decoded, errors: _errors
48
55
  )
49
56
  end
57
+
58
+ # Lists all payment links.
59
+ # @param [String] cursor Optional parameter: A pagination cursor returned by
60
+ # a previous call to this endpoint. Provide this cursor to retrieve the
61
+ # next set of results for the original query. If a cursor is not provided,
62
+ # the endpoint returns the first page of the results. For more
63
+ # information, see
64
+ # [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
65
+ # .
66
+ # @param [Integer] limit Optional parameter: A limit on the number of
67
+ # results to return per page. The limit is advisory and the implementation
68
+ # might return more or less results. If the supplied limit is negative,
69
+ # zero, or greater than the maximum limit of 1000, it is ignored. Default
70
+ # value: `100`
71
+ # @return [ListPaymentLinksResponse Hash] response from the API call
72
+ def list_payment_links(cursor: nil,
73
+ limit: nil)
74
+ # Prepare query url.
75
+ _query_builder = config.get_base_uri
76
+ _query_builder << '/v2/online-checkout/payment-links'
77
+ _query_builder = APIHelper.append_url_with_query_parameters(
78
+ _query_builder,
79
+ 'cursor' => cursor,
80
+ 'limit' => limit
81
+ )
82
+ _query_url = APIHelper.clean_url _query_builder
83
+
84
+ # Prepare headers.
85
+ _headers = {
86
+ 'accept' => 'application/json'
87
+ }
88
+
89
+ # Prepare and execute HttpRequest.
90
+ _request = config.http_client.get(
91
+ _query_url,
92
+ headers: _headers
93
+ )
94
+ OAuth2.apply(config, _request)
95
+ _response = execute_request(_request)
96
+
97
+ # Return appropriate response type.
98
+ decoded = APIHelper.json_deserialize(_response.raw_body)
99
+ _errors = APIHelper.map_response(decoded, ['errors'])
100
+ ApiResponse.new(
101
+ _response, data: decoded, errors: _errors
102
+ )
103
+ end
104
+
105
+ # Creates a Square-hosted checkout page. Applications can share the
106
+ # resulting payment link with their buyer to pay for goods and services.
107
+ # @param [CreatePaymentLinkRequest] body Required parameter: An object
108
+ # containing the fields to POST for the request. See the corresponding
109
+ # object definition for field details.
110
+ # @return [CreatePaymentLinkResponse Hash] response from the API call
111
+ def create_payment_link(body:)
112
+ # Prepare query url.
113
+ _query_builder = config.get_base_uri
114
+ _query_builder << '/v2/online-checkout/payment-links'
115
+ _query_url = APIHelper.clean_url _query_builder
116
+
117
+ # Prepare headers.
118
+ _headers = {
119
+ 'accept' => 'application/json',
120
+ 'Content-Type' => 'application/json'
121
+ }
122
+
123
+ # Prepare and execute HttpRequest.
124
+ _request = config.http_client.post(
125
+ _query_url,
126
+ headers: _headers,
127
+ parameters: body.to_json
128
+ )
129
+ OAuth2.apply(config, _request)
130
+ _response = execute_request(_request)
131
+
132
+ # Return appropriate response type.
133
+ decoded = APIHelper.json_deserialize(_response.raw_body)
134
+ _errors = APIHelper.map_response(decoded, ['errors'])
135
+ ApiResponse.new(
136
+ _response, data: decoded, errors: _errors
137
+ )
138
+ end
139
+
140
+ # Deletes a payment link.
141
+ # @param [String] id Required parameter: The ID of the payment link to
142
+ # delete.
143
+ # @return [DeletePaymentLinkResponse Hash] response from the API call
144
+ def delete_payment_link(id:)
145
+ # Prepare query url.
146
+ _query_builder = config.get_base_uri
147
+ _query_builder << '/v2/online-checkout/payment-links/{id}'
148
+ _query_builder = APIHelper.append_url_with_template_parameters(
149
+ _query_builder,
150
+ 'id' => { 'value' => id, 'encode' => true }
151
+ )
152
+ _query_url = APIHelper.clean_url _query_builder
153
+
154
+ # Prepare headers.
155
+ _headers = {
156
+ 'accept' => 'application/json'
157
+ }
158
+
159
+ # Prepare and execute HttpRequest.
160
+ _request = config.http_client.delete(
161
+ _query_url,
162
+ headers: _headers
163
+ )
164
+ OAuth2.apply(config, _request)
165
+ _response = execute_request(_request)
166
+
167
+ # Return appropriate response type.
168
+ decoded = APIHelper.json_deserialize(_response.raw_body)
169
+ _errors = APIHelper.map_response(decoded, ['errors'])
170
+ ApiResponse.new(
171
+ _response, data: decoded, errors: _errors
172
+ )
173
+ end
174
+
175
+ # Retrieves a payment link.
176
+ # @param [String] id Required parameter: The ID of link to retrieve.
177
+ # @return [RetrievePaymentLinkResponse Hash] response from the API call
178
+ def retrieve_payment_link(id:)
179
+ # Prepare query url.
180
+ _query_builder = config.get_base_uri
181
+ _query_builder << '/v2/online-checkout/payment-links/{id}'
182
+ _query_builder = APIHelper.append_url_with_template_parameters(
183
+ _query_builder,
184
+ 'id' => { 'value' => id, 'encode' => true }
185
+ )
186
+ _query_url = APIHelper.clean_url _query_builder
187
+
188
+ # Prepare headers.
189
+ _headers = {
190
+ 'accept' => 'application/json'
191
+ }
192
+
193
+ # Prepare and execute HttpRequest.
194
+ _request = config.http_client.get(
195
+ _query_url,
196
+ headers: _headers
197
+ )
198
+ OAuth2.apply(config, _request)
199
+ _response = execute_request(_request)
200
+
201
+ # Return appropriate response type.
202
+ decoded = APIHelper.json_deserialize(_response.raw_body)
203
+ _errors = APIHelper.map_response(decoded, ['errors'])
204
+ ApiResponse.new(
205
+ _response, data: decoded, errors: _errors
206
+ )
207
+ end
208
+
209
+ # Updates a payment link. You can update the `payment_link` fields such as
210
+ # `description`, `checkout_options`, and `pre_populated_data`.
211
+ # You cannot update other fields such as the `order_id`, `version`, `URL`,
212
+ # or `timestamp` field.
213
+ # @param [String] id Required parameter: The ID of the payment link to
214
+ # update.
215
+ # @param [UpdatePaymentLinkRequest] body Required parameter: An object
216
+ # containing the fields to POST for the request. See the corresponding
217
+ # object definition for field details.
218
+ # @return [UpdatePaymentLinkResponse Hash] response from the API call
219
+ def update_payment_link(id:,
220
+ body:)
221
+ # Prepare query url.
222
+ _query_builder = config.get_base_uri
223
+ _query_builder << '/v2/online-checkout/payment-links/{id}'
224
+ _query_builder = APIHelper.append_url_with_template_parameters(
225
+ _query_builder,
226
+ 'id' => { 'value' => id, 'encode' => true }
227
+ )
228
+ _query_url = APIHelper.clean_url _query_builder
229
+
230
+ # Prepare headers.
231
+ _headers = {
232
+ 'accept' => 'application/json',
233
+ 'Content-Type' => 'application/json'
234
+ }
235
+
236
+ # Prepare and execute HttpRequest.
237
+ _request = config.http_client.put(
238
+ _query_url,
239
+ headers: _headers,
240
+ parameters: body.to_json
241
+ )
242
+ OAuth2.apply(config, _request)
243
+ _response = execute_request(_request)
244
+
245
+ # Return appropriate response type.
246
+ decoded = APIHelper.json_deserialize(_response.raw_body)
247
+ _errors = APIHelper.map_response(decoded, ['errors'])
248
+ ApiResponse.new(
249
+ _response, data: decoded, errors: _errors
250
+ )
251
+ end
50
252
  end
51
253
  end