square.rb 6.3.0.20200826 → 17.1.0.20220120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +86 -51
- data/lib/square/api/apple_pay_api.rb +12 -9
- data/lib/square/api/bank_accounts_api.rb +21 -24
- data/lib/square/api/base_api.rb +20 -9
- data/lib/square/api/bookings_api.rb +391 -0
- data/lib/square/api/cards_api.rb +170 -0
- data/lib/square/api/cash_drawers_api.rb +13 -6
- data/lib/square/api/catalog_api.rb +195 -85
- data/lib/square/api/checkout_api.rb +7 -5
- data/lib/square/api/customer_groups_api.rb +34 -16
- data/lib/square/api/customer_segments_api.rb +21 -9
- data/lib/square/api/customers_api.rb +102 -55
- data/lib/square/api/devices_api.rb +20 -8
- data/lib/square/api/disputes_api.rb +156 -144
- data/lib/square/api/employees_api.rb +7 -3
- data/lib/square/api/gift_card_activities_api.rb +133 -0
- data/lib/square/api/gift_cards_api.rb +297 -0
- data/lib/square/api/inventory_api.rb +290 -37
- data/lib/square/api/invoices_api.rb +61 -57
- data/lib/square/api/labor_api.rb +127 -93
- data/lib/square/api/locations_api.rb +36 -25
- data/lib/square/api/loyalty_api.rb +134 -87
- data/lib/square/api/merchants_api.rb +8 -4
- data/lib/square/api/mobile_authorization_api.rb +9 -7
- data/lib/square/api/o_auth_api.rb +41 -32
- data/lib/square/api/orders_api.rb +132 -54
- data/lib/square/api/payments_api.rb +133 -75
- data/lib/square/api/refunds_api.rb +51 -30
- data/lib/square/api/sites_api.rb +43 -0
- data/lib/square/api/snippets_api.rb +146 -0
- data/lib/square/api/subscriptions_api.rb +216 -26
- data/lib/square/api/team_api.rb +81 -65
- data/lib/square/api/terminal_api.rb +166 -16
- data/lib/square/api/transactions_api.rb +32 -194
- data/lib/square/api/v1_transactions_api.rb +53 -103
- data/lib/square/api_helper.rb +38 -43
- data/lib/square/client.rb +54 -24
- data/lib/square/configuration.rb +61 -21
- data/lib/square/http/api_response.rb +3 -1
- data/lib/square/http/faraday_client.rb +34 -5
- data/lib/square/utilities/date_time_helper.rb +151 -0
- data/lib/square/utilities/file_wrapper.rb +1 -2
- data/lib/square.rb +65 -61
- data/spec/user_journey_spec.rb +2 -5
- data/test/api/api_test_base.rb +1 -6
- data/test/api/test_catalog_api.rb +1 -4
- data/test/api/test_customers_api.rb +1 -4
- data/test/api/test_employees_api.rb +1 -4
- data/test/api/test_labor_api.rb +2 -6
- data/test/api/test_locations_api.rb +21 -35
- data/test/api/test_merchants_api.rb +1 -4
- data/test/api/test_payments_api.rb +3 -6
- data/test/api/test_refunds_api.rb +3 -6
- data/test/http_response_catcher.rb +0 -5
- data/test/test_helper.rb +1 -6
- metadata +40 -18
- data/lib/square/api/v1_employees_api.rb +0 -723
- data/lib/square/api/v1_items_api.rb +0 -1686
- data/lib/square/api/v1_locations_api.rb +0 -65
@@ -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](
|
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](
|
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
|
-
'
|
32
|
+
'Content-Type' => 'application/json'
|
33
33
|
}
|
34
34
|
|
35
35
|
# Prepare and execute HttpRequest.
|
@@ -44,17 +44,17 @@ module Square
|
|
44
44
|
# Return appropriate response type.
|
45
45
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
46
46
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
47
|
-
ApiResponse.new(
|
47
|
+
ApiResponse.new(
|
48
|
+
_response, data: decoded, errors: _errors
|
49
|
+
)
|
48
50
|
end
|
49
51
|
|
50
52
|
# Returns a set of objects based on the provided ID.
|
51
|
-
# Each [CatalogItem](
|
52
|
-
# its
|
53
|
+
# Each [CatalogItem]($m/CatalogItem) returned in the set includes all of its
|
53
54
|
# child information including: all of its
|
54
|
-
# [CatalogItemVariation](
|
55
|
-
# its [CatalogModifierList](
|
56
|
-
#
|
57
|
-
# 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.
|
58
58
|
# @param [BatchRetrieveCatalogObjectsRequest] body Required parameter: An
|
59
59
|
# object containing the fields to POST for the request. See the
|
60
60
|
# corresponding object definition for field details.
|
@@ -68,7 +68,7 @@ module Square
|
|
68
68
|
# Prepare headers.
|
69
69
|
_headers = {
|
70
70
|
'accept' => 'application/json',
|
71
|
-
'
|
71
|
+
'Content-Type' => 'application/json'
|
72
72
|
}
|
73
73
|
|
74
74
|
# Prepare and execute HttpRequest.
|
@@ -83,7 +83,9 @@ module Square
|
|
83
83
|
# Return appropriate response type.
|
84
84
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
85
85
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
86
|
-
ApiResponse.new(
|
86
|
+
ApiResponse.new(
|
87
|
+
_response, data: decoded, errors: _errors
|
88
|
+
)
|
87
89
|
end
|
88
90
|
|
89
91
|
# Creates or updates up to 10,000 target objects based on the provided
|
@@ -113,7 +115,7 @@ module Square
|
|
113
115
|
# Prepare headers.
|
114
116
|
_headers = {
|
115
117
|
'accept' => 'application/json',
|
116
|
-
'
|
118
|
+
'Content-Type' => 'application/json'
|
117
119
|
}
|
118
120
|
|
119
121
|
# Prepare and execute HttpRequest.
|
@@ -128,21 +130,19 @@ module Square
|
|
128
130
|
# Return appropriate response type.
|
129
131
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
130
132
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
131
|
-
ApiResponse.new(
|
133
|
+
ApiResponse.new(
|
134
|
+
_response, data: decoded, errors: _errors
|
135
|
+
)
|
132
136
|
end
|
133
137
|
|
134
|
-
# Uploads an image file to be represented by
|
135
|
-
# [CatalogImage](
|
136
|
-
# [CatalogObject](
|
137
|
-
#
|
138
|
-
#
|
138
|
+
# Uploads an image file to be represented by a
|
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.
|
139
143
|
# This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data
|
140
144
|
# requests with a JSON part and an image file part in
|
141
145
|
# JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
|
142
|
-
# Additional information and an example cURL request can be found in the
|
143
|
-
# [Create a Catalog Image
|
144
|
-
# recipe](https://developer.squareup.com/docs/more-apis/catalog/cookbook/cre
|
145
|
-
# ate-catalog-images).
|
146
146
|
# @param [CreateCatalogImageRequest] request Optional parameter: Example:
|
147
147
|
# @param [File | UploadIO] image_file Optional parameter: Example:
|
148
148
|
# @return [CreateCatalogImageResponse Hash] response from the API call
|
@@ -191,7 +191,74 @@ module Square
|
|
191
191
|
# Return appropriate response type.
|
192
192
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
193
193
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
194
|
-
ApiResponse.new(
|
194
|
+
ApiResponse.new(
|
195
|
+
_response, data: decoded, errors: _errors
|
196
|
+
)
|
197
|
+
end
|
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
|
+
)
|
195
262
|
end
|
196
263
|
|
197
264
|
# Retrieves information about the Square Catalog API, such as batch size
|
@@ -219,42 +286,57 @@ module Square
|
|
219
286
|
# Return appropriate response type.
|
220
287
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
221
288
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
222
|
-
ApiResponse.new(
|
289
|
+
ApiResponse.new(
|
290
|
+
_response, data: decoded, errors: _errors
|
291
|
+
)
|
223
292
|
end
|
224
293
|
|
225
|
-
# Returns a list of [CatalogObject](
|
226
|
-
#
|
227
|
-
#
|
228
|
-
#
|
229
|
-
#
|
230
|
-
#
|
231
|
-
# [CatalogObject](#type-catalogobject) types:
|
232
|
-
# `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`,
|
233
|
-
# `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`".
|
234
300
|
# __Important:__ ListCatalog does not return deleted catalog items. To
|
235
301
|
# retrieve
|
236
|
-
# deleted catalog items, use
|
237
|
-
#
|
238
|
-
# to `true`.
|
302
|
+
# deleted catalog items, use
|
303
|
+
# [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects)
|
304
|
+
# and set the `include_deleted_objects` attribute value to `true`.
|
239
305
|
# @param [String] cursor Optional parameter: The pagination cursor returned
|
240
|
-
# in the previous response. Leave unset for an initial request.
|
306
|
+
# in the previous response. Leave unset for an initial request. The page
|
307
|
+
# size is currently set to be 100. See
|
241
308
|
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
242
309
|
# for more information.
|
243
310
|
# @param [String] types Optional parameter: An optional case-insensitive,
|
244
|
-
# comma-separated list of object types to retrieve
|
245
|
-
#
|
246
|
-
#
|
247
|
-
# `
|
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.
|
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
|
324
|
+
# retrieve historical versions of objects. The specified version value is
|
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.
|
248
328
|
# @return [ListCatalogResponse Hash] response from the API call
|
249
329
|
def list_catalog(cursor: nil,
|
250
|
-
types: nil
|
330
|
+
types: nil,
|
331
|
+
catalog_version: nil)
|
251
332
|
# Prepare query url.
|
252
333
|
_query_builder = config.get_base_uri
|
253
334
|
_query_builder << '/v2/catalog/list'
|
254
335
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
255
336
|
_query_builder,
|
256
337
|
'cursor' => cursor,
|
257
|
-
'types' => types
|
338
|
+
'types' => types,
|
339
|
+
'catalog_version' => catalog_version
|
258
340
|
)
|
259
341
|
_query_url = APIHelper.clean_url _query_builder
|
260
342
|
|
@@ -274,10 +356,12 @@ module Square
|
|
274
356
|
# Return appropriate response type.
|
275
357
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
276
358
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
277
|
-
ApiResponse.new(
|
359
|
+
ApiResponse.new(
|
360
|
+
_response, data: decoded, errors: _errors
|
361
|
+
)
|
278
362
|
end
|
279
363
|
|
280
|
-
# Creates or updates the target [CatalogObject](
|
364
|
+
# Creates or updates the target [CatalogObject]($m/CatalogObject).
|
281
365
|
# @param [UpsertCatalogObjectRequest] body Required parameter: An object
|
282
366
|
# containing the fields to POST for the request. See the corresponding
|
283
367
|
# object definition for field details.
|
@@ -291,7 +375,7 @@ module Square
|
|
291
375
|
# Prepare headers.
|
292
376
|
_headers = {
|
293
377
|
'accept' => 'application/json',
|
294
|
-
'
|
378
|
+
'Content-Type' => 'application/json'
|
295
379
|
}
|
296
380
|
|
297
381
|
# Prepare and execute HttpRequest.
|
@@ -306,17 +390,19 @@ module Square
|
|
306
390
|
# Return appropriate response type.
|
307
391
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
308
392
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
309
|
-
ApiResponse.new(
|
393
|
+
ApiResponse.new(
|
394
|
+
_response, data: decoded, errors: _errors
|
395
|
+
)
|
310
396
|
end
|
311
397
|
|
312
|
-
# Deletes a single [CatalogObject](
|
398
|
+
# Deletes a single [CatalogObject]($m/CatalogObject) based on the
|
313
399
|
# provided ID and returns the set of successfully deleted IDs in the
|
314
400
|
# response.
|
315
401
|
# Deletion is a cascading event such that all children of the targeted
|
316
402
|
# object
|
317
|
-
# are also deleted. For example, deleting a [CatalogItem](
|
403
|
+
# are also deleted. For example, deleting a [CatalogItem]($m/CatalogItem)
|
318
404
|
# will also delete all of its
|
319
|
-
# [CatalogItemVariation](
|
405
|
+
# [CatalogItemVariation]($m/CatalogItemVariation) children.
|
320
406
|
# @param [String] object_id Required parameter: The ID of the catalog object
|
321
407
|
# to be deleted. When an object is deleted, other objects in the graph that
|
322
408
|
# depend on that object will be deleted as well (for example, deleting a
|
@@ -328,7 +414,7 @@ module Square
|
|
328
414
|
_query_builder << '/v2/catalog/object/{object_id}'
|
329
415
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
330
416
|
_query_builder,
|
331
|
-
'object_id' => object_id
|
417
|
+
'object_id' => { 'value' => object_id, 'encode' => true }
|
332
418
|
)
|
333
419
|
_query_url = APIHelper.clean_url _query_builder
|
334
420
|
|
@@ -348,41 +434,55 @@ module Square
|
|
348
434
|
# Return appropriate response type.
|
349
435
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
350
436
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
351
|
-
ApiResponse.new(
|
437
|
+
ApiResponse.new(
|
438
|
+
_response, data: decoded, errors: _errors
|
439
|
+
)
|
352
440
|
end
|
353
441
|
|
354
|
-
# Returns a single [CatalogItem](
|
355
|
-
# [CatalogObject](
|
356
|
-
#
|
357
|
-
#
|
358
|
-
# 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)
|
359
446
|
# children, references to its
|
360
|
-
# [CatalogModifierList](
|
361
|
-
# any [CatalogTax](
|
447
|
+
# [CatalogModifierList]($m/CatalogModifierList) objects, and the ids of
|
448
|
+
# any [CatalogTax]($m/CatalogTax) objects that apply to it.
|
362
449
|
# @param [String] object_id Required parameter: The object ID of any type of
|
363
450
|
# catalog objects to be retrieved.
|
364
451
|
# @param [Boolean] include_related_objects Optional parameter: If `true`,
|
365
452
|
# the response will include additional objects that are related to the
|
366
|
-
# requested
|
367
|
-
#
|
368
|
-
#
|
369
|
-
#
|
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
|
370
462
|
# response contains a CatalogItemVariation, its parent CatalogItem will be
|
371
463
|
# returned in the `related_objects` field of the response. Default value:
|
372
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.
|
373
471
|
# @return [RetrieveCatalogObjectResponse Hash] response from the API call
|
374
472
|
def retrieve_catalog_object(object_id:,
|
375
|
-
include_related_objects: false
|
473
|
+
include_related_objects: false,
|
474
|
+
catalog_version: nil)
|
376
475
|
# Prepare query url.
|
377
476
|
_query_builder = config.get_base_uri
|
378
477
|
_query_builder << '/v2/catalog/object/{object_id}'
|
379
478
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
380
479
|
_query_builder,
|
381
|
-
'object_id' => object_id
|
480
|
+
'object_id' => { 'value' => object_id, 'encode' => true }
|
382
481
|
)
|
383
482
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
384
483
|
_query_builder,
|
385
|
-
'include_related_objects' => include_related_objects
|
484
|
+
'include_related_objects' => include_related_objects,
|
485
|
+
'catalog_version' => catalog_version
|
386
486
|
)
|
387
487
|
_query_url = APIHelper.clean_url _query_builder
|
388
488
|
|
@@ -402,15 +502,17 @@ module Square
|
|
402
502
|
# Return appropriate response type.
|
403
503
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
404
504
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
405
|
-
ApiResponse.new(
|
505
|
+
ApiResponse.new(
|
506
|
+
_response, data: decoded, errors: _errors
|
507
|
+
)
|
406
508
|
end
|
407
509
|
|
408
|
-
# Searches for [CatalogObject](
|
510
|
+
# Searches for [CatalogObject]($m/CatalogObject) of any type by matching
|
409
511
|
# supported search attribute values,
|
410
512
|
# excluding custom attribute values on items or item variations, against one
|
411
|
-
# or more of the specified query
|
513
|
+
# or more of the specified query filters.
|
412
514
|
# This (`SearchCatalogObjects`) endpoint differs from the
|
413
|
-
# [SearchCatalogItems](
|
515
|
+
# [SearchCatalogItems]($e/Catalog/SearchCatalogItems)
|
414
516
|
# endpoint in the following aspects:
|
415
517
|
# - `SearchCatalogItems` can only search for items or item variations,
|
416
518
|
# whereas `SearchCatalogObjects` can search for any type of catalog objects.
|
@@ -435,7 +537,7 @@ module Square
|
|
435
537
|
# Prepare headers.
|
436
538
|
_headers = {
|
437
539
|
'accept' => 'application/json',
|
438
|
-
'
|
540
|
+
'Content-Type' => 'application/json'
|
439
541
|
}
|
440
542
|
|
441
543
|
# Prepare and execute HttpRequest.
|
@@ -450,15 +552,17 @@ module Square
|
|
450
552
|
# Return appropriate response type.
|
451
553
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
452
554
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
453
|
-
ApiResponse.new(
|
555
|
+
ApiResponse.new(
|
556
|
+
_response, data: decoded, errors: _errors
|
557
|
+
)
|
454
558
|
end
|
455
559
|
|
456
560
|
# Searches for catalog items or item variations by matching supported search
|
457
561
|
# attribute values, including
|
458
562
|
# custom attribute values, against one or more of the specified query
|
459
|
-
#
|
563
|
+
# filters.
|
460
564
|
# This (`SearchCatalogItems`) endpoint differs from the
|
461
|
-
# [SearchCatalogObjects](
|
565
|
+
# [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects)
|
462
566
|
# endpoint in the following aspects:
|
463
567
|
# - `SearchCatalogItems` can only search for items or item variations,
|
464
568
|
# whereas `SearchCatalogObjects` can search for any type of catalog objects.
|
@@ -483,7 +587,7 @@ module Square
|
|
483
587
|
# Prepare headers.
|
484
588
|
_headers = {
|
485
589
|
'accept' => 'application/json',
|
486
|
-
'
|
590
|
+
'Content-Type' => 'application/json'
|
487
591
|
}
|
488
592
|
|
489
593
|
# Prepare and execute HttpRequest.
|
@@ -498,11 +602,13 @@ module Square
|
|
498
602
|
# Return appropriate response type.
|
499
603
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
500
604
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
501
|
-
ApiResponse.new(
|
605
|
+
ApiResponse.new(
|
606
|
+
_response, data: decoded, errors: _errors
|
607
|
+
)
|
502
608
|
end
|
503
609
|
|
504
|
-
# Updates the [CatalogModifierList](
|
505
|
-
# that apply to the targeted [CatalogItem](
|
610
|
+
# Updates the [CatalogModifierList]($m/CatalogModifierList) objects
|
611
|
+
# that apply to the targeted [CatalogItem]($m/CatalogItem) without having
|
506
612
|
# to perform an upsert on the entire item.
|
507
613
|
# @param [UpdateItemModifierListsRequest] body Required parameter: An object
|
508
614
|
# containing the fields to POST for the request. See the corresponding
|
@@ -517,7 +623,7 @@ module Square
|
|
517
623
|
# Prepare headers.
|
518
624
|
_headers = {
|
519
625
|
'accept' => 'application/json',
|
520
|
-
'
|
626
|
+
'Content-Type' => 'application/json'
|
521
627
|
}
|
522
628
|
|
523
629
|
# Prepare and execute HttpRequest.
|
@@ -532,11 +638,13 @@ module Square
|
|
532
638
|
# Return appropriate response type.
|
533
639
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
534
640
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
535
|
-
ApiResponse.new(
|
641
|
+
ApiResponse.new(
|
642
|
+
_response, data: decoded, errors: _errors
|
643
|
+
)
|
536
644
|
end
|
537
645
|
|
538
|
-
# Updates the [CatalogTax](
|
539
|
-
# targeted [CatalogItem](
|
646
|
+
# Updates the [CatalogTax]($m/CatalogTax) objects that apply to the
|
647
|
+
# targeted [CatalogItem]($m/CatalogItem) without having to perform an
|
540
648
|
# upsert on the entire item.
|
541
649
|
# @param [UpdateItemTaxesRequest] body Required parameter: An object
|
542
650
|
# containing the fields to POST for the request. See the corresponding
|
@@ -551,7 +659,7 @@ module Square
|
|
551
659
|
# Prepare headers.
|
552
660
|
_headers = {
|
553
661
|
'accept' => 'application/json',
|
554
|
-
'
|
662
|
+
'Content-Type' => 'application/json'
|
555
663
|
}
|
556
664
|
|
557
665
|
# Prepare and execute HttpRequest.
|
@@ -566,7 +674,9 @@ module Square
|
|
566
674
|
# Return appropriate response type.
|
567
675
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
568
676
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
569
|
-
ApiResponse.new(
|
677
|
+
ApiResponse.new(
|
678
|
+
_response, data: decoded, errors: _errors
|
679
|
+
)
|
570
680
|
end
|
571
681
|
end
|
572
682
|
end
|
@@ -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
|
9
|
-
#
|
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.
|
@@ -21,14 +21,14 @@ module Square
|
|
21
21
|
_query_builder << '/v2/locations/{location_id}/checkouts'
|
22
22
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
23
23
|
_query_builder,
|
24
|
-
'location_id' => location_id
|
24
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
25
25
|
)
|
26
26
|
_query_url = APIHelper.clean_url _query_builder
|
27
27
|
|
28
28
|
# Prepare headers.
|
29
29
|
_headers = {
|
30
30
|
'accept' => 'application/json',
|
31
|
-
'
|
31
|
+
'Content-Type' => 'application/json'
|
32
32
|
}
|
33
33
|
|
34
34
|
# Prepare and execute HttpRequest.
|
@@ -43,7 +43,9 @@ module Square
|
|
43
43
|
# Return appropriate response type.
|
44
44
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
45
45
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
46
|
-
ApiResponse.new(
|
46
|
+
ApiResponse.new(
|
47
|
+
_response, data: decoded, errors: _errors
|
48
|
+
)
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|