square.rb 15.0.0.20211020 → 17.1.0.20220120
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/lib/square/api/apple_pay_api.rb +1 -1
- data/lib/square/api/base_api.rb +16 -1
- data/lib/square/api/bookings_api.rb +92 -7
- data/lib/square/api/cards_api.rb +1 -1
- data/lib/square/api/catalog_api.rb +109 -34
- data/lib/square/api/checkout_api.rb +1 -1
- data/lib/square/api/customer_groups_api.rb +2 -2
- data/lib/square/api/customers_api.rb +4 -4
- data/lib/square/api/devices_api.rb +1 -1
- data/lib/square/api/disputes_api.rb +1 -1
- data/lib/square/api/gift_card_activities_api.rb +26 -20
- data/lib/square/api/gift_cards_api.rb +29 -24
- data/lib/square/api/inventory_api.rb +6 -6
- data/lib/square/api/invoices_api.rb +5 -5
- data/lib/square/api/labor_api.rb +6 -6
- data/lib/square/api/locations_api.rb +22 -13
- data/lib/square/api/loyalty_api.rb +14 -23
- data/lib/square/api/mobile_authorization_api.rb +4 -4
- data/lib/square/api/o_auth_api.rb +10 -10
- data/lib/square/api/orders_api.rb +7 -7
- data/lib/square/api/payments_api.rb +4 -4
- data/lib/square/api/refunds_api.rb +8 -5
- data/lib/square/api/sites_api.rb +2 -1
- data/lib/square/api/snippets_api.rb +1 -1
- data/lib/square/api/subscriptions_api.rb +159 -16
- data/lib/square/api/team_api.rb +6 -6
- data/lib/square/api/terminal_api.rb +4 -4
- data/lib/square/api/v1_transactions_api.rb +2 -2
- data/lib/square/client.rb +8 -3
- data/lib/square/configuration.rb +15 -4
- data/test/api/test_locations_api.rb +2 -5
- data/test/test_helper.rb +1 -1
- metadata +2 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 407147246777f8a4eda2d4848cad5edb62be5801c25b6361f0dfb21d58663fd9
|
4
|
+
data.tar.gz: 735c7e92297b1d4a79ebd856dbe39cc304051536622f0277ddd9489811652cb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90ccb1516f8ff8998787d63a168c8c8688b9a12691d85cac3a2b6af35ce52af93bbc013e11336d5319cc252ec75ce7f790165ea5c38c69367f092e5ef62b365d
|
7
|
+
data.tar.gz: 05a3eb69caf678ad7f071b66a27c3ed4375ac96470ba09e51df9db6eba1401b80bd461c7fd6cb7bde91f30bb7ee5d11b9f7f293a59d40c70ab5ed52b25b9d180
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -10,7 +10,7 @@ Use this gem to integrate Square payments into your app and grow your business w
|
|
10
10
|
|
11
11
|
## Requirements
|
12
12
|
|
13
|
-
We support Ruby 2.5.x, 2.6.x,
|
13
|
+
We support Ruby 2.5.x, 2.6.x, 2.7.x, and 3.0.x.
|
14
14
|
|
15
15
|
## Installation
|
16
16
|
|
@@ -349,4 +349,4 @@ You can also use the Square API to create applications or services that work wit
|
|
349
349
|
[Snippets]: doc/api/snippets.md
|
350
350
|
[Cards]: doc/api/cards.md
|
351
351
|
[Gift Cards]: doc/api/gift-cards.md
|
352
|
-
[Gift Card Activities]: doc/api/gift-card-activities.md
|
352
|
+
[Gift Card Activities]: doc/api/gift-card-activities.md
|
data/lib/square/api/base_api.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'erb'
|
1
2
|
module Square
|
2
3
|
# BaseApi.
|
3
4
|
class BaseApi
|
@@ -8,7 +9,7 @@ module Square
|
|
8
9
|
@http_call_back = http_call_back
|
9
10
|
|
10
11
|
@global_headers = {
|
11
|
-
'user-agent' =>
|
12
|
+
'user-agent' => get_user_agent,
|
12
13
|
'Square-Version' => config.square_version
|
13
14
|
}
|
14
15
|
end
|
@@ -35,5 +36,19 @@ module Square
|
|
35
36
|
|
36
37
|
response
|
37
38
|
end
|
39
|
+
|
40
|
+
def get_user_agent
|
41
|
+
user_agent = 'Square-Ruby-SDK/17.1.0.20220120 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
|
42
|
+
user_agent['{engine}'] = RUBY_ENGINE
|
43
|
+
user_agent['{engine-version}'] = RUBY_ENGINE_VERSION
|
44
|
+
user_agent['{os-info}'] = RUBY_PLATFORM
|
45
|
+
user_agent['{api-version}'] = config.square_version
|
46
|
+
if config.user_agent_detail.nil? || config.user_agent_detail.empty?
|
47
|
+
user_agent = user_agent.gsub('{detail}', '')
|
48
|
+
else
|
49
|
+
user_agent['{detail}'] = ERB::Util.url_encode(config.user_agent_detail.to_s)
|
50
|
+
end
|
51
|
+
user_agent
|
52
|
+
end
|
38
53
|
end
|
39
54
|
end
|
@@ -5,7 +5,75 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
+
# Retrieve a collection of bookings.
|
9
|
+
# To call this endpoint with buyer-level permissions, set
|
10
|
+
# `APPOINTMENTS_READ` for the OAuth scope.
|
11
|
+
# To call this endpoint with seller-level permissions, set
|
12
|
+
# `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
|
13
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
14
|
+
# per page to return in a paged response.
|
15
|
+
# @param [String] cursor Optional parameter: The pagination cursor from the
|
16
|
+
# preceding response to return the next page of the results. Do not set this
|
17
|
+
# when retrieving the first page of the results.
|
18
|
+
# @param [String] team_member_id Optional parameter: The team member for
|
19
|
+
# whom to retrieve bookings. If this is not set, bookings of all members are
|
20
|
+
# retrieved.
|
21
|
+
# @param [String] location_id Optional parameter: The location for which to
|
22
|
+
# retrieve bookings. If this is not set, all locations' bookings are
|
23
|
+
# retrieved.
|
24
|
+
# @param [String] start_at_min Optional parameter: The RFC 3339 timestamp
|
25
|
+
# specifying the earliest of the start time. If this is not set, the current
|
26
|
+
# time is used.
|
27
|
+
# @param [String] start_at_max Optional parameter: The RFC 3339 timestamp
|
28
|
+
# specifying the latest of the start time. If this is not set, the time of
|
29
|
+
# 31 days after `start_at_min` is used.
|
30
|
+
# @return [ListBookingsResponse Hash] response from the API call
|
31
|
+
def list_bookings(limit: nil,
|
32
|
+
cursor: nil,
|
33
|
+
team_member_id: nil,
|
34
|
+
location_id: nil,
|
35
|
+
start_at_min: nil,
|
36
|
+
start_at_max: nil)
|
37
|
+
# Prepare query url.
|
38
|
+
_query_builder = config.get_base_uri
|
39
|
+
_query_builder << '/v2/bookings'
|
40
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
41
|
+
_query_builder,
|
42
|
+
'limit' => limit,
|
43
|
+
'cursor' => cursor,
|
44
|
+
'team_member_id' => team_member_id,
|
45
|
+
'location_id' => location_id,
|
46
|
+
'start_at_min' => start_at_min,
|
47
|
+
'start_at_max' => start_at_max
|
48
|
+
)
|
49
|
+
_query_url = APIHelper.clean_url _query_builder
|
50
|
+
|
51
|
+
# Prepare headers.
|
52
|
+
_headers = {
|
53
|
+
'accept' => 'application/json'
|
54
|
+
}
|
55
|
+
|
56
|
+
# Prepare and execute HttpRequest.
|
57
|
+
_request = config.http_client.get(
|
58
|
+
_query_url,
|
59
|
+
headers: _headers
|
60
|
+
)
|
61
|
+
OAuth2.apply(config, _request)
|
62
|
+
_response = execute_request(_request)
|
63
|
+
|
64
|
+
# Return appropriate response type.
|
65
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
66
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
67
|
+
ApiResponse.new(
|
68
|
+
_response, data: decoded, errors: _errors
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
8
72
|
# Creates a booking.
|
73
|
+
# To call this endpoint with buyer-level permissions, set
|
74
|
+
# `APPOINTMENTS_WRITE` for the OAuth scope.
|
75
|
+
# To call this endpoint with seller-level permissions, set
|
76
|
+
# `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
|
9
77
|
# @param [CreateBookingRequest] body Required parameter: An object
|
10
78
|
# containing the fields to POST for the request. See the corresponding
|
11
79
|
# object definition for field details.
|
@@ -19,7 +87,7 @@ module Square
|
|
19
87
|
# Prepare headers.
|
20
88
|
_headers = {
|
21
89
|
'accept' => 'application/json',
|
22
|
-
'
|
90
|
+
'Content-Type' => 'application/json'
|
23
91
|
}
|
24
92
|
|
25
93
|
# Prepare and execute HttpRequest.
|
@@ -40,6 +108,10 @@ module Square
|
|
40
108
|
end
|
41
109
|
|
42
110
|
# Searches for availabilities for booking.
|
111
|
+
# To call this endpoint with buyer-level permissions, set
|
112
|
+
# `APPOINTMENTS_READ` for the OAuth scope.
|
113
|
+
# To call this endpoint with seller-level permissions, set
|
114
|
+
# `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
|
43
115
|
# @param [SearchAvailabilityRequest] body Required parameter: An object
|
44
116
|
# containing the fields to POST for the request. See the corresponding
|
45
117
|
# object definition for field details.
|
@@ -53,7 +125,7 @@ module Square
|
|
53
125
|
# Prepare headers.
|
54
126
|
_headers = {
|
55
127
|
'accept' => 'application/json',
|
56
|
-
'
|
128
|
+
'Content-Type' => 'application/json'
|
57
129
|
}
|
58
130
|
|
59
131
|
# Prepare and execute HttpRequest.
|
@@ -107,9 +179,10 @@ module Square
|
|
107
179
|
# include only bookable team members in the returned result (`true`) or not
|
108
180
|
# (`false`).
|
109
181
|
# @param [Integer] limit Optional parameter: The maximum number of results
|
110
|
-
# to return.
|
111
|
-
# @param [String] cursor Optional parameter: The cursor
|
112
|
-
#
|
182
|
+
# to return in a paged response.
|
183
|
+
# @param [String] cursor Optional parameter: The pagination cursor from the
|
184
|
+
# preceding response to return the next page of the results. Do not set this
|
185
|
+
# when retrieving the first page of the results.
|
113
186
|
# @param [String] location_id Optional parameter: Indicates whether to
|
114
187
|
# include only team members enabled at the given location in the returned
|
115
188
|
# result.
|
@@ -187,6 +260,10 @@ module Square
|
|
187
260
|
end
|
188
261
|
|
189
262
|
# Retrieves a booking.
|
263
|
+
# To call this endpoint with buyer-level permissions, set
|
264
|
+
# `APPOINTMENTS_READ` for the OAuth scope.
|
265
|
+
# To call this endpoint with seller-level permissions, set
|
266
|
+
# `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
|
190
267
|
# @param [String] booking_id Required parameter: The ID of the
|
191
268
|
# [Booking]($m/Booking) object representing the to-be-retrieved booking.
|
192
269
|
# @return [RetrieveBookingResponse Hash] response from the API call
|
@@ -222,6 +299,10 @@ module Square
|
|
222
299
|
end
|
223
300
|
|
224
301
|
# Updates a booking.
|
302
|
+
# To call this endpoint with buyer-level permissions, set
|
303
|
+
# `APPOINTMENTS_WRITE` for the OAuth scope.
|
304
|
+
# To call this endpoint with seller-level permissions, set
|
305
|
+
# `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
|
225
306
|
# @param [String] booking_id Required parameter: The ID of the
|
226
307
|
# [Booking]($m/Booking) object representing the to-be-updated booking.
|
227
308
|
# @param [UpdateBookingRequest] body Required parameter: An object
|
@@ -242,7 +323,7 @@ module Square
|
|
242
323
|
# Prepare headers.
|
243
324
|
_headers = {
|
244
325
|
'accept' => 'application/json',
|
245
|
-
'
|
326
|
+
'Content-Type' => 'application/json'
|
246
327
|
}
|
247
328
|
|
248
329
|
# Prepare and execute HttpRequest.
|
@@ -263,6 +344,10 @@ module Square
|
|
263
344
|
end
|
264
345
|
|
265
346
|
# Cancels an existing booking.
|
347
|
+
# To call this endpoint with buyer-level permissions, set
|
348
|
+
# `APPOINTMENTS_WRITE` for the OAuth scope.
|
349
|
+
# To call this endpoint with seller-level permissions, set
|
350
|
+
# `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
|
266
351
|
# @param [String] booking_id Required parameter: The ID of the
|
267
352
|
# [Booking]($m/Booking) object representing the to-be-cancelled booking.
|
268
353
|
# @param [CancelBookingRequest] body Required parameter: An object
|
@@ -283,7 +368,7 @@ module Square
|
|
283
368
|
# Prepare headers.
|
284
369
|
_headers = {
|
285
370
|
'accept' => 'application/json',
|
286
|
-
'
|
371
|
+
'Content-Type' => 'application/json'
|
287
372
|
}
|
288
373
|
|
289
374
|
# Prepare and execute HttpRequest.
|
data/lib/square/api/cards_api.rb
CHANGED
@@ -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.
|
@@ -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.
|
@@ -115,7 +115,7 @@ module Square
|
|
115
115
|
# Prepare headers.
|
116
116
|
_headers = {
|
117
117
|
'accept' => 'application/json',
|
118
|
-
'
|
118
|
+
'Content-Type' => 'application/json'
|
119
119
|
}
|
120
120
|
|
121
121
|
# Prepare and execute HttpRequest.
|
@@ -136,10 +136,10 @@ module Square
|
|
136
136
|
end
|
137
137
|
|
138
138
|
# Uploads an image file to be represented by a
|
139
|
-
# [CatalogImage]($m/CatalogImage) object linked to an existing
|
140
|
-
# [CatalogObject]($m/CatalogObject) instance.
|
141
|
-
#
|
142
|
-
#
|
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.
|
143
143
|
# This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data
|
144
144
|
# requests with a JSON part and an image file part in
|
145
145
|
# JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
|
@@ -196,6 +196,71 @@ module Square
|
|
196
196
|
)
|
197
197
|
end
|
198
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
|
+
|
199
264
|
# Retrieves information about the Square Catalog API, such as batch size
|
200
265
|
# limits that can be used by the `BatchUpsertCatalogObjects` endpoint.
|
201
266
|
# @return [CatalogInfoResponse Hash] response from the API call
|
@@ -226,15 +291,12 @@ module Square
|
|
226
291
|
)
|
227
292
|
end
|
228
293
|
|
229
|
-
# Returns a list of [CatalogObject]($m/CatalogObject)s
|
230
|
-
#
|
231
|
-
#
|
232
|
-
#
|
233
|
-
#
|
234
|
-
#
|
235
|
-
# [CatalogObject]($m/CatalogObject) types:
|
236
|
-
# `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`,
|
237
|
-
# `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`".
|
238
300
|
# __Important:__ ListCatalog does not return deleted catalog items. To
|
239
301
|
# retrieve
|
240
302
|
# deleted catalog items, use
|
@@ -247,16 +309,22 @@ module Square
|
|
247
309
|
# for more information.
|
248
310
|
# @param [String] types Optional parameter: An optional case-insensitive,
|
249
311
|
# comma-separated list of object types to retrieve. The valid values are
|
250
|
-
# defined in the [CatalogObjectType]($m/CatalogObjectType) enum,
|
251
|
-
# `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`,
|
252
|
-
# `MODIFIER_LIST`,
|
253
|
-
# returns objects of all the types at the version of the
|
254
|
-
# make the request.
|
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.
|
255
322
|
# @param [Long] catalog_version Optional parameter: The specific version of
|
256
323
|
# the catalog objects to be included in the response. This allows you to
|
257
324
|
# retrieve historical versions of objects. The specified version value is
|
258
325
|
# matched against the [CatalogObject]($m/CatalogObject)s' `version`
|
259
|
-
# attribute.
|
326
|
+
# attribute. If not included, results will be from the current version of
|
327
|
+
# the catalog.
|
260
328
|
# @return [ListCatalogResponse Hash] response from the API call
|
261
329
|
def list_catalog(cursor: nil,
|
262
330
|
types: nil,
|
@@ -307,7 +375,7 @@ module Square
|
|
307
375
|
# Prepare headers.
|
308
376
|
_headers = {
|
309
377
|
'accept' => 'application/json',
|
310
|
-
'
|
378
|
+
'Content-Type' => 'application/json'
|
311
379
|
}
|
312
380
|
|
313
381
|
# Prepare and execute HttpRequest.
|
@@ -382,17 +450,24 @@ module Square
|
|
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
|
386
|
-
#
|
387
|
-
#
|
388
|
-
#
|
389
|
-
#
|
390
|
-
# be
|
391
|
-
#
|
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
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.
|
396
471
|
# @return [RetrieveCatalogObjectResponse Hash] response from the API call
|
397
472
|
def retrieve_catalog_object(object_id:,
|
398
473
|
include_related_objects: false,
|
@@ -462,7 +537,7 @@ module Square
|
|
462
537
|
# Prepare headers.
|
463
538
|
_headers = {
|
464
539
|
'accept' => 'application/json',
|
465
|
-
'
|
540
|
+
'Content-Type' => 'application/json'
|
466
541
|
}
|
467
542
|
|
468
543
|
# Prepare and execute HttpRequest.
|
@@ -512,7 +587,7 @@ module Square
|
|
512
587
|
# Prepare headers.
|
513
588
|
_headers = {
|
514
589
|
'accept' => 'application/json',
|
515
|
-
'
|
590
|
+
'Content-Type' => 'application/json'
|
516
591
|
}
|
517
592
|
|
518
593
|
# Prepare and execute HttpRequest.
|
@@ -548,7 +623,7 @@ module Square
|
|
548
623
|
# Prepare headers.
|
549
624
|
_headers = {
|
550
625
|
'accept' => 'application/json',
|
551
|
-
'
|
626
|
+
'Content-Type' => 'application/json'
|
552
627
|
}
|
553
628
|
|
554
629
|
# Prepare and execute HttpRequest.
|
@@ -584,7 +659,7 @@ module Square
|
|
584
659
|
# Prepare headers.
|
585
660
|
_headers = {
|
586
661
|
'accept' => 'application/json',
|
587
|
-
'
|
662
|
+
'Content-Type' => 'application/json'
|
588
663
|
}
|
589
664
|
|
590
665
|
# Prepare and execute HttpRequest.
|
@@ -66,7 +66,7 @@ module Square
|
|
66
66
|
# Prepare headers.
|
67
67
|
_headers = {
|
68
68
|
'accept' => 'application/json',
|
69
|
-
'
|
69
|
+
'Content-Type' => 'application/json'
|
70
70
|
}
|
71
71
|
|
72
72
|
# Prepare and execute HttpRequest.
|
@@ -177,7 +177,7 @@ module Square
|
|
177
177
|
# Prepare headers.
|
178
178
|
_headers = {
|
179
179
|
'accept' => 'application/json',
|
180
|
-
'
|
180
|
+
'Content-Type' => 'application/json'
|
181
181
|
}
|
182
182
|
|
183
183
|
# Prepare and execute HttpRequest.
|
@@ -88,7 +88,7 @@ module Square
|
|
88
88
|
# Prepare headers.
|
89
89
|
_headers = {
|
90
90
|
'accept' => 'application/json',
|
91
|
-
'
|
91
|
+
'Content-Type' => 'application/json'
|
92
92
|
}
|
93
93
|
|
94
94
|
# Prepare and execute HttpRequest.
|
@@ -132,7 +132,7 @@ module Square
|
|
132
132
|
# Prepare headers.
|
133
133
|
_headers = {
|
134
134
|
'accept' => 'application/json',
|
135
|
-
'
|
135
|
+
'Content-Type' => 'application/json'
|
136
136
|
}
|
137
137
|
|
138
138
|
# Prepare and execute HttpRequest.
|
@@ -274,7 +274,7 @@ module Square
|
|
274
274
|
# Prepare headers.
|
275
275
|
_headers = {
|
276
276
|
'accept' => 'application/json',
|
277
|
-
'
|
277
|
+
'Content-Type' => 'application/json'
|
278
278
|
}
|
279
279
|
|
280
280
|
# Prepare and execute HttpRequest.
|
@@ -320,7 +320,7 @@ module Square
|
|
320
320
|
# Prepare headers.
|
321
321
|
_headers = {
|
322
322
|
'accept' => 'application/json',
|
323
|
-
'
|
323
|
+
'Content-Type' => 'application/json'
|
324
324
|
}
|
325
325
|
|
326
326
|
# Prepare and execute HttpRequest.
|
@@ -13,29 +13,35 @@ module Square
|
|
13
13
|
# for a gift card,
|
14
14
|
# for all gift cards in a specific region, or for activities within a time
|
15
15
|
# window.
|
16
|
-
# @param [String] gift_card_id Optional parameter: If
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
# @param [String] type Optional parameter: If
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
16
|
+
# @param [String] gift_card_id Optional parameter: If a gift card ID is
|
17
|
+
# provided, the endpoint returns activities related to the specified gift
|
18
|
+
# card. Otherwise, the endpoint returns all gift card activities for the
|
19
|
+
# seller.
|
20
|
+
# @param [String] type Optional parameter: If a
|
21
|
+
# [type]($m/GiftCardActivityType) is provided, the endpoint returns gift
|
22
|
+
# card activities of the specified type. Otherwise, the endpoint returns
|
23
|
+
# all types of gift card activities.
|
24
|
+
# @param [String] location_id Optional parameter: If a location ID is
|
25
|
+
# provided, the endpoint returns gift card activities for the specified
|
26
|
+
# location. Otherwise, the endpoint returns gift card activities for all
|
27
|
+
# locations.
|
26
28
|
# @param [String] begin_time Optional parameter: The timestamp for the
|
27
|
-
# beginning of the reporting period, in RFC 3339 format.
|
28
|
-
# The current time minus one year.
|
29
|
+
# beginning of the reporting period, in RFC 3339 format. This start time is
|
30
|
+
# inclusive. The default value is the current time minus one year.
|
29
31
|
# @param [String] end_time Optional parameter: The timestamp for the end of
|
30
|
-
# the reporting period, in RFC 3339 format.
|
31
|
-
# time.
|
32
|
-
# @param [Integer] limit Optional parameter: If
|
33
|
-
#
|
34
|
-
#
|
32
|
+
# the reporting period, in RFC 3339 format. This end time is inclusive. The
|
33
|
+
# default value is the current time.
|
34
|
+
# @param [Integer] limit Optional parameter: If a limit is provided, the
|
35
|
+
# endpoint returns the specified number of results (or fewer) per page. The
|
36
|
+
# maximum value is 100. The default value is 50. For more information, see
|
37
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
38
|
+
# ion).
|
35
39
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
36
40
|
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
37
|
-
# set of results for the original query. If
|
38
|
-
#
|
41
|
+
# set of results for the original query. If a cursor is not provided, the
|
42
|
+
# endpoint returns the first page of the results. For more information, see
|
43
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
44
|
+
# ion).
|
39
45
|
# @param [String] sort_order Optional parameter: The order in which the
|
40
46
|
# endpoint returns the activities, based on `created_at`. - `ASC` - Oldest
|
41
47
|
# to newest. - `DESC` - Newest to oldest (default).
|
@@ -104,7 +110,7 @@ module Square
|
|
104
110
|
# Prepare headers.
|
105
111
|
_headers = {
|
106
112
|
'accept' => 'application/json',
|
107
|
-
'
|
113
|
+
'Content-Type' => 'application/json'
|
108
114
|
}
|
109
115
|
|
110
116
|
# Prepare and execute HttpRequest.
|