square.rb 18.1.0.20220316 → 20.1.0.20220616
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/README.md +6 -0
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/bookings_api.rb +9 -0
- data/lib/square/api/catalog_api.rb +3 -3
- data/lib/square/api/checkout_api.rb +202 -0
- data/lib/square/api/customer_custom_attributes_api.rb +540 -0
- data/lib/square/api/gift_card_activities_api.rb +5 -6
- data/lib/square/api/gift_cards_api.rb +8 -7
- data/lib/square/api/locations_api.rb +3 -4
- data/lib/square/api/loyalty_api.rb +3 -2
- data/lib/square/api/orders_api.rb +2 -2
- data/lib/square/api/payouts_api.rb +173 -0
- data/lib/square/api/subscriptions_api.rb +0 -3
- data/lib/square/api/terminal_api.rb +155 -6
- data/lib/square/client.rb +19 -6
- data/lib/square/configuration.rb +17 -11
- data/lib/square/http/api_response.rb +7 -9
- data/lib/square/http/faraday_client.rb +19 -9
- data/lib/square/http/http_client.rb +31 -12
- data/lib/square/http/http_request.rb +6 -2
- data/lib/square.rb +2 -0
- metadata +52 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68c3c60d1b69c141d163be8e453c91bd76cca35f98228aeae4a41f7b61afe8a6
|
4
|
+
data.tar.gz: 3df6c78f8e6e493967624fca0cd804c1547aa6ccfb2b57daaac05695a33df12d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab11afe945aa6630b158b07040290572d591b15e2d0829363dd334fc38f5197cc2d5eed47a36cf84e68061667d91b874486892da5acebb4f25420b8bec6e190b
|
7
|
+
data.tar.gz: 3427cb9920daac7363c982754ab7a5c8ef1abf609786e9c8b2bb4a6a4f82da77a2b05e9d7758d71c86613ef8dc54536ea44b9c9f9eed44576d90272121327b67
|
data/README.md
CHANGED
@@ -62,6 +62,7 @@ rake
|
|
62
62
|
* [Checkout]
|
63
63
|
* [Apple Pay]
|
64
64
|
* [Cards]
|
65
|
+
* [Payouts]
|
65
66
|
|
66
67
|
### Terminal
|
67
68
|
* [Terminal]
|
@@ -81,6 +82,7 @@ rake
|
|
81
82
|
|
82
83
|
### Customers
|
83
84
|
* [Customers]
|
85
|
+
* [Customer Custom Attributes]
|
84
86
|
* [Customer Groups]
|
85
87
|
* [Customer Segments]
|
86
88
|
|
@@ -99,6 +101,7 @@ rake
|
|
99
101
|
* [Locations]
|
100
102
|
* [Devices]
|
101
103
|
* [Cash Drawers]
|
104
|
+
* [Vendors]
|
102
105
|
|
103
106
|
### Team
|
104
107
|
* [Team]
|
@@ -134,6 +137,7 @@ rake
|
|
134
137
|
[Terminal]: doc/api/terminal.md
|
135
138
|
[Team]: doc/api/team.md
|
136
139
|
[Cash Drawers]: doc/api/cash-drawers.md
|
140
|
+
[Vendors]: doc/api/vendors.md
|
137
141
|
[Customer Groups]: doc/api/customer-groups.md
|
138
142
|
[Customer Segments]: doc/api/customer-segments.md
|
139
143
|
[Bank Accounts]: doc/api/bank-accounts.md
|
@@ -141,6 +145,7 @@ rake
|
|
141
145
|
[Checkout]: doc/api/checkout.md
|
142
146
|
[Catalog]: doc/api/catalog.md
|
143
147
|
[Customers]: doc/api/customers.md
|
148
|
+
[Customer Custom Attributes]: doc/api/customer-custom-attributes.md
|
144
149
|
[Employees]: doc/api/employees.md
|
145
150
|
[Inventory]: doc/api/inventory.md
|
146
151
|
[Labor]: doc/api/labor.md
|
@@ -162,5 +167,6 @@ rake
|
|
162
167
|
[Sites]: doc/api/sites.md
|
163
168
|
[Snippets]: doc/api/snippets.md
|
164
169
|
[Cards]: doc/api/cards.md
|
170
|
+
[Payouts]: doc/api/payouts.md
|
165
171
|
[Gift Cards]: doc/api/gift-cards.md
|
166
172
|
[Gift Card Activities]: doc/api/gift-card-activities.md
|
data/lib/square/api/base_api.rb
CHANGED
@@ -38,7 +38,7 @@ module Square
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def get_user_agent
|
41
|
-
user_agent = 'Square-Ruby-SDK/
|
41
|
+
user_agent = 'Square-Ruby-SDK/20.1.0.20220616 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
|
42
42
|
user_agent['{engine}'] = RUBY_ENGINE
|
43
43
|
user_agent['{engine-version}'] = RUBY_ENGINE_VERSION
|
44
44
|
user_agent['{os-info}'] = RUBY_PLATFORM
|
@@ -74,6 +74,9 @@ module Square
|
|
74
74
|
# `APPOINTMENTS_WRITE` for the OAuth scope.
|
75
75
|
# To call this endpoint with seller-level permissions, set
|
76
76
|
# `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
|
77
|
+
# For calls to this endpoint with seller-level permissions to succeed, the
|
78
|
+
# seller must have subscribed to *Appointments Plus*
|
79
|
+
# or *Appointments Premium*.
|
77
80
|
# @param [CreateBookingRequest] body Required parameter: An object
|
78
81
|
# containing the fields to POST for the request. See the corresponding
|
79
82
|
# object definition for field details.
|
@@ -303,6 +306,9 @@ module Square
|
|
303
306
|
# `APPOINTMENTS_WRITE` for the OAuth scope.
|
304
307
|
# To call this endpoint with seller-level permissions, set
|
305
308
|
# `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
|
309
|
+
# For calls to this endpoint with seller-level permissions to succeed, the
|
310
|
+
# seller must have subscribed to *Appointments Plus*
|
311
|
+
# or *Appointments Premium*.
|
306
312
|
# @param [String] booking_id Required parameter: The ID of the
|
307
313
|
# [Booking]($m/Booking) object representing the to-be-updated booking.
|
308
314
|
# @param [UpdateBookingRequest] body Required parameter: An object
|
@@ -348,6 +354,9 @@ module Square
|
|
348
354
|
# `APPOINTMENTS_WRITE` for the OAuth scope.
|
349
355
|
# To call this endpoint with seller-level permissions, set
|
350
356
|
# `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
|
357
|
+
# For calls to this endpoint with seller-level permissions to succeed, the
|
358
|
+
# seller must have subscribed to *Appointments Plus*
|
359
|
+
# or *Appointments Premium*.
|
351
360
|
# @param [String] booking_id Required parameter: The ID of the
|
352
361
|
# [Booking]($m/Booking) object representing the to-be-cancelled booking.
|
353
362
|
# @param [CancelBookingRequest] body Required parameter: An object
|
@@ -316,9 +316,9 @@ module Square
|
|
316
316
|
# Square API used to make the request. Object types that are nested onto
|
317
317
|
# other object types are not included in the defaults. At the current API
|
318
318
|
# version the default object types are: ITEM, CATEGORY, TAX, DISCOUNT,
|
319
|
-
# MODIFIER_LIST,
|
320
|
-
#
|
321
|
-
#
|
319
|
+
# MODIFIER_LIST, PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT,
|
320
|
+
# SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION,
|
321
|
+
# QUICK_AMOUNT_SETTINGS.
|
322
322
|
# @param [Long] catalog_version Optional parameter: The specific version of
|
323
323
|
# the catalog objects to be included in the response. This allows you to
|
324
324
|
# retrieve historical versions of objects. The specified version value is
|
@@ -8,6 +8,13 @@ module Square
|
|
8
8
|
# Links a `checkoutId` to a `checkout_page_url` that customers are
|
9
9
|
# directed to in order to provide their payment information using a
|
10
10
|
# payment processing workflow hosted on connect.squareup.com.
|
11
|
+
# NOTE: The Checkout API has been updated with new features.
|
12
|
+
# For more information, see [Checkout API
|
13
|
+
# highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-
|
14
|
+
# highlights).
|
15
|
+
# We recommend that you use the
|
16
|
+
# new [CreatePaymentLink]($e/Checkout/CreatePaymentLink)
|
17
|
+
# endpoint in place of this previously released endpoint.
|
11
18
|
# @param [String] location_id Required parameter: The ID of the business
|
12
19
|
# location to associate the checkout with.
|
13
20
|
# @param [CreateCheckoutRequest] body Required parameter: An object
|
@@ -47,5 +54,200 @@ module Square
|
|
47
54
|
_response, data: decoded, errors: _errors
|
48
55
|
)
|
49
56
|
end
|
57
|
+
|
58
|
+
# Lists all payment links.
|
59
|
+
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
60
|
+
# a previous call to this endpoint. Provide this cursor to retrieve the
|
61
|
+
# next set of results for the original query. If a cursor is not provided,
|
62
|
+
# the endpoint returns the first page of the results. For more
|
63
|
+
# information, see
|
64
|
+
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
65
|
+
# .
|
66
|
+
# @param [Integer] limit Optional parameter: A limit on the number of
|
67
|
+
# results to return per page. The limit is advisory and the implementation
|
68
|
+
# might return more or less results. If the supplied limit is negative,
|
69
|
+
# zero, or greater than the maximum limit of 1000, it is ignored. Default
|
70
|
+
# value: `100`
|
71
|
+
# @return [ListPaymentLinksResponse Hash] response from the API call
|
72
|
+
def list_payment_links(cursor: nil,
|
73
|
+
limit: nil)
|
74
|
+
# Prepare query url.
|
75
|
+
_query_builder = config.get_base_uri
|
76
|
+
_query_builder << '/v2/online-checkout/payment-links'
|
77
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
78
|
+
_query_builder,
|
79
|
+
'cursor' => cursor,
|
80
|
+
'limit' => limit
|
81
|
+
)
|
82
|
+
_query_url = APIHelper.clean_url _query_builder
|
83
|
+
|
84
|
+
# Prepare headers.
|
85
|
+
_headers = {
|
86
|
+
'accept' => 'application/json'
|
87
|
+
}
|
88
|
+
|
89
|
+
# Prepare and execute HttpRequest.
|
90
|
+
_request = config.http_client.get(
|
91
|
+
_query_url,
|
92
|
+
headers: _headers
|
93
|
+
)
|
94
|
+
OAuth2.apply(config, _request)
|
95
|
+
_response = execute_request(_request)
|
96
|
+
|
97
|
+
# Return appropriate response type.
|
98
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
99
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
100
|
+
ApiResponse.new(
|
101
|
+
_response, data: decoded, errors: _errors
|
102
|
+
)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Creates a Square-hosted checkout page. Applications can share the
|
106
|
+
# resulting payment link with their buyer to pay for goods and services.
|
107
|
+
# @param [CreatePaymentLinkRequest] body Required parameter: An object
|
108
|
+
# containing the fields to POST for the request. See the corresponding
|
109
|
+
# object definition for field details.
|
110
|
+
# @return [CreatePaymentLinkResponse Hash] response from the API call
|
111
|
+
def create_payment_link(body:)
|
112
|
+
# Prepare query url.
|
113
|
+
_query_builder = config.get_base_uri
|
114
|
+
_query_builder << '/v2/online-checkout/payment-links'
|
115
|
+
_query_url = APIHelper.clean_url _query_builder
|
116
|
+
|
117
|
+
# Prepare headers.
|
118
|
+
_headers = {
|
119
|
+
'accept' => 'application/json',
|
120
|
+
'Content-Type' => 'application/json'
|
121
|
+
}
|
122
|
+
|
123
|
+
# Prepare and execute HttpRequest.
|
124
|
+
_request = config.http_client.post(
|
125
|
+
_query_url,
|
126
|
+
headers: _headers,
|
127
|
+
parameters: body.to_json
|
128
|
+
)
|
129
|
+
OAuth2.apply(config, _request)
|
130
|
+
_response = execute_request(_request)
|
131
|
+
|
132
|
+
# Return appropriate response type.
|
133
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
134
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
135
|
+
ApiResponse.new(
|
136
|
+
_response, data: decoded, errors: _errors
|
137
|
+
)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Deletes a payment link.
|
141
|
+
# @param [String] id Required parameter: The ID of the payment link to
|
142
|
+
# delete.
|
143
|
+
# @return [DeletePaymentLinkResponse Hash] response from the API call
|
144
|
+
def delete_payment_link(id:)
|
145
|
+
# Prepare query url.
|
146
|
+
_query_builder = config.get_base_uri
|
147
|
+
_query_builder << '/v2/online-checkout/payment-links/{id}'
|
148
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
149
|
+
_query_builder,
|
150
|
+
'id' => { 'value' => id, 'encode' => true }
|
151
|
+
)
|
152
|
+
_query_url = APIHelper.clean_url _query_builder
|
153
|
+
|
154
|
+
# Prepare headers.
|
155
|
+
_headers = {
|
156
|
+
'accept' => 'application/json'
|
157
|
+
}
|
158
|
+
|
159
|
+
# Prepare and execute HttpRequest.
|
160
|
+
_request = config.http_client.delete(
|
161
|
+
_query_url,
|
162
|
+
headers: _headers
|
163
|
+
)
|
164
|
+
OAuth2.apply(config, _request)
|
165
|
+
_response = execute_request(_request)
|
166
|
+
|
167
|
+
# Return appropriate response type.
|
168
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
169
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
170
|
+
ApiResponse.new(
|
171
|
+
_response, data: decoded, errors: _errors
|
172
|
+
)
|
173
|
+
end
|
174
|
+
|
175
|
+
# Retrieves a payment link.
|
176
|
+
# @param [String] id Required parameter: The ID of link to retrieve.
|
177
|
+
# @return [RetrievePaymentLinkResponse Hash] response from the API call
|
178
|
+
def retrieve_payment_link(id:)
|
179
|
+
# Prepare query url.
|
180
|
+
_query_builder = config.get_base_uri
|
181
|
+
_query_builder << '/v2/online-checkout/payment-links/{id}'
|
182
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
183
|
+
_query_builder,
|
184
|
+
'id' => { 'value' => id, 'encode' => true }
|
185
|
+
)
|
186
|
+
_query_url = APIHelper.clean_url _query_builder
|
187
|
+
|
188
|
+
# Prepare headers.
|
189
|
+
_headers = {
|
190
|
+
'accept' => 'application/json'
|
191
|
+
}
|
192
|
+
|
193
|
+
# Prepare and execute HttpRequest.
|
194
|
+
_request = config.http_client.get(
|
195
|
+
_query_url,
|
196
|
+
headers: _headers
|
197
|
+
)
|
198
|
+
OAuth2.apply(config, _request)
|
199
|
+
_response = execute_request(_request)
|
200
|
+
|
201
|
+
# Return appropriate response type.
|
202
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
203
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
204
|
+
ApiResponse.new(
|
205
|
+
_response, data: decoded, errors: _errors
|
206
|
+
)
|
207
|
+
end
|
208
|
+
|
209
|
+
# Updates a payment link. You can update the `payment_link` fields such as
|
210
|
+
# `description`, `checkout_options`, and `pre_populated_data`.
|
211
|
+
# You cannot update other fields such as the `order_id`, `version`, `URL`,
|
212
|
+
# or `timestamp` field.
|
213
|
+
# @param [String] id Required parameter: The ID of the payment link to
|
214
|
+
# update.
|
215
|
+
# @param [UpdatePaymentLinkRequest] body Required parameter: An object
|
216
|
+
# containing the fields to POST for the request. See the corresponding
|
217
|
+
# object definition for field details.
|
218
|
+
# @return [UpdatePaymentLinkResponse Hash] response from the API call
|
219
|
+
def update_payment_link(id:,
|
220
|
+
body:)
|
221
|
+
# Prepare query url.
|
222
|
+
_query_builder = config.get_base_uri
|
223
|
+
_query_builder << '/v2/online-checkout/payment-links/{id}'
|
224
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
225
|
+
_query_builder,
|
226
|
+
'id' => { 'value' => id, 'encode' => true }
|
227
|
+
)
|
228
|
+
_query_url = APIHelper.clean_url _query_builder
|
229
|
+
|
230
|
+
# Prepare headers.
|
231
|
+
_headers = {
|
232
|
+
'accept' => 'application/json',
|
233
|
+
'Content-Type' => 'application/json'
|
234
|
+
}
|
235
|
+
|
236
|
+
# Prepare and execute HttpRequest.
|
237
|
+
_request = config.http_client.put(
|
238
|
+
_query_url,
|
239
|
+
headers: _headers,
|
240
|
+
parameters: body.to_json
|
241
|
+
)
|
242
|
+
OAuth2.apply(config, _request)
|
243
|
+
_response = execute_request(_request)
|
244
|
+
|
245
|
+
# Return appropriate response type.
|
246
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
247
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
248
|
+
ApiResponse.new(
|
249
|
+
_response, data: decoded, errors: _errors
|
250
|
+
)
|
251
|
+
end
|
50
252
|
end
|
51
253
|
end
|