square.rb 14.1.0.20210915 → 17.0.0.20211215
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 +23 -20
- data/lib/square/api/apple_pay_api.rb +1 -1
- data/lib/square/api/base_api.rb +8 -4
- data/lib/square/api/bookings_api.rb +64 -4
- 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 +3 -3
- data/lib/square/api/customer_segments_api.rb +1 -1
- data/lib/square/api/customers_api.rb +5 -5
- 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 +20 -12
- data/lib/square/api/loyalty_api.rb +9 -9
- 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 +12 -6
- data/lib/square/api/refunds_api.rb +1 -1
- 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/transactions_api.rb +0 -188
- data/lib/square/api/v1_transactions_api.rb +2 -2
- data/lib/square/client.rb +12 -6
- data/lib/square/configuration.rb +23 -15
- data/lib/square/http/api_response.rb +1 -1
- data/lib/square/http/faraday_client.rb +20 -1
- 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: 28048e0ca738b0ca2de7579b8dc077c0307266afa1ff42c1ee6808eb64c79f43
|
4
|
+
data.tar.gz: 7ba3afdb67a42eb41864d5fe5839b8b74f525eebac2b6348e51aee92c9399328
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bf8bcf75bf6558596e20c1f9d3c82d579aa20f4964047c94bc43592b2e1b0f28445d1f788ba30e1272095380a07a5350fc4c2f8082097b12ef29eb424b33bfd
|
7
|
+
data.tar.gz: 4b09ca82e2b15e60b7ae1a7c217bf445cfb8dd0f6ceb60d6e835d08a5ef08657054d15cc58124d85a1be2f30a8d67630a55caaf58c0942cb92de81ec426cfe6d
|
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
|
|
@@ -115,8 +115,8 @@ require 'square'
|
|
115
115
|
# for the Square account whose assets you want to manage.
|
116
116
|
|
117
117
|
client = Square::Client.new(
|
118
|
-
|
119
|
-
|
118
|
+
access_token: 'YOUR SANDBOX ACCESS TOKEN HERE',
|
119
|
+
environment: 'sandbox'
|
120
120
|
)
|
121
121
|
|
122
122
|
# Call list_locations method to get all locations in this Square account
|
@@ -124,10 +124,10 @@ result = client.locations.list_locations
|
|
124
124
|
|
125
125
|
# Call the #success? method to see if the call succeeded
|
126
126
|
if result.success?
|
127
|
-
|
127
|
+
# The #data Struct contains a list of locations
|
128
128
|
locations = result.data.locations
|
129
129
|
|
130
|
-
|
130
|
+
# Iterate over the list
|
131
131
|
locations.each do |location|
|
132
132
|
# Each location is represented as a Hash
|
133
133
|
location.each do |key, value|
|
@@ -176,6 +176,7 @@ This error was returned when an invalid token was used to call the API.
|
|
176
176
|
After you’ve tried out the Square APIs and tested your application using sandbox, you will want to switch to your production credentials so that you can manage real Square resources. Don't forget to switch your access token from sandbox to production for real data.
|
177
177
|
|
178
178
|
## SDK patterns
|
179
|
+
|
179
180
|
If you know a few patterns, you’ll be able to call any API in the SDK. Here are some important ones:
|
180
181
|
|
181
182
|
### Get an access token
|
@@ -196,30 +197,31 @@ To use the Square API, you import the Client class, instantiate a Client object,
|
|
196
197
|
|
197
198
|
- Instantiate a `Square::Client` object with the access token for the Square account whose resources you want to manage. To access sandbox resources, initialize the `Square::Client` with environment set to sandbox:
|
198
199
|
|
199
|
-
```ruby
|
200
|
-
client = Square::Client.new(
|
200
|
+
```ruby
|
201
|
+
client = Square::Client.new(
|
201
202
|
access_token: 'SANDBOX ACCESS TOKEN HERE',
|
202
203
|
environment: 'sandbox'
|
203
|
-
)
|
204
|
-
```
|
204
|
+
)
|
205
|
+
```
|
205
206
|
|
206
207
|
- To access production resources, set environment to production:
|
207
208
|
|
208
|
-
```ruby
|
209
|
-
client = Square::Client.new(
|
209
|
+
```ruby
|
210
|
+
client = Square::Client.new(
|
210
211
|
access_token: 'ACCESS TOKEN HERE',
|
211
212
|
environment: 'production'
|
212
|
-
)
|
213
|
-
```
|
213
|
+
)
|
214
|
+
```
|
214
215
|
|
215
216
|
- To set a custom environment provide a `custom_url`, and set environment to `custom`:
|
216
217
|
|
217
|
-
```ruby
|
218
|
-
client = Square::Client.new(
|
218
|
+
```ruby
|
219
|
+
client = Square::Client.new(
|
219
220
|
access_token:'ACCESS TOKEN HERE',
|
220
221
|
environment: 'custom',
|
221
222
|
custom_url: 'https://your.customdomain.com'
|
222
|
-
)
|
223
|
+
)
|
224
|
+
```
|
223
225
|
|
224
226
|
### Get an Instance of an API object and call its methods
|
225
227
|
|
@@ -227,9 +229,9 @@ Each API is implemented as a class. The Client object instantiates every API cla
|
|
227
229
|
|
228
230
|
- Work with an API by calling the methods on the API object. For example, you would call list_customers to get a list of all customers in the Square account:
|
229
231
|
|
230
|
-
```ruby
|
231
|
-
result = client.customers.list_customers
|
232
|
-
```
|
232
|
+
```ruby
|
233
|
+
result = client.customers.list_customers
|
234
|
+
```
|
233
235
|
|
234
236
|
See the SDK documentation for the list of methods for each API class.
|
235
237
|
|
@@ -250,6 +252,7 @@ result = client.customers.create_customer(request_body)
|
|
250
252
|
```
|
251
253
|
|
252
254
|
If your call succeeds, you’ll see a response that looks like this:
|
255
|
+
|
253
256
|
```
|
254
257
|
{'customer': {'created_at': '2019-06-28T21:23:05.126Z', 'creation_source': 'THIRD_PARTY', 'family_name': 'Earhardt', 'given_name': 'Amelia', 'id': 'CBASEDwl3El91nohQ2FLEk4aBfcgAQ', 'preferences': {'email_unsubscribed': False}, 'updated_at': '2019-06-28T21:23:05.126Z'}}
|
255
258
|
```
|
@@ -274,7 +277,7 @@ end
|
|
274
277
|
|
275
278
|
## Tests
|
276
279
|
|
277
|
-
First, clone the
|
280
|
+
First, clone the repo locally and `cd` into the directory.
|
278
281
|
|
279
282
|
```sh
|
280
283
|
git clone https://github.com/square/square-ruby-sdk.git
|
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
|
@@ -24,9 +25,7 @@ module Square
|
|
24
25
|
|
25
26
|
APIHelper.clean_hash(request.headers)
|
26
27
|
request.headers.merge!(@global_headers)
|
27
|
-
unless config.additional_headers.nil?
|
28
|
-
request.headers.merge!(config.additional_headers)
|
29
|
-
end
|
28
|
+
request.headers.merge!(config.additional_headers) unless config.additional_headers.nil?
|
30
29
|
|
31
30
|
response = if binary
|
32
31
|
config.http_client.execute_as_binary(request)
|
@@ -37,5 +36,10 @@ module Square
|
|
37
36
|
|
38
37
|
response
|
39
38
|
end
|
39
|
+
|
40
|
+
def get_user_agent
|
41
|
+
user_agent = 'Square-Ruby-SDK/17.0.0.20211215'
|
42
|
+
user_agent
|
43
|
+
end
|
40
44
|
end
|
41
45
|
end
|
@@ -5,6 +5,66 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
+
# Retrieve a collection of bookings.
|
9
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
10
|
+
# per page to return in a paged response.
|
11
|
+
# @param [String] cursor Optional parameter: The pagination cursor from the
|
12
|
+
# preceding response to return the next page of the results. Do not set this
|
13
|
+
# when retrieving the first page of the results.
|
14
|
+
# @param [String] team_member_id Optional parameter: The team member for
|
15
|
+
# whom to retrieve bookings. If this is not set, bookings of all members are
|
16
|
+
# retrieved.
|
17
|
+
# @param [String] location_id Optional parameter: The location for which to
|
18
|
+
# retrieve bookings. If this is not set, all locations' bookings are
|
19
|
+
# retrieved.
|
20
|
+
# @param [String] start_at_min Optional parameter: The RFC 3339 timestamp
|
21
|
+
# specifying the earliest of the start time. If this is not set, the current
|
22
|
+
# time is used.
|
23
|
+
# @param [String] start_at_max Optional parameter: The RFC 3339 timestamp
|
24
|
+
# specifying the latest of the start time. If this is not set, the time of
|
25
|
+
# 31 days after `start_at_min` is used.
|
26
|
+
# @return [ListBookingsResponse Hash] response from the API call
|
27
|
+
def list_bookings(limit: nil,
|
28
|
+
cursor: nil,
|
29
|
+
team_member_id: nil,
|
30
|
+
location_id: nil,
|
31
|
+
start_at_min: nil,
|
32
|
+
start_at_max: nil)
|
33
|
+
# Prepare query url.
|
34
|
+
_query_builder = config.get_base_uri
|
35
|
+
_query_builder << '/v2/bookings'
|
36
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
37
|
+
_query_builder,
|
38
|
+
'limit' => limit,
|
39
|
+
'cursor' => cursor,
|
40
|
+
'team_member_id' => team_member_id,
|
41
|
+
'location_id' => location_id,
|
42
|
+
'start_at_min' => start_at_min,
|
43
|
+
'start_at_max' => start_at_max
|
44
|
+
)
|
45
|
+
_query_url = APIHelper.clean_url _query_builder
|
46
|
+
|
47
|
+
# Prepare headers.
|
48
|
+
_headers = {
|
49
|
+
'accept' => 'application/json'
|
50
|
+
}
|
51
|
+
|
52
|
+
# Prepare and execute HttpRequest.
|
53
|
+
_request = config.http_client.get(
|
54
|
+
_query_url,
|
55
|
+
headers: _headers
|
56
|
+
)
|
57
|
+
OAuth2.apply(config, _request)
|
58
|
+
_response = execute_request(_request)
|
59
|
+
|
60
|
+
# Return appropriate response type.
|
61
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
62
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
63
|
+
ApiResponse.new(
|
64
|
+
_response, data: decoded, errors: _errors
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
8
68
|
# Creates a booking.
|
9
69
|
# @param [CreateBookingRequest] body Required parameter: An object
|
10
70
|
# containing the fields to POST for the request. See the corresponding
|
@@ -19,7 +79,7 @@ module Square
|
|
19
79
|
# Prepare headers.
|
20
80
|
_headers = {
|
21
81
|
'accept' => 'application/json',
|
22
|
-
'
|
82
|
+
'Content-Type' => 'application/json'
|
23
83
|
}
|
24
84
|
|
25
85
|
# Prepare and execute HttpRequest.
|
@@ -53,7 +113,7 @@ module Square
|
|
53
113
|
# Prepare headers.
|
54
114
|
_headers = {
|
55
115
|
'accept' => 'application/json',
|
56
|
-
'
|
116
|
+
'Content-Type' => 'application/json'
|
57
117
|
}
|
58
118
|
|
59
119
|
# Prepare and execute HttpRequest.
|
@@ -242,7 +302,7 @@ module Square
|
|
242
302
|
# Prepare headers.
|
243
303
|
_headers = {
|
244
304
|
'accept' => 'application/json',
|
245
|
-
'
|
305
|
+
'Content-Type' => 'application/json'
|
246
306
|
}
|
247
307
|
|
248
308
|
# Prepare and execute HttpRequest.
|
@@ -283,7 +343,7 @@ module Square
|
|
283
343
|
# Prepare headers.
|
284
344
|
_headers = {
|
285
345
|
'accept' => 'application/json',
|
286
|
-
'
|
346
|
+
'Content-Type' => 'application/json'
|
287
347
|
}
|
288
348
|
|
289
349
|
# 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.
|
@@ -13,7 +13,7 @@ module Square
|
|
13
13
|
# ion).
|
14
14
|
# @param [Integer] limit Optional parameter: The maximum number of results
|
15
15
|
# to return in a single page. This limit is advisory. The response might
|
16
|
-
# contain more or fewer results.
|
16
|
+
# contain more or fewer results. The limit is ignored if it is less than 1
|
17
17
|
# or greater than 50. The default value is 50. For more information, see
|
18
18
|
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
19
19
|
# ion).
|
@@ -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.
|
@@ -13,7 +13,7 @@ module Square
|
|
13
13
|
# ion).
|
14
14
|
# @param [Integer] limit Optional parameter: The maximum number of results
|
15
15
|
# to return in a single page. This limit is advisory. The response might
|
16
|
-
# contain more or fewer results.
|
16
|
+
# contain more or fewer results. The limit is ignored if it is less than 1
|
17
17
|
# or greater than 50. The default value is 50. For more information, see
|
18
18
|
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
19
19
|
# ion).
|
@@ -19,7 +19,7 @@ module Square
|
|
19
19
|
# ion).
|
20
20
|
# @param [Integer] limit Optional parameter: The maximum number of results
|
21
21
|
# to return in a single page. This limit is advisory. The response might
|
22
|
-
# contain more or fewer results.
|
22
|
+
# contain more or fewer results. The limit is ignored if it is less than 1
|
23
23
|
# or greater than 100. The default value is 100. For more information, see
|
24
24
|
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
25
25
|
# ion).
|
@@ -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.
|