square.rb 6.4.0.20200923 → 6.5.0.20201028
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -30
- data/lib/square.rb +61 -61
- data/lib/square/api/apple_pay_api.rb +3 -1
- data/lib/square/api/bank_accounts_api.rb +12 -15
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/cash_drawers_api.rb +11 -5
- data/lib/square/api/catalog_api.rb +47 -25
- data/lib/square/api/checkout_api.rb +4 -2
- data/lib/square/api/customer_groups_api.rb +18 -8
- data/lib/square/api/customer_segments_api.rb +7 -3
- data/lib/square/api/customers_api.rb +47 -27
- data/lib/square/api/devices_api.rb +17 -6
- data/lib/square/api/disputes_api.rb +37 -19
- data/lib/square/api/employees_api.rb +7 -3
- data/lib/square/api/inventory_api.rb +25 -11
- data/lib/square/api/invoices_api.rb +29 -13
- data/lib/square/api/labor_api.rb +57 -25
- data/lib/square/api/locations_api.rb +16 -13
- data/lib/square/api/loyalty_api.rb +59 -65
- data/lib/square/api/merchants_api.rb +7 -3
- data/lib/square/api/mobile_authorization_api.rb +3 -1
- data/lib/square/api/o_auth_api.rb +10 -4
- data/lib/square/api/orders_api.rb +55 -8
- data/lib/square/api/payments_api.rb +68 -55
- data/lib/square/api/refunds_api.rb +12 -6
- data/lib/square/api/subscriptions_api.rb +22 -10
- data/lib/square/api/team_api.rb +32 -16
- data/lib/square/api/terminal_api.rb +156 -7
- data/lib/square/api/transactions_api.rb +32 -18
- data/lib/square/api/v1_employees_api.rb +59 -27
- data/lib/square/api/v1_items_api.rb +195 -115
- data/lib/square/api/v1_locations_api.rb +6 -2
- data/lib/square/api/v1_transactions_api.rb +49 -27
- data/lib/square/api_helper.rb +14 -9
- data/lib/square/client.rb +2 -2
- data/lib/square/configuration.rb +1 -1
- data/lib/square/http/api_response.rb +2 -0
- data/lib/square/http/faraday_client.rb +1 -0
- data/spec/user_journey_spec.rb +2 -5
- data/test/api/test_locations_api.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e89b291628ca9e34dd317c1cabd319b96d3e7861de70eb8e9b1e006f521bd9e7
|
4
|
+
data.tar.gz: 316cd50188c224693b87df34043991a7cea712cfdc22814d08b90268924bd85b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d3b58b7592ba99f662b7e6601f9eee48535fa61a5009c159d05a21080e75b5af4f182ba7907e6350830400790fcd802531a62b5130da19392e95e6c8af9322f
|
7
|
+
data.tar.gz: abf4ab1de91013ea370e77fa7186a2f9436831b2611d6bc574d1c1401c6f2d99676c5984c37a5024f5bbd231799b4d4a599bdc43b00557a213f8191a7039cc65
|
data/README.md
CHANGED
@@ -280,38 +280,39 @@ The Square Platform is built on the [Square API]. Square has a number of other S
|
|
280
280
|
|
281
281
|
You can also use the Square API to create applications or services that work with payments, orders, inventory, etc. that have been created and managed in Square’s in-person hardware products (Square Point of Sale and Square Register).
|
282
282
|
|
283
|
+
[//]: # "Link anchor definitions"
|
283
284
|
[Square Logo]: https://docs.connect.squareup.com/images/github/github-square-logo.svg
|
284
285
|
[Developer Dashboard]: https://developer.squareup.com/apps
|
285
286
|
[Square API]: https://squareup.com/developers
|
286
287
|
[sign up for a developer account]: https://squareup.com/signup?v=developers
|
287
288
|
[Client]: doc/client.md
|
288
|
-
[Devices]: doc/devices.md
|
289
|
-
[Disputes]: doc/disputes.md
|
290
|
-
[Terminal]: doc/terminal.md
|
291
|
-
[Team]: doc/team.md
|
292
|
-
[Cash Drawers]: doc/cash-drawers.md
|
293
|
-
[Customer Groups]: doc/customer-groups.md
|
294
|
-
[Customer Segments]: doc/customer-segments.md
|
295
|
-
[Bank Accounts]: doc/bank-accounts
|
296
|
-
[Payments]: doc/payments.md
|
297
|
-
[Checkout]: doc/checkout.md
|
298
|
-
[Catalog]: doc/catalog.md
|
299
|
-
[Customers]: doc/customers.md
|
300
|
-
[Employees]: doc/employees.md
|
301
|
-
[Inventory]: doc/inventory.md
|
302
|
-
[Labor]: doc/labor.md
|
303
|
-
[Loyalty]: doc/loyalty.md
|
304
|
-
[Locations]: doc/locations.md
|
305
|
-
[Merchants]: doc/merchants.md
|
306
|
-
[Orders]: doc/orders.md
|
307
|
-
[Invoices]: doc/invoices.md
|
308
|
-
[Apple Pay]: doc/apple-pay.md
|
309
|
-
[Refunds]: doc/refunds.md
|
310
|
-
[
|
311
|
-
[
|
312
|
-
[
|
313
|
-
[V1
|
314
|
-
[V1
|
315
|
-
[V1
|
316
|
-
[
|
317
|
-
[
|
289
|
+
[Devices]: doc/apis/devices.md
|
290
|
+
[Disputes]: doc/apis/disputes.md
|
291
|
+
[Terminal]: doc/apis/terminal.md
|
292
|
+
[Team]: doc/apis/team.md
|
293
|
+
[Cash Drawers]: doc/apis/cash-drawers.md
|
294
|
+
[Customer Groups]: doc/apis/customer-groups.md
|
295
|
+
[Customer Segments]: doc/apis/customer-segments.md
|
296
|
+
[Bank Accounts]: doc/apis/bank-accounts
|
297
|
+
[Payments]: doc/apis/payments.md
|
298
|
+
[Checkout]: doc/apis/checkout.md
|
299
|
+
[Catalog]: doc/apis/catalog.md
|
300
|
+
[Customers]: doc/apis/customers.md
|
301
|
+
[Employees]: doc/apis/employees.md
|
302
|
+
[Inventory]: doc/apis/inventory.md
|
303
|
+
[Labor]: doc/apis/labor.md
|
304
|
+
[Loyalty]: doc/apis/loyalty.md
|
305
|
+
[Locations]: doc/apis/locations.md
|
306
|
+
[Merchants]: doc/apis/merchants.md
|
307
|
+
[Orders]: doc/apis/orders.md
|
308
|
+
[Invoices]: doc/apis/invoices.md
|
309
|
+
[Apple Pay]: doc/apis/apple-pay.md
|
310
|
+
[Refunds]: doc/apis/refunds.md
|
311
|
+
[Subscriptions]: doc/apis/subscriptions.md
|
312
|
+
[Mobile Authorization]: doc/apis/mobile-authorization.md
|
313
|
+
[O Auth]: doc/apis/o-auth.md
|
314
|
+
[V1 Locations]: doc/apis/v1-locations.md
|
315
|
+
[V1 Employees]: doc/apis/v1-employees.md
|
316
|
+
[V1 Transactions]: doc/apis/v1-transactions.md
|
317
|
+
[V1 Items]: doc/apis/v1-items.md
|
318
|
+
[Transactions]: doc/apis/transactions.md
|
data/lib/square.rb
CHANGED
@@ -1,61 +1,61 @@
|
|
1
|
-
require 'date'
|
2
|
-
require 'json'
|
3
|
-
require 'faraday'
|
4
|
-
require 'certifi'
|
5
|
-
require 'logging'
|
6
|
-
|
7
|
-
require_relative 'square/api_helper.rb'
|
8
|
-
require_relative 'square/client.rb'
|
9
|
-
|
10
|
-
# Utilities
|
11
|
-
require_relative 'square/utilities/file_wrapper.rb'
|
12
|
-
|
13
|
-
# Http
|
14
|
-
require_relative 'square/http/api_response.rb'
|
15
|
-
require_relative 'square/http/http_call_back.rb'
|
16
|
-
require_relative 'square/http/http_client.rb'
|
17
|
-
require_relative 'square/http/faraday_client.rb'
|
18
|
-
require_relative 'square/http/http_method_enum.rb'
|
19
|
-
require_relative 'square/http/http_request.rb'
|
20
|
-
require_relative 'square/http/http_response.rb'
|
21
|
-
require_relative 'square/http/auth/o_auth2.rb'
|
22
|
-
|
23
|
-
# Models
|
24
|
-
|
25
|
-
# Exceptions
|
26
|
-
require_relative 'square/exceptions/api_exception.rb'
|
27
|
-
|
28
|
-
require_relative 'square/configuration.rb'
|
29
|
-
|
30
|
-
# Controllers
|
31
|
-
require_relative 'square/api/base_api.rb'
|
32
|
-
require_relative 'square/api/mobile_authorization_api.rb'
|
33
|
-
require_relative 'square/api/o_auth_api.rb'
|
34
|
-
require_relative 'square/api/v1_locations_api.rb'
|
35
|
-
require_relative 'square/api/v1_employees_api.rb'
|
36
|
-
require_relative 'square/api/v1_transactions_api.rb'
|
37
|
-
require_relative 'square/api/v1_items_api.rb'
|
38
|
-
require_relative 'square/api/apple_pay_api.rb'
|
39
|
-
require_relative 'square/api/bank_accounts_api.rb'
|
40
|
-
require_relative 'square/api/cash_drawers_api.rb'
|
41
|
-
require_relative 'square/api/catalog_api.rb'
|
42
|
-
require_relative 'square/api/customers_api.rb'
|
43
|
-
require_relative 'square/api/customer_groups_api.rb'
|
44
|
-
require_relative 'square/api/customer_segments_api.rb'
|
45
|
-
require_relative 'square/api/devices_api.rb'
|
46
|
-
require_relative 'square/api/disputes_api.rb'
|
47
|
-
require_relative 'square/api/employees_api.rb'
|
48
|
-
require_relative 'square/api/inventory_api.rb'
|
49
|
-
require_relative 'square/api/invoices_api.rb'
|
50
|
-
require_relative 'square/api/labor_api.rb'
|
51
|
-
require_relative 'square/api/locations_api.rb'
|
52
|
-
require_relative 'square/api/checkout_api.rb'
|
53
|
-
require_relative 'square/api/transactions_api.rb'
|
54
|
-
require_relative 'square/api/loyalty_api.rb'
|
55
|
-
require_relative 'square/api/merchants_api.rb'
|
56
|
-
require_relative 'square/api/orders_api.rb'
|
57
|
-
require_relative 'square/api/payments_api.rb'
|
58
|
-
require_relative 'square/api/refunds_api.rb'
|
59
|
-
require_relative 'square/api/subscriptions_api.rb'
|
60
|
-
require_relative 'square/api/team_api.rb'
|
61
|
-
require_relative 'square/api/terminal_api.rb'
|
1
|
+
require 'date'
|
2
|
+
require 'json'
|
3
|
+
require 'faraday'
|
4
|
+
require 'certifi'
|
5
|
+
require 'logging'
|
6
|
+
|
7
|
+
require_relative 'square/api_helper.rb'
|
8
|
+
require_relative 'square/client.rb'
|
9
|
+
|
10
|
+
# Utilities
|
11
|
+
require_relative 'square/utilities/file_wrapper.rb'
|
12
|
+
|
13
|
+
# Http
|
14
|
+
require_relative 'square/http/api_response.rb'
|
15
|
+
require_relative 'square/http/http_call_back.rb'
|
16
|
+
require_relative 'square/http/http_client.rb'
|
17
|
+
require_relative 'square/http/faraday_client.rb'
|
18
|
+
require_relative 'square/http/http_method_enum.rb'
|
19
|
+
require_relative 'square/http/http_request.rb'
|
20
|
+
require_relative 'square/http/http_response.rb'
|
21
|
+
require_relative 'square/http/auth/o_auth2.rb'
|
22
|
+
|
23
|
+
# Models
|
24
|
+
|
25
|
+
# Exceptions
|
26
|
+
require_relative 'square/exceptions/api_exception.rb'
|
27
|
+
|
28
|
+
require_relative 'square/configuration.rb'
|
29
|
+
|
30
|
+
# Controllers
|
31
|
+
require_relative 'square/api/base_api.rb'
|
32
|
+
require_relative 'square/api/mobile_authorization_api.rb'
|
33
|
+
require_relative 'square/api/o_auth_api.rb'
|
34
|
+
require_relative 'square/api/v1_locations_api.rb'
|
35
|
+
require_relative 'square/api/v1_employees_api.rb'
|
36
|
+
require_relative 'square/api/v1_transactions_api.rb'
|
37
|
+
require_relative 'square/api/v1_items_api.rb'
|
38
|
+
require_relative 'square/api/apple_pay_api.rb'
|
39
|
+
require_relative 'square/api/bank_accounts_api.rb'
|
40
|
+
require_relative 'square/api/cash_drawers_api.rb'
|
41
|
+
require_relative 'square/api/catalog_api.rb'
|
42
|
+
require_relative 'square/api/customers_api.rb'
|
43
|
+
require_relative 'square/api/customer_groups_api.rb'
|
44
|
+
require_relative 'square/api/customer_segments_api.rb'
|
45
|
+
require_relative 'square/api/devices_api.rb'
|
46
|
+
require_relative 'square/api/disputes_api.rb'
|
47
|
+
require_relative 'square/api/employees_api.rb'
|
48
|
+
require_relative 'square/api/inventory_api.rb'
|
49
|
+
require_relative 'square/api/invoices_api.rb'
|
50
|
+
require_relative 'square/api/labor_api.rb'
|
51
|
+
require_relative 'square/api/locations_api.rb'
|
52
|
+
require_relative 'square/api/checkout_api.rb'
|
53
|
+
require_relative 'square/api/transactions_api.rb'
|
54
|
+
require_relative 'square/api/loyalty_api.rb'
|
55
|
+
require_relative 'square/api/merchants_api.rb'
|
56
|
+
require_relative 'square/api/orders_api.rb'
|
57
|
+
require_relative 'square/api/payments_api.rb'
|
58
|
+
require_relative 'square/api/refunds_api.rb'
|
59
|
+
require_relative 'square/api/subscriptions_api.rb'
|
60
|
+
require_relative 'square/api/team_api.rb'
|
61
|
+
require_relative 'square/api/terminal_api.rb'
|
@@ -44,7 +44,9 @@ 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
|
end
|
50
52
|
end
|
@@ -7,9 +7,6 @@ module Square
|
|
7
7
|
|
8
8
|
# Returns a list of [BankAccount](#type-bankaccount) objects linked to a
|
9
9
|
# Square account.
|
10
|
-
# For more information, see
|
11
|
-
# [Bank Accounts
|
12
|
-
# API](https://developer.squareup.com/docs/docs/bank-accounts-api).
|
13
10
|
# @param [String] cursor Optional parameter: The pagination cursor returned
|
14
11
|
# by a previous call to this endpoint. Use it in the next `ListBankAccounts`
|
15
12
|
# request to retrieve the next set of results. See the
|
@@ -53,15 +50,13 @@ module Square
|
|
53
50
|
# Return appropriate response type.
|
54
51
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
55
52
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
56
|
-
ApiResponse.new(
|
53
|
+
ApiResponse.new(
|
54
|
+
_response, data: decoded, errors: _errors
|
55
|
+
)
|
57
56
|
end
|
58
57
|
|
59
58
|
# Returns details of a [BankAccount](#type-bankaccount) identified by V1
|
60
59
|
# bank account ID.
|
61
|
-
# For more information, see
|
62
|
-
# [Retrieve a bank account by using an ID issued by V1 Bank Accounts
|
63
|
-
# API](https://developer.squareup.com/docs/docs/bank-accounts-api#retrieve-a
|
64
|
-
# -bank-account-by-using-an-id-issued-by-the-v1-bank-accounts-api).
|
65
60
|
# @param [String] v1_bank_account_id Required parameter: Connect V1 ID of
|
66
61
|
# the desired `BankAccount`. For more information, see [Retrieve a bank
|
67
62
|
# account by using an ID issued by V1 Bank Accounts
|
@@ -74,7 +69,7 @@ module Square
|
|
74
69
|
_query_builder << '/v2/bank-accounts/by-v1-id/{v1_bank_account_id}'
|
75
70
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
76
71
|
_query_builder,
|
77
|
-
'v1_bank_account_id' => v1_bank_account_id
|
72
|
+
'v1_bank_account_id' => { 'value' => v1_bank_account_id, 'encode' => true }
|
78
73
|
)
|
79
74
|
_query_url = APIHelper.clean_url _query_builder
|
80
75
|
|
@@ -94,13 +89,13 @@ module Square
|
|
94
89
|
# Return appropriate response type.
|
95
90
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
96
91
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
97
|
-
ApiResponse.new(
|
92
|
+
ApiResponse.new(
|
93
|
+
_response, data: decoded, errors: _errors
|
94
|
+
)
|
98
95
|
end
|
99
96
|
|
100
97
|
# Returns details of a [BankAccount](#type-bankaccount)
|
101
|
-
# linked to a Square account.
|
102
|
-
# [Bank Accounts
|
103
|
-
# API](https://developer.squareup.com/docs/docs/bank-accounts-api).
|
98
|
+
# linked to a Square account.
|
104
99
|
# @param [String] bank_account_id Required parameter: Square-issued ID of
|
105
100
|
# the desired `BankAccount`.
|
106
101
|
# @return [GetBankAccountResponse Hash] response from the API call
|
@@ -110,7 +105,7 @@ module Square
|
|
110
105
|
_query_builder << '/v2/bank-accounts/{bank_account_id}'
|
111
106
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
112
107
|
_query_builder,
|
113
|
-
'bank_account_id' => bank_account_id
|
108
|
+
'bank_account_id' => { 'value' => bank_account_id, 'encode' => true }
|
114
109
|
)
|
115
110
|
_query_url = APIHelper.clean_url _query_builder
|
116
111
|
|
@@ -130,7 +125,9 @@ module Square
|
|
130
125
|
# Return appropriate response type.
|
131
126
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
132
127
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
133
|
-
ApiResponse.new(
|
128
|
+
ApiResponse.new(
|
129
|
+
_response, data: decoded, errors: _errors
|
130
|
+
)
|
134
131
|
end
|
135
132
|
end
|
136
133
|
end
|
data/lib/square/api/base_api.rb
CHANGED
@@ -57,7 +57,9 @@ module Square
|
|
57
57
|
# Return appropriate response type.
|
58
58
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
59
59
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
60
|
-
ApiResponse.new(
|
60
|
+
ApiResponse.new(
|
61
|
+
_response, data: decoded, errors: _errors
|
62
|
+
)
|
61
63
|
end
|
62
64
|
|
63
65
|
# Provides the summary details for a single cash drawer shift. See
|
@@ -73,7 +75,7 @@ module Square
|
|
73
75
|
_query_builder << '/v2/cash-drawers/shifts/{shift_id}'
|
74
76
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
75
77
|
_query_builder,
|
76
|
-
'shift_id' => shift_id
|
78
|
+
'shift_id' => { 'value' => shift_id, 'encode' => true }
|
77
79
|
)
|
78
80
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
79
81
|
_query_builder,
|
@@ -97,7 +99,9 @@ module Square
|
|
97
99
|
# Return appropriate response type.
|
98
100
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
99
101
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
100
|
-
ApiResponse.new(
|
102
|
+
ApiResponse.new(
|
103
|
+
_response, data: decoded, errors: _errors
|
104
|
+
)
|
101
105
|
end
|
102
106
|
|
103
107
|
# Provides a paginated list of events for a single cash drawer shift.
|
@@ -118,7 +122,7 @@ module Square
|
|
118
122
|
_query_builder << '/v2/cash-drawers/shifts/{shift_id}/events'
|
119
123
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
120
124
|
_query_builder,
|
121
|
-
'shift_id' => shift_id
|
125
|
+
'shift_id' => { 'value' => shift_id, 'encode' => true }
|
122
126
|
)
|
123
127
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
124
128
|
_query_builder,
|
@@ -144,7 +148,9 @@ module Square
|
|
144
148
|
# Return appropriate response type.
|
145
149
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
146
150
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
147
|
-
ApiResponse.new(
|
151
|
+
ApiResponse.new(
|
152
|
+
_response, data: decoded, errors: _errors
|
153
|
+
)
|
148
154
|
end
|
149
155
|
end
|
150
156
|
end
|
@@ -44,7 +44,9 @@ 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.
|
@@ -83,7 +85,9 @@ module Square
|
|
83
85
|
# Return appropriate response type.
|
84
86
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
85
87
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
86
|
-
ApiResponse.new(
|
88
|
+
ApiResponse.new(
|
89
|
+
_response, data: decoded, errors: _errors
|
90
|
+
)
|
87
91
|
end
|
88
92
|
|
89
93
|
# Creates or updates up to 10,000 target objects based on the provided
|
@@ -128,10 +132,12 @@ module Square
|
|
128
132
|
# Return appropriate response type.
|
129
133
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
130
134
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
131
|
-
ApiResponse.new(
|
135
|
+
ApiResponse.new(
|
136
|
+
_response, data: decoded, errors: _errors
|
137
|
+
)
|
132
138
|
end
|
133
139
|
|
134
|
-
# Uploads an image file to be represented by
|
140
|
+
# Uploads an image file to be represented by a
|
135
141
|
# [CatalogImage](#type-catalogimage) object linked to an existing
|
136
142
|
# [CatalogObject](#type-catalogobject) instance. A call to this endpoint can
|
137
143
|
# upload an image, link an image to
|
@@ -139,10 +145,6 @@ module Square
|
|
139
145
|
# This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data
|
140
146
|
# requests with a JSON part and an image file part in
|
141
147
|
# 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
148
|
# @param [CreateCatalogImageRequest] request Optional parameter: Example:
|
147
149
|
# @param [File | UploadIO] image_file Optional parameter: Example:
|
148
150
|
# @return [CreateCatalogImageResponse Hash] response from the API call
|
@@ -191,7 +193,9 @@ module Square
|
|
191
193
|
# Return appropriate response type.
|
192
194
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
193
195
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
194
|
-
ApiResponse.new(
|
196
|
+
ApiResponse.new(
|
197
|
+
_response, data: decoded, errors: _errors
|
198
|
+
)
|
195
199
|
end
|
196
200
|
|
197
201
|
# Retrieves information about the Square Catalog API, such as batch size
|
@@ -219,7 +223,9 @@ module Square
|
|
219
223
|
# Return appropriate response type.
|
220
224
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
221
225
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
222
|
-
ApiResponse.new(
|
226
|
+
ApiResponse.new(
|
227
|
+
_response, data: decoded, errors: _errors
|
228
|
+
)
|
223
229
|
end
|
224
230
|
|
225
231
|
# Returns a list of [CatalogObject](#type-catalogobject)s that includes
|
@@ -274,7 +280,9 @@ module Square
|
|
274
280
|
# Return appropriate response type.
|
275
281
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
276
282
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
277
|
-
ApiResponse.new(
|
283
|
+
ApiResponse.new(
|
284
|
+
_response, data: decoded, errors: _errors
|
285
|
+
)
|
278
286
|
end
|
279
287
|
|
280
288
|
# Creates or updates the target [CatalogObject](#type-catalogobject).
|
@@ -306,7 +314,9 @@ module Square
|
|
306
314
|
# Return appropriate response type.
|
307
315
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
308
316
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
309
|
-
ApiResponse.new(
|
317
|
+
ApiResponse.new(
|
318
|
+
_response, data: decoded, errors: _errors
|
319
|
+
)
|
310
320
|
end
|
311
321
|
|
312
322
|
# Deletes a single [CatalogObject](#type-catalogobject) based on the
|
@@ -328,7 +338,7 @@ module Square
|
|
328
338
|
_query_builder << '/v2/catalog/object/{object_id}'
|
329
339
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
330
340
|
_query_builder,
|
331
|
-
'object_id' => object_id
|
341
|
+
'object_id' => { 'value' => object_id, 'encode' => true }
|
332
342
|
)
|
333
343
|
_query_url = APIHelper.clean_url _query_builder
|
334
344
|
|
@@ -348,7 +358,9 @@ module Square
|
|
348
358
|
# Return appropriate response type.
|
349
359
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
350
360
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
351
|
-
ApiResponse.new(
|
361
|
+
ApiResponse.new(
|
362
|
+
_response, data: decoded, errors: _errors
|
363
|
+
)
|
352
364
|
end
|
353
365
|
|
354
366
|
# Returns a single [CatalogItem](#type-catalogitem) as a
|
@@ -364,12 +376,12 @@ module Square
|
|
364
376
|
# @param [Boolean] include_related_objects Optional parameter: If `true`,
|
365
377
|
# the response will include additional objects that are related to the
|
366
378
|
# requested object, as follows: If the `object` field of the response
|
367
|
-
# contains a CatalogItem
|
368
|
-
#
|
379
|
+
# contains a `CatalogItem`, its associated `CatalogCategory`, `CatalogTax`,
|
380
|
+
# `CatalogImage` and `CatalogModifierList` objects will be returned in the
|
369
381
|
# `related_objects` field of the response. If the `object` field of the
|
370
|
-
# response contains a CatalogItemVariation
|
371
|
-
# returned in the `related_objects` field of the response. Default
|
372
|
-
# `false`
|
382
|
+
# response contains a `CatalogItemVariation`, its parent `CatalogItem` will
|
383
|
+
# be returned in the `related_objects` field of the response. Default
|
384
|
+
# value: `false`
|
373
385
|
# @return [RetrieveCatalogObjectResponse Hash] response from the API call
|
374
386
|
def retrieve_catalog_object(object_id:,
|
375
387
|
include_related_objects: false)
|
@@ -378,7 +390,7 @@ module Square
|
|
378
390
|
_query_builder << '/v2/catalog/object/{object_id}'
|
379
391
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
380
392
|
_query_builder,
|
381
|
-
'object_id' => object_id
|
393
|
+
'object_id' => { 'value' => object_id, 'encode' => true }
|
382
394
|
)
|
383
395
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
384
396
|
_query_builder,
|
@@ -402,7 +414,9 @@ module Square
|
|
402
414
|
# Return appropriate response type.
|
403
415
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
404
416
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
405
|
-
ApiResponse.new(
|
417
|
+
ApiResponse.new(
|
418
|
+
_response, data: decoded, errors: _errors
|
419
|
+
)
|
406
420
|
end
|
407
421
|
|
408
422
|
# Searches for [CatalogObject](#type-CatalogObject) of any types against
|
@@ -450,7 +464,9 @@ module Square
|
|
450
464
|
# Return appropriate response type.
|
451
465
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
452
466
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
453
|
-
ApiResponse.new(
|
467
|
+
ApiResponse.new(
|
468
|
+
_response, data: decoded, errors: _errors
|
469
|
+
)
|
454
470
|
end
|
455
471
|
|
456
472
|
# Searches for catalog items or item variations by matching supported search
|
@@ -498,7 +514,9 @@ module Square
|
|
498
514
|
# Return appropriate response type.
|
499
515
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
500
516
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
501
|
-
ApiResponse.new(
|
517
|
+
ApiResponse.new(
|
518
|
+
_response, data: decoded, errors: _errors
|
519
|
+
)
|
502
520
|
end
|
503
521
|
|
504
522
|
# Updates the [CatalogModifierList](#type-catalogmodifierlist) objects
|
@@ -532,7 +550,9 @@ module Square
|
|
532
550
|
# Return appropriate response type.
|
533
551
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
534
552
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
535
|
-
ApiResponse.new(
|
553
|
+
ApiResponse.new(
|
554
|
+
_response, data: decoded, errors: _errors
|
555
|
+
)
|
536
556
|
end
|
537
557
|
|
538
558
|
# Updates the [CatalogTax](#type-catalogtax) objects that apply to the
|
@@ -566,7 +586,9 @@ module Square
|
|
566
586
|
# Return appropriate response type.
|
567
587
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
568
588
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
569
|
-
ApiResponse.new(
|
589
|
+
ApiResponse.new(
|
590
|
+
_response, data: decoded, errors: _errors
|
591
|
+
)
|
570
592
|
end
|
571
593
|
end
|
572
594
|
end
|