square.rb 8.1.0.20210121 → 18.1.0.20220316

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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +59 -213
  4. data/lib/square/api/apple_pay_api.rb +9 -8
  5. data/lib/square/api/bank_accounts_api.rb +5 -5
  6. data/lib/square/api/base_api.rb +20 -9
  7. data/lib/square/api/bookings_api.rb +95 -12
  8. data/lib/square/api/cards_api.rb +170 -0
  9. data/lib/square/api/cash_drawers_api.rb +2 -2
  10. data/lib/square/api/catalog_api.rb +140 -66
  11. data/lib/square/api/checkout_api.rb +3 -3
  12. data/lib/square/api/customer_groups_api.rb +17 -8
  13. data/lib/square/api/customer_segments_api.rb +15 -6
  14. data/lib/square/api/customers_api.rb +61 -31
  15. data/lib/square/api/devices_api.rb +3 -2
  16. data/lib/square/api/disputes_api.rb +101 -92
  17. data/lib/square/api/gift_card_activities_api.rb +133 -0
  18. data/lib/square/api/gift_cards_api.rb +297 -0
  19. data/lib/square/api/inventory_api.rb +263 -24
  20. data/lib/square/api/invoices_api.rb +19 -19
  21. data/lib/square/api/labor_api.rb +70 -68
  22. data/lib/square/api/locations_api.rb +22 -14
  23. data/lib/square/api/loyalty_api.rb +86 -32
  24. data/lib/square/api/merchants_api.rb +11 -9
  25. data/lib/square/api/mobile_authorization_api.rb +4 -4
  26. data/lib/square/api/o_auth_api.rb +31 -25
  27. data/lib/square/api/orders_api.rb +78 -39
  28. data/lib/square/api/payments_api.rb +71 -23
  29. data/lib/square/api/refunds_api.rb +18 -7
  30. data/lib/square/api/sites_api.rb +43 -0
  31. data/lib/square/api/snippets_api.rb +146 -0
  32. data/lib/square/api/subscriptions_api.rb +190 -12
  33. data/lib/square/api/team_api.rb +46 -46
  34. data/lib/square/api/terminal_api.rb +19 -18
  35. data/lib/square/api/transactions_api.rb +15 -191
  36. data/lib/square/api/v1_transactions_api.rb +13 -85
  37. data/lib/square/api/vendors_api.rb +257 -0
  38. data/lib/square/api_helper.rb +45 -57
  39. data/lib/square/client.rb +54 -18
  40. data/lib/square/configuration.rb +59 -20
  41. data/lib/square/http/api_response.rb +1 -1
  42. data/lib/square/http/faraday_client.rb +24 -4
  43. data/lib/square/utilities/date_time_helper.rb +151 -0
  44. data/lib/square/utilities/file_wrapper.rb +1 -2
  45. data/lib/square.rb +49 -44
  46. data/test/api/test_locations_api.rb +2 -5
  47. data/test/test_helper.rb +1 -1
  48. metadata +11 -6
  49. data/lib/square/api/v1_employees_api.rb +0 -749
  50. data/lib/square/api/v1_items_api.rb +0 -1766
@@ -0,0 +1,170 @@
1
+ module Square
2
+ # CardsApi
3
+ class CardsApi < BaseApi
4
+ def initialize(config, http_call_back: nil)
5
+ super(config, http_call_back: http_call_back)
6
+ end
7
+
8
+ # Retrieves a list of cards owned by the account making the request.
9
+ # A max of 25 cards will be returned.
10
+ # @param [String] cursor Optional parameter: A pagination cursor returned by
11
+ # a previous call to this endpoint. Provide this to retrieve the next set of
12
+ # results for your original query. See
13
+ # [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
14
+ # for more information.
15
+ # @param [String] customer_id Optional parameter: Limit results to cards
16
+ # associated with the customer supplied. By default, all cards owned by the
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.
20
+ # @param [String] reference_id Optional parameter: Limit results to cards
21
+ # associated with the reference_id supplied.
22
+ # @param [SortOrder] sort_order Optional parameter: Sorts the returned list
23
+ # by when the card was created with the specified order. This field defaults
24
+ # to ASC.
25
+ # @return [ListCardsResponse Hash] response from the API call
26
+ def list_cards(cursor: nil,
27
+ customer_id: nil,
28
+ include_disabled: false,
29
+ reference_id: nil,
30
+ sort_order: nil)
31
+ # Prepare query url.
32
+ _query_builder = config.get_base_uri
33
+ _query_builder << '/v2/cards'
34
+ _query_builder = APIHelper.append_url_with_query_parameters(
35
+ _query_builder,
36
+ 'cursor' => cursor,
37
+ 'customer_id' => customer_id,
38
+ 'include_disabled' => include_disabled,
39
+ 'reference_id' => reference_id,
40
+ 'sort_order' => sort_order
41
+ )
42
+ _query_url = APIHelper.clean_url _query_builder
43
+
44
+ # Prepare headers.
45
+ _headers = {
46
+ 'accept' => 'application/json'
47
+ }
48
+
49
+ # Prepare and execute HttpRequest.
50
+ _request = config.http_client.get(
51
+ _query_url,
52
+ headers: _headers
53
+ )
54
+ OAuth2.apply(config, _request)
55
+ _response = execute_request(_request)
56
+
57
+ # Return appropriate response type.
58
+ decoded = APIHelper.json_deserialize(_response.raw_body)
59
+ _errors = APIHelper.map_response(decoded, ['errors'])
60
+ ApiResponse.new(
61
+ _response, data: decoded, errors: _errors
62
+ )
63
+ end
64
+
65
+ # Adds a card on file to an existing merchant.
66
+ # @param [CreateCardRequest] body Required parameter: An object containing
67
+ # the fields to POST for the request. See the corresponding object
68
+ # definition for field details.
69
+ # @return [CreateCardResponse Hash] response from the API call
70
+ def create_card(body:)
71
+ # Prepare query url.
72
+ _query_builder = config.get_base_uri
73
+ _query_builder << '/v2/cards'
74
+ _query_url = APIHelper.clean_url _query_builder
75
+
76
+ # Prepare headers.
77
+ _headers = {
78
+ 'accept' => 'application/json',
79
+ 'Content-Type' => 'application/json'
80
+ }
81
+
82
+ # Prepare and execute HttpRequest.
83
+ _request = config.http_client.post(
84
+ _query_url,
85
+ headers: _headers,
86
+ parameters: body.to_json
87
+ )
88
+ OAuth2.apply(config, _request)
89
+ _response = execute_request(_request)
90
+
91
+ # Return appropriate response type.
92
+ decoded = APIHelper.json_deserialize(_response.raw_body)
93
+ _errors = APIHelper.map_response(decoded, ['errors'])
94
+ ApiResponse.new(
95
+ _response, data: decoded, errors: _errors
96
+ )
97
+ end
98
+
99
+ # Retrieves details for a specific Card.
100
+ # @param [String] card_id Required parameter: Unique ID for the desired
101
+ # Card.
102
+ # @return [RetrieveCardResponse Hash] response from the API call
103
+ def retrieve_card(card_id:)
104
+ # Prepare query url.
105
+ _query_builder = config.get_base_uri
106
+ _query_builder << '/v2/cards/{card_id}'
107
+ _query_builder = APIHelper.append_url_with_template_parameters(
108
+ _query_builder,
109
+ 'card_id' => { 'value' => card_id, 'encode' => true }
110
+ )
111
+ _query_url = APIHelper.clean_url _query_builder
112
+
113
+ # Prepare headers.
114
+ _headers = {
115
+ 'accept' => 'application/json'
116
+ }
117
+
118
+ # Prepare and execute HttpRequest.
119
+ _request = config.http_client.get(
120
+ _query_url,
121
+ headers: _headers
122
+ )
123
+ OAuth2.apply(config, _request)
124
+ _response = execute_request(_request)
125
+
126
+ # Return appropriate response type.
127
+ decoded = APIHelper.json_deserialize(_response.raw_body)
128
+ _errors = APIHelper.map_response(decoded, ['errors'])
129
+ ApiResponse.new(
130
+ _response, data: decoded, errors: _errors
131
+ )
132
+ end
133
+
134
+ # Disables the card, preventing any further updates or charges.
135
+ # Disabling an already disabled card is allowed but has no effect.
136
+ # @param [String] card_id Required parameter: Unique ID for the desired
137
+ # Card.
138
+ # @return [DisableCardResponse Hash] response from the API call
139
+ def disable_card(card_id:)
140
+ # Prepare query url.
141
+ _query_builder = config.get_base_uri
142
+ _query_builder << '/v2/cards/{card_id}/disable'
143
+ _query_builder = APIHelper.append_url_with_template_parameters(
144
+ _query_builder,
145
+ 'card_id' => { 'value' => card_id, 'encode' => true }
146
+ )
147
+ _query_url = APIHelper.clean_url _query_builder
148
+
149
+ # Prepare headers.
150
+ _headers = {
151
+ 'accept' => 'application/json'
152
+ }
153
+
154
+ # Prepare and execute HttpRequest.
155
+ _request = config.http_client.post(
156
+ _query_url,
157
+ headers: _headers
158
+ )
159
+ OAuth2.apply(config, _request)
160
+ _response = execute_request(_request)
161
+
162
+ # Return appropriate response type.
163
+ decoded = APIHelper.json_deserialize(_response.raw_body)
164
+ _errors = APIHelper.map_response(decoded, ['errors'])
165
+ ApiResponse.new(
166
+ _response, data: decoded, errors: _errors
167
+ )
168
+ end
169
+ end
170
+ end
@@ -63,8 +63,8 @@ module Square
63
63
  end
64
64
 
65
65
  # Provides the summary details for a single cash drawer shift. See
66
- # [ListCashDrawerShiftEvents](#endpoint-CashDrawers-ListCashDrawerShiftEvent
67
- # s) for a list of cash drawer shift events.
66
+ # [ListCashDrawerShiftEvents]($e/CashDrawers/ListCashDrawerShiftEvents) for
67
+ # a list of cash drawer shift events.
68
68
  # @param [String] location_id Required parameter: The ID of the location to
69
69
  # retrieve cash drawer shifts from.
70
70
  # @param [String] shift_id Required parameter: The shift ID.
@@ -5,12 +5,12 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Deletes a set of [CatalogItem](#type-catalogitem)s based on the
8
+ # Deletes a set of [CatalogItem]($m/CatalogItem)s based on the
9
9
  # provided list of target IDs and returns a set of successfully deleted IDs
10
10
  # in
11
11
  # the response. Deletion is a cascading event such that all children of the
12
12
  # targeted object are also deleted. For example, deleting a CatalogItem will
13
- # also delete all of its [CatalogItemVariation](#type-catalogitemvariation)
13
+ # also delete all of its [CatalogItemVariation]($m/CatalogItemVariation)
14
14
  # children.
15
15
  # `BatchDeleteCatalogObjects` succeeds even if only a portion of the
16
16
  # targeted
@@ -29,7 +29,7 @@ module Square
29
29
  # Prepare headers.
30
30
  _headers = {
31
31
  'accept' => 'application/json',
32
- 'content-type' => 'application/json; charset=utf-8'
32
+ 'Content-Type' => 'application/json'
33
33
  }
34
34
 
35
35
  # Prepare and execute HttpRequest.
@@ -50,13 +50,11 @@ module Square
50
50
  end
51
51
 
52
52
  # Returns a set of objects based on the provided ID.
53
- # Each [CatalogItem](#type-catalogitem) returned in the set includes all of
54
- # its
53
+ # Each [CatalogItem]($m/CatalogItem) returned in the set includes all of its
55
54
  # child information including: all of its
56
- # [CatalogItemVariation](#type-catalogitemvariation) objects, references to
57
- # its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids
58
- # of
59
- # any [CatalogTax](#type-catalogtax) objects that apply to it.
55
+ # [CatalogItemVariation]($m/CatalogItemVariation) objects, references to
56
+ # its [CatalogModifierList]($m/CatalogModifierList) objects, and the ids of
57
+ # any [CatalogTax]($m/CatalogTax) objects that apply to it.
60
58
  # @param [BatchRetrieveCatalogObjectsRequest] body Required parameter: An
61
59
  # object containing the fields to POST for the request. See the
62
60
  # corresponding object definition for field details.
@@ -70,7 +68,7 @@ module Square
70
68
  # Prepare headers.
71
69
  _headers = {
72
70
  'accept' => 'application/json',
73
- 'content-type' => 'application/json; charset=utf-8'
71
+ 'Content-Type' => 'application/json'
74
72
  }
75
73
 
76
74
  # Prepare and execute HttpRequest.
@@ -117,7 +115,7 @@ module Square
117
115
  # Prepare headers.
118
116
  _headers = {
119
117
  'accept' => 'application/json',
120
- 'content-type' => 'application/json; charset=utf-8'
118
+ 'Content-Type' => 'application/json'
121
119
  }
122
120
 
123
121
  # Prepare and execute HttpRequest.
@@ -138,10 +136,10 @@ module Square
138
136
  end
139
137
 
140
138
  # Uploads an image file to be represented by a
141
- # [CatalogImage](#type-catalogimage) object linked to an existing
142
- # [CatalogObject](#type-catalogobject) instance. A call to this endpoint can
143
- # upload an image, link an image to
144
- # a catalog object, or do both.
139
+ # [CatalogImage]($m/CatalogImage) object that can be linked to an existing
140
+ # [CatalogObject]($m/CatalogObject) instance. The resulting `CatalogImage`
141
+ # is unattached to any `CatalogObject` if the `object_id`
142
+ # is not specified.
145
143
  # This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data
146
144
  # requests with a JSON part and an image file part in
147
145
  # JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
@@ -198,6 +196,71 @@ module Square
198
196
  )
199
197
  end
200
198
 
199
+ # Uploads a new image file to replace the existing one in the specified
200
+ # [CatalogImage]($m/CatalogImage) object.
201
+ # This `UpdateCatalogImage` endpoint accepts HTTP multipart/form-data
202
+ # requests with a JSON part and an image file part in
203
+ # JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
204
+ # @param [String] image_id Required parameter: The ID of the `CatalogImage`
205
+ # object to update the encapsulated image file.
206
+ # @param [UpdateCatalogImageRequest] request Optional parameter: Example:
207
+ # @param [File | UploadIO] image_file Optional parameter: Example:
208
+ # @return [UpdateCatalogImageResponse Hash] response from the API call
209
+ def update_catalog_image(image_id:,
210
+ request: nil,
211
+ image_file: nil)
212
+ # Prepare query url.
213
+ _query_builder = config.get_base_uri
214
+ _query_builder << '/v2/catalog/images/{image_id}'
215
+ _query_builder = APIHelper.append_url_with_template_parameters(
216
+ _query_builder,
217
+ 'image_id' => { 'value' => image_id, 'encode' => true }
218
+ )
219
+ _query_url = APIHelper.clean_url _query_builder
220
+
221
+ if image_file.is_a? FileWrapper
222
+ image_file_wrapper = image_file.file
223
+ image_file_content_type = image_file.content_type
224
+ else
225
+ image_file_wrapper = image_file
226
+ image_file_content_type = 'image/jpeg'
227
+ end
228
+
229
+ # Prepare headers.
230
+ _headers = {
231
+ 'accept' => 'application/json'
232
+ }
233
+
234
+ # Prepare form parameters.
235
+ _parameters = {
236
+ 'request' => Faraday::UploadIO.new(
237
+ StringIO.new(request.to_json),
238
+ 'application/json'
239
+ ),
240
+ 'image_file' => Faraday::UploadIO.new(
241
+ image_file_wrapper,
242
+ image_file_content_type
243
+ )
244
+ }
245
+ _parameters = APIHelper.form_encode_parameters(_parameters)
246
+
247
+ # Prepare and execute HttpRequest.
248
+ _request = config.http_client.put(
249
+ _query_url,
250
+ headers: _headers,
251
+ parameters: _parameters
252
+ )
253
+ OAuth2.apply(config, _request)
254
+ _response = execute_request(_request)
255
+
256
+ # Return appropriate response type.
257
+ decoded = APIHelper.json_deserialize(_response.raw_body)
258
+ _errors = APIHelper.map_response(decoded, ['errors'])
259
+ ApiResponse.new(
260
+ _response, data: decoded, errors: _errors
261
+ )
262
+ end
263
+
201
264
  # Retrieves information about the Square Catalog API, such as batch size
202
265
  # limits that can be used by the `BatchUpsertCatalogObjects` endpoint.
203
266
  # @return [CatalogInfoResponse Hash] response from the API call
@@ -228,34 +291,40 @@ module Square
228
291
  )
229
292
  end
230
293
 
231
- # Returns a list of [CatalogObject](#type-catalogobject)s that includes
232
- # all objects of a set of desired types (for example, all
233
- # [CatalogItem](#type-catalogitem)
234
- # and [CatalogTax](#type-catalogtax) objects) in the catalog. The `types`
235
- # parameter
236
- # is specified as a comma-separated list of valid
237
- # [CatalogObject](#type-catalogobject) types:
238
- # `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`,
239
- # `DISCOUNT`, `TAX`, `IMAGE`.
294
+ # Returns a list of all [CatalogObject]($m/CatalogObject)s of the specified
295
+ # types in the catalog.
296
+ # The `types` parameter is specified as a comma-separated list of the
297
+ # [CatalogObjectType]($m/CatalogObjectType) values,
298
+ # for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`,
299
+ # `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`".
240
300
  # __Important:__ ListCatalog does not return deleted catalog items. To
241
301
  # retrieve
242
302
  # deleted catalog items, use
243
- # [SearchCatalogObjects](#endpoint-Catalog-SearchCatalogObjects)
303
+ # [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects)
244
304
  # and set the `include_deleted_objects` attribute value to `true`.
245
305
  # @param [String] cursor Optional parameter: The pagination cursor returned
246
- # in the previous response. Leave unset for an initial request. See
306
+ # in the previous response. Leave unset for an initial request. The page
307
+ # size is currently set to be 100. See
247
308
  # [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
248
309
  # for more information.
249
310
  # @param [String] types Optional parameter: An optional case-insensitive,
250
- # comma-separated list of object types to retrieve, for example
251
- # `ITEM,ITEM_VARIATION,CATEGORY,IMAGE`. The legal values are taken from the
252
- # CatalogObjectType enum: `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`,
253
- # `TAX`, `MODIFIER`, `MODIFIER_LIST`, or `IMAGE`.
311
+ # comma-separated list of object types to retrieve. The valid values are
312
+ # defined in the [CatalogObjectType]($m/CatalogObjectType) enum, for
313
+ # example, `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`,
314
+ # `MODIFIER`, `MODIFIER_LIST`, `IMAGE`, etc. If this is unspecified, the
315
+ # operation returns objects of all the top level types at the version of the
316
+ # Square API used to make the request. Object types that are nested onto
317
+ # other object types are not included in the defaults. At the current API
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.
254
322
  # @param [Long] catalog_version Optional parameter: The specific version of
255
323
  # the catalog objects to be included in the response. This allows you to
256
324
  # retrieve historical versions of objects. The specified version value is
257
- # matched against the [CatalogObject](#type-catalogobject)s' `version`
258
- # attribute.
325
+ # matched against the [CatalogObject]($m/CatalogObject)s' `version`
326
+ # attribute. If not included, results will be from the current version of
327
+ # the catalog.
259
328
  # @return [ListCatalogResponse Hash] response from the API call
260
329
  def list_catalog(cursor: nil,
261
330
  types: nil,
@@ -292,7 +361,7 @@ module Square
292
361
  )
293
362
  end
294
363
 
295
- # Creates or updates the target [CatalogObject](#type-catalogobject).
364
+ # Creates or updates the target [CatalogObject]($m/CatalogObject).
296
365
  # @param [UpsertCatalogObjectRequest] body Required parameter: An object
297
366
  # containing the fields to POST for the request. See the corresponding
298
367
  # object definition for field details.
@@ -306,7 +375,7 @@ module Square
306
375
  # Prepare headers.
307
376
  _headers = {
308
377
  'accept' => 'application/json',
309
- 'content-type' => 'application/json; charset=utf-8'
378
+ 'Content-Type' => 'application/json'
310
379
  }
311
380
 
312
381
  # Prepare and execute HttpRequest.
@@ -326,14 +395,14 @@ module Square
326
395
  )
327
396
  end
328
397
 
329
- # Deletes a single [CatalogObject](#type-catalogobject) based on the
398
+ # Deletes a single [CatalogObject]($m/CatalogObject) based on the
330
399
  # provided ID and returns the set of successfully deleted IDs in the
331
400
  # response.
332
401
  # Deletion is a cascading event such that all children of the targeted
333
402
  # object
334
- # are also deleted. For example, deleting a [CatalogItem](#type-catalogitem)
403
+ # are also deleted. For example, deleting a [CatalogItem]($m/CatalogItem)
335
404
  # will also delete all of its
336
- # [CatalogItemVariation](#type-catalogitemvariation) children.
405
+ # [CatalogItemVariation]($m/CatalogItemVariation) children.
337
406
  # @param [String] object_id Required parameter: The ID of the catalog object
338
407
  # to be deleted. When an object is deleted, other objects in the graph that
339
408
  # depend on that object will be deleted as well (for example, deleting a
@@ -370,30 +439,35 @@ module Square
370
439
  )
371
440
  end
372
441
 
373
- # Returns a single [CatalogItem](#type-catalogitem) as a
374
- # [CatalogObject](#type-catalogobject) based on the provided ID. The
375
- # returned
376
- # object includes all of the relevant [CatalogItem](#type-catalogitem)
377
- # information including: [CatalogItemVariation](#type-catalogitemvariation)
442
+ # Returns a single [CatalogItem]($m/CatalogItem) as a
443
+ # [CatalogObject]($m/CatalogObject) based on the provided ID. The returned
444
+ # object includes all of the relevant [CatalogItem]($m/CatalogItem)
445
+ # information including: [CatalogItemVariation]($m/CatalogItemVariation)
378
446
  # children, references to its
379
- # [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of
380
- # any [CatalogTax](#type-catalogtax) objects that apply to it.
447
+ # [CatalogModifierList]($m/CatalogModifierList) objects, and the ids of
448
+ # any [CatalogTax]($m/CatalogTax) objects that apply to it.
381
449
  # @param [String] object_id Required parameter: The object ID of any type of
382
450
  # catalog objects to be retrieved.
383
451
  # @param [Boolean] include_related_objects Optional parameter: If `true`,
384
452
  # the response will include additional objects that are related to the
385
- # requested object, as follows: If the `object` field of the response
386
- # contains a `CatalogItem`, its associated `CatalogCategory`, `CatalogTax`,
387
- # `CatalogImage` and `CatalogModifierList` objects will be returned in the
388
- # `related_objects` field of the response. If the `object` field of the
389
- # response contains a `CatalogItemVariation`, its parent `CatalogItem` will
390
- # be returned in the `related_objects` field of the response. Default
391
- # value: `false`
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`
392
465
  # @param [Long] catalog_version Optional parameter: Requests objects as of a
393
466
  # specific version of the catalog. This allows you to retrieve historical
394
467
  # versions of objects. The value to retrieve a specific version of an object
395
- # can be found in the version field of
396
- # [CatalogObject](#type-catalogobject)s.
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.
397
471
  # @return [RetrieveCatalogObjectResponse Hash] response from the API call
398
472
  def retrieve_catalog_object(object_id:,
399
473
  include_related_objects: false,
@@ -433,12 +507,12 @@ module Square
433
507
  )
434
508
  end
435
509
 
436
- # Searches for [CatalogObject](#type-CatalogObject) of any type by matching
510
+ # Searches for [CatalogObject]($m/CatalogObject) of any type by matching
437
511
  # supported search attribute values,
438
512
  # excluding custom attribute values on items or item variations, against one
439
- # or more of the specified query expressions.
513
+ # or more of the specified query filters.
440
514
  # This (`SearchCatalogObjects`) endpoint differs from the
441
- # [SearchCatalogItems](#endpoint-Catalog-SearchCatalogItems)
515
+ # [SearchCatalogItems]($e/Catalog/SearchCatalogItems)
442
516
  # endpoint in the following aspects:
443
517
  # - `SearchCatalogItems` can only search for items or item variations,
444
518
  # whereas `SearchCatalogObjects` can search for any type of catalog objects.
@@ -463,7 +537,7 @@ module Square
463
537
  # Prepare headers.
464
538
  _headers = {
465
539
  'accept' => 'application/json',
466
- 'content-type' => 'application/json; charset=utf-8'
540
+ 'Content-Type' => 'application/json'
467
541
  }
468
542
 
469
543
  # Prepare and execute HttpRequest.
@@ -486,9 +560,9 @@ module Square
486
560
  # Searches for catalog items or item variations by matching supported search
487
561
  # attribute values, including
488
562
  # custom attribute values, against one or more of the specified query
489
- # expressions.
563
+ # filters.
490
564
  # This (`SearchCatalogItems`) endpoint differs from the
491
- # [SearchCatalogObjects](#endpoint-Catalog-SearchCatalogObjects)
565
+ # [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects)
492
566
  # endpoint in the following aspects:
493
567
  # - `SearchCatalogItems` can only search for items or item variations,
494
568
  # whereas `SearchCatalogObjects` can search for any type of catalog objects.
@@ -513,7 +587,7 @@ module Square
513
587
  # Prepare headers.
514
588
  _headers = {
515
589
  'accept' => 'application/json',
516
- 'content-type' => 'application/json; charset=utf-8'
590
+ 'Content-Type' => 'application/json'
517
591
  }
518
592
 
519
593
  # Prepare and execute HttpRequest.
@@ -533,8 +607,8 @@ module Square
533
607
  )
534
608
  end
535
609
 
536
- # Updates the [CatalogModifierList](#type-catalogmodifierlist) objects
537
- # that apply to the targeted [CatalogItem](#type-catalogitem) without having
610
+ # Updates the [CatalogModifierList]($m/CatalogModifierList) objects
611
+ # that apply to the targeted [CatalogItem]($m/CatalogItem) without having
538
612
  # to perform an upsert on the entire item.
539
613
  # @param [UpdateItemModifierListsRequest] body Required parameter: An object
540
614
  # containing the fields to POST for the request. See the corresponding
@@ -549,7 +623,7 @@ module Square
549
623
  # Prepare headers.
550
624
  _headers = {
551
625
  'accept' => 'application/json',
552
- 'content-type' => 'application/json; charset=utf-8'
626
+ 'Content-Type' => 'application/json'
553
627
  }
554
628
 
555
629
  # Prepare and execute HttpRequest.
@@ -569,8 +643,8 @@ module Square
569
643
  )
570
644
  end
571
645
 
572
- # Updates the [CatalogTax](#type-catalogtax) objects that apply to the
573
- # targeted [CatalogItem](#type-catalogitem) without having to perform an
646
+ # Updates the [CatalogTax]($m/CatalogTax) objects that apply to the
647
+ # targeted [CatalogItem]($m/CatalogItem) without having to perform an
574
648
  # upsert on the entire item.
575
649
  # @param [UpdateItemTaxesRequest] body Required parameter: An object
576
650
  # containing the fields to POST for the request. See the corresponding
@@ -585,7 +659,7 @@ module Square
585
659
  # Prepare headers.
586
660
  _headers = {
587
661
  'accept' => 'application/json',
588
- 'content-type' => 'application/json; charset=utf-8'
662
+ 'Content-Type' => 'application/json'
589
663
  }
590
664
 
591
665
  # Prepare and execute HttpRequest.
@@ -5,8 +5,8 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Links a `checkoutId` to a `checkout_page_url` that customers will
9
- # be directed to in order to provide their payment information using a
8
+ # Links a `checkoutId` to a `checkout_page_url` that customers are
9
+ # directed to in order to provide their payment information using a
10
10
  # payment processing workflow hosted on connect.squareup.com.
11
11
  # @param [String] location_id Required parameter: The ID of the business
12
12
  # location to associate the checkout with.
@@ -28,7 +28,7 @@ module Square
28
28
  # Prepare headers.
29
29
  _headers = {
30
30
  'accept' => 'application/json',
31
- 'content-type' => 'application/json; charset=utf-8'
31
+ 'Content-Type' => 'application/json'
32
32
  }
33
33
 
34
34
  # Prepare and execute HttpRequest.
@@ -7,18 +7,27 @@ module Square
7
7
 
8
8
  # Retrieves the list of customer groups of a business.
9
9
  # @param [String] cursor Optional parameter: A pagination cursor returned by
10
- # a previous call to this endpoint. Provide this to retrieve the next set of
11
- # results for your original query. See the [Pagination
12
- # guide](https://developer.squareup.com/docs/working-with-apis/pagination)
13
- # for more information.
10
+ # a previous call to this endpoint. Provide this cursor to retrieve the next
11
+ # set of results for your original query. For more information, see
12
+ # [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
13
+ # atterns/pagination).
14
+ # @param [Integer] limit Optional parameter: The maximum number of results
15
+ # to return in a single page. This limit is advisory. The response might
16
+ # contain more or fewer results. If the limit is less than 1 or greater than
17
+ # 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error.
18
+ # The default value is 50. For more information, see
19
+ # [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
20
+ # atterns/pagination).
14
21
  # @return [ListCustomerGroupsResponse Hash] response from the API call
15
- def list_customer_groups(cursor: nil)
22
+ def list_customer_groups(cursor: nil,
23
+ limit: nil)
16
24
  # Prepare query url.
17
25
  _query_builder = config.get_base_uri
18
26
  _query_builder << '/v2/customers/groups'
19
27
  _query_builder = APIHelper.append_url_with_query_parameters(
20
28
  _query_builder,
21
- 'cursor' => cursor
29
+ 'cursor' => cursor,
30
+ 'limit' => limit
22
31
  )
23
32
  _query_url = APIHelper.clean_url _query_builder
24
33
 
@@ -58,7 +67,7 @@ module Square
58
67
  # Prepare headers.
59
68
  _headers = {
60
69
  'accept' => 'application/json',
61
- 'content-type' => 'application/json; charset=utf-8'
70
+ 'Content-Type' => 'application/json'
62
71
  }
63
72
 
64
73
  # Prepare and execute HttpRequest.
@@ -169,7 +178,7 @@ module Square
169
178
  # Prepare headers.
170
179
  _headers = {
171
180
  'accept' => 'application/json',
172
- 'content-type' => 'application/json; charset=utf-8'
181
+ 'Content-Type' => 'application/json'
173
182
  }
174
183
 
175
184
  # Prepare and execute HttpRequest.
@@ -7,18 +7,27 @@ module Square
7
7
 
8
8
  # Retrieves the list of customer segments of a business.
9
9
  # @param [String] cursor Optional parameter: A pagination cursor returned by
10
- # previous calls to __ListCustomerSegments__. Used to retrieve the next set
11
- # of query results. See the [Pagination
12
- # guide](https://developer.squareup.com/docs/working-with-apis/pagination)
13
- # for more information.
10
+ # previous calls to `ListCustomerSegments`. This cursor is used to retrieve
11
+ # the next set of query results. For more information, see
12
+ # [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
13
+ # atterns/pagination).
14
+ # @param [Integer] limit Optional parameter: The maximum number of results
15
+ # to return in a single page. This limit is advisory. The response might
16
+ # contain more or fewer results. If the specified limit is less than 1 or
17
+ # greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400
18
+ # VALUE_TOO_HIGH` error. The default value is 50. For more information, see
19
+ # [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
20
+ # atterns/pagination).
14
21
  # @return [ListCustomerSegmentsResponse Hash] response from the API call
15
- def list_customer_segments(cursor: nil)
22
+ def list_customer_segments(cursor: nil,
23
+ limit: nil)
16
24
  # Prepare query url.
17
25
  _query_builder = config.get_base_uri
18
26
  _query_builder << '/v2/customers/segments'
19
27
  _query_builder = APIHelper.append_url_with_query_parameters(
20
28
  _query_builder,
21
- 'cursor' => cursor
29
+ 'cursor' => cursor,
30
+ 'limit' => limit
22
31
  )
23
32
  _query_url = APIHelper.clean_url _query_builder
24
33