square.rb 6.5.0.20201028 → 7.0.0.20201118
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -30
- data/lib/square.rb +1 -0
- data/lib/square/api/apple_pay_api.rb +2 -2
- data/lib/square/api/bank_accounts_api.rb +4 -4
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/bookings_api.rb +266 -0
- data/lib/square/api/cash_drawers_api.rb +2 -1
- data/lib/square/api/catalog_api.rb +3 -3
- data/lib/square/api/customer_segments_api.rb +2 -2
- data/lib/square/api/inventory_api.rb +2 -2
- data/lib/square/api/invoices_api.rb +2 -2
- data/lib/square/api/loyalty_api.rb +1 -1
- data/lib/square/api/mobile_authorization_api.rb +2 -2
- data/lib/square/api/o_auth_api.rb +1 -4
- data/lib/square/api/refunds_api.rb +20 -20
- data/lib/square/api/subscriptions_api.rb +4 -4
- data/lib/square/api/team_api.rb +14 -14
- data/lib/square/client.rb +8 -2
- data/lib/square/configuration.rb +2 -2
- data/lib/square/http/faraday_client.rb +8 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b369570f3d13e26bc325eb51c619e0beb0b102fcf2165e833772903161db7a9b
|
4
|
+
data.tar.gz: f085f244216551f94863464ec50c3ae2ca46520c2aad30082de005dd5a3a6153
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50996f5d00d2a7f52950fdf63ff3089bd70f90e523fcf588796bc0e3d07d08d298eee2444dc155e5abb6ed15f893e3181c8dd42d4e81c03fd8feaff623ef27fe
|
7
|
+
data.tar.gz: d59a431601b9ff93f851dc8c10413e4b121e5ba77c0c5d4c7bddd0492e0a57c2fbeafadae38c546b4b5a50b664674d3c31193ed344f74966a4399aba0211ef58
|
data/README.md
CHANGED
@@ -56,6 +56,9 @@ gem 'square.rb'
|
|
56
56
|
### Loyalty
|
57
57
|
* [Loyalty]
|
58
58
|
|
59
|
+
### Bookings
|
60
|
+
* [Bookings]
|
61
|
+
|
59
62
|
### Business
|
60
63
|
* [Merchants]
|
61
64
|
* [Locations]
|
@@ -286,33 +289,34 @@ You can also use the Square API to create applications or services that work wit
|
|
286
289
|
[Square API]: https://squareup.com/developers
|
287
290
|
[sign up for a developer account]: https://squareup.com/signup?v=developers
|
288
291
|
[Client]: doc/client.md
|
289
|
-
[Devices]: doc/
|
290
|
-
[Disputes]: doc/
|
291
|
-
[Terminal]: doc/
|
292
|
-
[Team]: doc/
|
293
|
-
[Cash Drawers]: doc/
|
294
|
-
[Customer Groups]: doc/
|
295
|
-
[Customer Segments]: doc/
|
296
|
-
[Bank Accounts]: doc/
|
297
|
-
[Payments]: doc/
|
298
|
-
[Checkout]: doc/
|
299
|
-
[Catalog]: doc/
|
300
|
-
[Customers]: doc/
|
301
|
-
[Employees]: doc/
|
302
|
-
[Inventory]: doc/
|
303
|
-
[Labor]: doc/
|
304
|
-
[Loyalty]: doc/
|
305
|
-
[
|
306
|
-
[
|
307
|
-
[
|
308
|
-
[
|
309
|
-
[
|
310
|
-
[
|
311
|
-
[
|
312
|
-
[
|
313
|
-
[
|
314
|
-
[
|
315
|
-
[V1
|
316
|
-
[V1
|
317
|
-
[V1
|
318
|
-
[
|
292
|
+
[Devices]: doc/api/devices.md
|
293
|
+
[Disputes]: doc/api/disputes.md
|
294
|
+
[Terminal]: doc/api/terminal.md
|
295
|
+
[Team]: doc/api/team.md
|
296
|
+
[Cash Drawers]: doc/api/cash-drawers.md
|
297
|
+
[Customer Groups]: doc/api/customer-groups.md
|
298
|
+
[Customer Segments]: doc/api/customer-segments.md
|
299
|
+
[Bank Accounts]: doc/api/bank-accounts
|
300
|
+
[Payments]: doc/api/payments.md
|
301
|
+
[Checkout]: doc/api/checkout.md
|
302
|
+
[Catalog]: doc/api/catalog.md
|
303
|
+
[Customers]: doc/api/customers.md
|
304
|
+
[Employees]: doc/api/employees.md
|
305
|
+
[Inventory]: doc/api/inventory.md
|
306
|
+
[Labor]: doc/api/labor.md
|
307
|
+
[Loyalty]: doc/api/loyalty.md
|
308
|
+
[Bookings]: doc/api/bookings.md
|
309
|
+
[Locations]: doc/api/locations.md
|
310
|
+
[Merchants]: doc/api/merchants.md
|
311
|
+
[Orders]: doc/api/orders.md
|
312
|
+
[Invoices]: doc/api/invoices.md
|
313
|
+
[Apple Pay]: doc/api/apple-pay.md
|
314
|
+
[Refunds]: doc/api/refunds.md
|
315
|
+
[Subscriptions]: doc/api/subscriptions.md
|
316
|
+
[Mobile Authorization]: doc/api/mobile-authorization.md
|
317
|
+
[O Auth]: doc/api/o-auth.md
|
318
|
+
[V1 Locations]: doc/api/v1-locations.md
|
319
|
+
[V1 Employees]: doc/api/v1-employees.md
|
320
|
+
[V1 Transactions]: doc/api/v1-transactions.md
|
321
|
+
[V1 Items]: doc/api/v1-items.md
|
322
|
+
[Transactions]: doc/api/transactions.md
|
data/lib/square.rb
CHANGED
@@ -37,6 +37,7 @@ require_relative 'square/api/v1_transactions_api.rb'
|
|
37
37
|
require_relative 'square/api/v1_items_api.rb'
|
38
38
|
require_relative 'square/api/apple_pay_api.rb'
|
39
39
|
require_relative 'square/api/bank_accounts_api.rb'
|
40
|
+
require_relative 'square/api/bookings_api.rb'
|
40
41
|
require_relative 'square/api/cash_drawers_api.rb'
|
41
42
|
require_relative 'square/api/catalog_api.rb'
|
42
43
|
require_relative 'square/api/customers_api.rb'
|
@@ -14,8 +14,8 @@ module Square
|
|
14
14
|
# Web Apple Pay with Square for merchants using their platform.
|
15
15
|
# To learn more about Apple Pay on Web see the Apple Pay section in the
|
16
16
|
# [Square Payment Form
|
17
|
-
# Walkthrough](https://developer.squareup.com/docs/
|
18
|
-
# -
|
17
|
+
# Walkthrough](https://developer.squareup.com/docs/payment-form/payment-form
|
18
|
+
# -walkthrough).
|
19
19
|
# @param [RegisterDomainRequest] body Required parameter: An object
|
20
20
|
# containing the fields to POST for the request. See the corresponding
|
21
21
|
# object definition for field details.
|
@@ -10,8 +10,8 @@ module Square
|
|
10
10
|
# @param [String] cursor Optional parameter: The pagination cursor returned
|
11
11
|
# by a previous call to this endpoint. Use it in the next `ListBankAccounts`
|
12
12
|
# request to retrieve the next set of results. See the
|
13
|
-
# [Pagination](https://developer.squareup.com/docs/
|
14
|
-
#
|
13
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
14
|
+
# ion) guide for more information.
|
15
15
|
# @param [Integer] limit Optional parameter: Upper limit on the number of
|
16
16
|
# bank accounts to return in the response. Currently, 1000 is the largest
|
17
17
|
# supported limit. You can specify a limit of up to 1000 bank accounts.
|
@@ -60,8 +60,8 @@ module Square
|
|
60
60
|
# @param [String] v1_bank_account_id Required parameter: Connect V1 ID of
|
61
61
|
# the desired `BankAccount`. For more information, see [Retrieve a bank
|
62
62
|
# account by using an ID issued by V1 Bank Accounts
|
63
|
-
# API](https://developer.squareup.com/docs/
|
64
|
-
# -
|
63
|
+
# API](https://developer.squareup.com/docs/bank-accounts-api#retrieve-a-bank
|
64
|
+
# -account-by-using-an-id-issued-by-v1-bank-accounts-api).
|
65
65
|
# @return [GetBankAccountByV1IdResponse Hash] response from the API call
|
66
66
|
def get_bank_account_by_v1_id(v1_bank_account_id:)
|
67
67
|
# Prepare query url.
|
data/lib/square/api/base_api.rb
CHANGED
@@ -0,0 +1,266 @@
|
|
1
|
+
module Square
|
2
|
+
# BookingsApi
|
3
|
+
class BookingsApi < BaseApi
|
4
|
+
def initialize(config, http_call_back: nil)
|
5
|
+
super(config, http_call_back: http_call_back)
|
6
|
+
end
|
7
|
+
|
8
|
+
# Creates a booking.
|
9
|
+
# @param [CreateBookingRequest] body Required parameter: An object
|
10
|
+
# containing the fields to POST for the request. See the corresponding
|
11
|
+
# object definition for field details.
|
12
|
+
# @return [CreateBookingResponse Hash] response from the API call
|
13
|
+
def create_booking(body:)
|
14
|
+
# Prepare query url.
|
15
|
+
_query_builder = config.get_base_uri
|
16
|
+
_query_builder << '/v2/bookings'
|
17
|
+
_query_url = APIHelper.clean_url _query_builder
|
18
|
+
|
19
|
+
# Prepare headers.
|
20
|
+
_headers = {
|
21
|
+
'accept' => 'application/json',
|
22
|
+
'content-type' => 'application/json; charset=utf-8'
|
23
|
+
}
|
24
|
+
|
25
|
+
# Prepare and execute HttpRequest.
|
26
|
+
_request = config.http_client.post(
|
27
|
+
_query_url,
|
28
|
+
headers: _headers,
|
29
|
+
parameters: body.to_json
|
30
|
+
)
|
31
|
+
OAuth2.apply(config, _request)
|
32
|
+
_response = execute_request(_request)
|
33
|
+
|
34
|
+
# Return appropriate response type.
|
35
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
36
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
37
|
+
ApiResponse.new(
|
38
|
+
_response, data: decoded, errors: _errors
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Searches for availabilities for booking.
|
43
|
+
# @param [SearchAvailabilityRequest] body Required parameter: An object
|
44
|
+
# containing the fields to POST for the request. See the corresponding
|
45
|
+
# object definition for field details.
|
46
|
+
# @return [SearchAvailabilityResponse Hash] response from the API call
|
47
|
+
def search_availability(body:)
|
48
|
+
# Prepare query url.
|
49
|
+
_query_builder = config.get_base_uri
|
50
|
+
_query_builder << '/v2/bookings/availability/search'
|
51
|
+
_query_url = APIHelper.clean_url _query_builder
|
52
|
+
|
53
|
+
# Prepare headers.
|
54
|
+
_headers = {
|
55
|
+
'accept' => 'application/json',
|
56
|
+
'content-type' => 'application/json; charset=utf-8'
|
57
|
+
}
|
58
|
+
|
59
|
+
# Prepare and execute HttpRequest.
|
60
|
+
_request = config.http_client.post(
|
61
|
+
_query_url,
|
62
|
+
headers: _headers,
|
63
|
+
parameters: body.to_json
|
64
|
+
)
|
65
|
+
OAuth2.apply(config, _request)
|
66
|
+
_response = execute_request(_request)
|
67
|
+
|
68
|
+
# Return appropriate response type.
|
69
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
70
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
71
|
+
ApiResponse.new(
|
72
|
+
_response, data: decoded, errors: _errors
|
73
|
+
)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Retrieves a seller's booking profile.
|
77
|
+
# @return [RetrieveBusinessBookingProfileResponse Hash] response from the API call
|
78
|
+
def retrieve_business_booking_profile
|
79
|
+
# Prepare query url.
|
80
|
+
_query_builder = config.get_base_uri
|
81
|
+
_query_builder << '/v2/bookings/business-booking-profile'
|
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
|
+
# Lists booking profiles for team members.
|
106
|
+
# @param [Boolean] bookable_only Optional parameter: Indicates whether to
|
107
|
+
# include only bookable team members in the returned result (`true`) or not
|
108
|
+
# (`false`).
|
109
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
110
|
+
# to return.
|
111
|
+
# @param [String] cursor Optional parameter: The cursor for paginating
|
112
|
+
# through the results.
|
113
|
+
# @param [String] location_id Optional parameter: Indicates whether to
|
114
|
+
# include only team members enabled at the given location in the returned
|
115
|
+
# result.
|
116
|
+
# @return [ListTeamMemberBookingProfilesResponse Hash] response from the API call
|
117
|
+
def list_team_member_booking_profiles(bookable_only: false,
|
118
|
+
limit: nil,
|
119
|
+
cursor: nil,
|
120
|
+
location_id: nil)
|
121
|
+
# Prepare query url.
|
122
|
+
_query_builder = config.get_base_uri
|
123
|
+
_query_builder << '/v2/bookings/team-member-booking-profiles'
|
124
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
125
|
+
_query_builder,
|
126
|
+
'bookable_only' => bookable_only,
|
127
|
+
'limit' => limit,
|
128
|
+
'cursor' => cursor,
|
129
|
+
'location_id' => location_id
|
130
|
+
)
|
131
|
+
_query_url = APIHelper.clean_url _query_builder
|
132
|
+
|
133
|
+
# Prepare headers.
|
134
|
+
_headers = {
|
135
|
+
'accept' => 'application/json'
|
136
|
+
}
|
137
|
+
|
138
|
+
# Prepare and execute HttpRequest.
|
139
|
+
_request = config.http_client.get(
|
140
|
+
_query_url,
|
141
|
+
headers: _headers
|
142
|
+
)
|
143
|
+
OAuth2.apply(config, _request)
|
144
|
+
_response = execute_request(_request)
|
145
|
+
|
146
|
+
# Return appropriate response type.
|
147
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
148
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
149
|
+
ApiResponse.new(
|
150
|
+
_response, data: decoded, errors: _errors
|
151
|
+
)
|
152
|
+
end
|
153
|
+
|
154
|
+
# Retrieves a team member's booking profile.
|
155
|
+
# @param [String] team_member_id Required parameter: The ID of the team
|
156
|
+
# member to retrieve.
|
157
|
+
# @return [RetrieveTeamMemberBookingProfileResponse Hash] response from the API call
|
158
|
+
def retrieve_team_member_booking_profile(team_member_id:)
|
159
|
+
# Prepare query url.
|
160
|
+
_query_builder = config.get_base_uri
|
161
|
+
_query_builder << '/v2/bookings/team-member-booking-profiles/{team_member_id}'
|
162
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
163
|
+
_query_builder,
|
164
|
+
'team_member_id' => { 'value' => team_member_id, 'encode' => true }
|
165
|
+
)
|
166
|
+
_query_url = APIHelper.clean_url _query_builder
|
167
|
+
|
168
|
+
# Prepare headers.
|
169
|
+
_headers = {
|
170
|
+
'accept' => 'application/json'
|
171
|
+
}
|
172
|
+
|
173
|
+
# Prepare and execute HttpRequest.
|
174
|
+
_request = config.http_client.get(
|
175
|
+
_query_url,
|
176
|
+
headers: _headers
|
177
|
+
)
|
178
|
+
OAuth2.apply(config, _request)
|
179
|
+
_response = execute_request(_request)
|
180
|
+
|
181
|
+
# Return appropriate response type.
|
182
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
183
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
184
|
+
ApiResponse.new(
|
185
|
+
_response, data: decoded, errors: _errors
|
186
|
+
)
|
187
|
+
end
|
188
|
+
|
189
|
+
# Retrieves a booking.
|
190
|
+
# @param [String] booking_id Required parameter: The ID of the
|
191
|
+
# [Booking](#type-booking) object representing the to-be-retrieved
|
192
|
+
# booking.
|
193
|
+
# @return [RetrieveBookingResponse Hash] response from the API call
|
194
|
+
def retrieve_booking(booking_id:)
|
195
|
+
# Prepare query url.
|
196
|
+
_query_builder = config.get_base_uri
|
197
|
+
_query_builder << '/v2/bookings/{booking_id}'
|
198
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
199
|
+
_query_builder,
|
200
|
+
'booking_id' => { 'value' => booking_id, 'encode' => true }
|
201
|
+
)
|
202
|
+
_query_url = APIHelper.clean_url _query_builder
|
203
|
+
|
204
|
+
# Prepare headers.
|
205
|
+
_headers = {
|
206
|
+
'accept' => 'application/json'
|
207
|
+
}
|
208
|
+
|
209
|
+
# Prepare and execute HttpRequest.
|
210
|
+
_request = config.http_client.get(
|
211
|
+
_query_url,
|
212
|
+
headers: _headers
|
213
|
+
)
|
214
|
+
OAuth2.apply(config, _request)
|
215
|
+
_response = execute_request(_request)
|
216
|
+
|
217
|
+
# Return appropriate response type.
|
218
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
219
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
220
|
+
ApiResponse.new(
|
221
|
+
_response, data: decoded, errors: _errors
|
222
|
+
)
|
223
|
+
end
|
224
|
+
|
225
|
+
# Updates a booking.
|
226
|
+
# @param [String] booking_id Required parameter: The ID of the
|
227
|
+
# [Booking](#type-booking) object representing the to-be-updated booking.
|
228
|
+
# @param [UpdateBookingRequest] body Required parameter: An object
|
229
|
+
# containing the fields to POST for the request. See the corresponding
|
230
|
+
# object definition for field details.
|
231
|
+
# @return [UpdateBookingResponse Hash] response from the API call
|
232
|
+
def update_booking(booking_id:,
|
233
|
+
body:)
|
234
|
+
# Prepare query url.
|
235
|
+
_query_builder = config.get_base_uri
|
236
|
+
_query_builder << '/v2/bookings/{booking_id}'
|
237
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
238
|
+
_query_builder,
|
239
|
+
'booking_id' => { 'value' => booking_id, 'encode' => true }
|
240
|
+
)
|
241
|
+
_query_url = APIHelper.clean_url _query_builder
|
242
|
+
|
243
|
+
# Prepare headers.
|
244
|
+
_headers = {
|
245
|
+
'accept' => 'application/json',
|
246
|
+
'content-type' => 'application/json; charset=utf-8'
|
247
|
+
}
|
248
|
+
|
249
|
+
# Prepare and execute HttpRequest.
|
250
|
+
_request = config.http_client.put(
|
251
|
+
_query_url,
|
252
|
+
headers: _headers,
|
253
|
+
parameters: body.to_json
|
254
|
+
)
|
255
|
+
OAuth2.apply(config, _request)
|
256
|
+
_response = execute_request(_request)
|
257
|
+
|
258
|
+
# Return appropriate response type.
|
259
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
260
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
261
|
+
ApiResponse.new(
|
262
|
+
_response, data: decoded, errors: _errors
|
263
|
+
)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
@@ -63,7 +63,8 @@ module Square
|
|
63
63
|
end
|
64
64
|
|
65
65
|
# Provides the summary details for a single cash drawer shift. See
|
66
|
-
#
|
66
|
+
# [ListCashDrawerShiftEvents](#endpoint-CashDrawers-ListCashDrawerShiftEvent
|
67
|
+
# s) for a list of cash drawer shift events.
|
67
68
|
# @param [String] location_id Required parameter: The ID of the location to
|
68
69
|
# retrieve cash drawer shifts from.
|
69
70
|
# @param [String] shift_id Required parameter: The shift ID.
|
@@ -239,9 +239,9 @@ module Square
|
|
239
239
|
# `DISCOUNT`, `TAX`, `IMAGE`.
|
240
240
|
# __Important:__ ListCatalog does not return deleted catalog items. To
|
241
241
|
# retrieve
|
242
|
-
# deleted catalog items, use
|
243
|
-
#
|
244
|
-
# to `true`.
|
242
|
+
# deleted catalog items, use
|
243
|
+
# [SearchCatalogObjects](#endpoint-Catalog-SearchCatalogObjects)
|
244
|
+
# and set the `include_deleted_objects` attribute value to `true`.
|
245
245
|
# @param [String] cursor Optional parameter: The pagination cursor returned
|
246
246
|
# in the previous response. Leave unset for an initial request. See
|
247
247
|
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
@@ -9,8 +9,8 @@ module Square
|
|
9
9
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
10
10
|
# previous calls to __ListCustomerSegments__. Used to retrieve the next set
|
11
11
|
# of query results. See the [Pagination
|
12
|
-
# guide](https://developer.squareup.com/docs/
|
13
|
-
#
|
12
|
+
# guide](https://developer.squareup.com/docs/working-with-apis/pagination)
|
13
|
+
# for more information.
|
14
14
|
# @return [ListCustomerSegmentsResponse Hash] response from the API call
|
15
15
|
def list_customer_segments(cursor: nil)
|
16
16
|
# Prepare query url.
|
@@ -208,8 +208,8 @@ module Square
|
|
208
208
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
209
209
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
210
210
|
# results for the original query. See the
|
211
|
-
# [Pagination](https://developer.squareup.com/docs/
|
212
|
-
#
|
211
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
212
|
+
# ion) guide for more information.
|
213
213
|
# @return [RetrieveInventoryCountResponse Hash] response from the API call
|
214
214
|
def retrieve_inventory_count(catalog_object_id:,
|
215
215
|
location_ids: nil,
|
@@ -13,8 +13,8 @@ module Square
|
|
13
13
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
14
14
|
# a previous call to this endpoint. Provide this cursor to retrieve the
|
15
15
|
# next set of results for your original query. For more information, see
|
16
|
-
# [Pagination](https://developer.squareup.com/docs/
|
17
|
-
#
|
16
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
17
|
+
# ion).
|
18
18
|
# @param [Integer] limit Optional parameter: The maximum number of invoices
|
19
19
|
# to return (200 is the maximum `limit`). If not provided, the server uses
|
20
20
|
# a default limit of 100 invoices.
|
@@ -123,7 +123,7 @@ module Square
|
|
123
123
|
# [CalculateLoyaltyPoints](#endpoint-Loyalty-CalculateLoyaltyPoints) to
|
124
124
|
# compute the points. For more information,
|
125
125
|
# see [Loyalty Program
|
126
|
-
# Overview](https://developer.squareup.com/docs/
|
126
|
+
# Overview](https://developer.squareup.com/docs/loyalty/overview).
|
127
127
|
# You then provide the points in a request to this endpoint.
|
128
128
|
# @param [String] account_id Required parameter: The [loyalty
|
129
129
|
# account](#type-LoyaltyAccount) ID to which to add the points.
|
@@ -16,8 +16,8 @@ module Square
|
|
16
16
|
# ```
|
17
17
|
# Replace `ACCESS_TOKEN` with a
|
18
18
|
# [valid production authorization
|
19
|
-
# credential](https://developer.squareup.com/docs/
|
20
|
-
#
|
19
|
+
# credential](https://developer.squareup.com/docs/build-basics/access-tokens
|
20
|
+
# ).
|
21
21
|
# @param [CreateMobileAuthorizationCodeRequest] body Required parameter: An
|
22
22
|
# object containing the fields to POST for the request. See the
|
23
23
|
# corresponding object definition for field details.
|
@@ -85,7 +85,7 @@ module Square
|
|
85
85
|
# ```
|
86
86
|
# Replace `APPLICATION_SECRET` with the application secret on the
|
87
87
|
# Credentials
|
88
|
-
# page in the [
|
88
|
+
# page in the [Developer Dashboard](https://developer.squareup.com/apps).
|
89
89
|
# @param [RevokeTokenRequest] body Required parameter: An object containing
|
90
90
|
# the fields to POST for the request. See the corresponding object
|
91
91
|
# definition for field details.
|
@@ -126,9 +126,6 @@ module Square
|
|
126
126
|
# The endpoint supports distinct methods of obtaining OAuth access tokens.
|
127
127
|
# Applications specify a method by adding the `grant_type` parameter
|
128
128
|
# in the request and also provide relevant information.
|
129
|
-
# For more information, see [OAuth access token
|
130
|
-
# management](https://developer.squareup.com/docs/authz/oauth/how-it-works#o
|
131
|
-
# auth-access-token-management).
|
132
129
|
# __Note:__ Regardless of the method application specified,
|
133
130
|
# the endpoint always returns two items; an OAuth access token and
|
134
131
|
# a refresh token in the response.
|
@@ -7,35 +7,35 @@ module Square
|
|
7
7
|
|
8
8
|
# Retrieves a list of refunds for the account making the request.
|
9
9
|
# The maximum results per page is 100.
|
10
|
-
# @param [String] begin_time Optional parameter:
|
11
|
-
# of the requested reporting period, in RFC 3339 format. Default:
|
12
|
-
# current time minus one year.
|
13
|
-
# @param [String] end_time Optional parameter:
|
14
|
-
# requested reporting period, in RFC 3339 format. Default: The current
|
10
|
+
# @param [String] begin_time Optional parameter: The timestamp for the
|
11
|
+
# beginning of the requested reporting period, in RFC 3339 format. Default:
|
12
|
+
# The current time minus one year.
|
13
|
+
# @param [String] end_time Optional parameter: The timestamp for the end of
|
14
|
+
# the requested reporting period, in RFC 3339 format. Default: The current
|
15
15
|
# time.
|
16
16
|
# @param [String] sort_order Optional parameter: The order in which results
|
17
|
-
# are listed
|
17
|
+
# are listed: - `ASC` - Oldest to newest. - `DESC` - Newest to oldest
|
18
18
|
# (default).
|
19
19
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
20
|
-
# a previous call to this endpoint. Provide this to retrieve the next
|
21
|
-
# results for the original query.
|
20
|
+
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
21
|
+
# set of results for the original query. For more information, see
|
22
22
|
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
23
|
-
#
|
23
|
+
# .
|
24
24
|
# @param [String] location_id Optional parameter: Limit results to the
|
25
25
|
# location supplied. By default, results are returned for all locations
|
26
|
-
# associated with the
|
26
|
+
# associated with the seller.
|
27
27
|
# @param [String] status Optional parameter: If provided, only refunds with
|
28
28
|
# the given status are returned. For a list of refund status values, see
|
29
|
-
# [PaymentRefund](#type-paymentrefund). Default: If omitted refunds are
|
30
|
-
# returned regardless of status.
|
29
|
+
# [PaymentRefund](#type-paymentrefund). Default: If omitted, refunds are
|
30
|
+
# returned regardless of their status.
|
31
31
|
# @param [String] source_type Optional parameter: If provided, only refunds
|
32
32
|
# with the given source type are returned. - `CARD` - List refunds only for
|
33
|
-
# payments where
|
34
|
-
# refunds are returned regardless of source type.
|
35
|
-
# @param [Integer] limit Optional parameter:
|
36
|
-
# returned in a single page.
|
37
|
-
# the specified limit on a given page. If the supplied value is
|
38
|
-
# than 100,
|
33
|
+
# payments where `CARD` was specified as the payment source. Default: If
|
34
|
+
# omitted, refunds are returned regardless of the source type.
|
35
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
36
|
+
# to be returned in a single page. It is possible to receive fewer results
|
37
|
+
# than the specified limit on a given page. If the supplied value is
|
38
|
+
# greater than 100, no more than 100 results are returned. Default: 100
|
39
39
|
# @return [ListPaymentRefundsResponse Hash] response from the API call
|
40
40
|
def list_payment_refunds(begin_time: nil,
|
41
41
|
end_time: nil,
|
@@ -118,8 +118,8 @@ module Square
|
|
118
118
|
end
|
119
119
|
|
120
120
|
# Retrieves a specific refund using the `refund_id`.
|
121
|
-
# @param [String] refund_id Required parameter:
|
122
|
-
# `PaymentRefund`.
|
121
|
+
# @param [String] refund_id Required parameter: The unique ID for the
|
122
|
+
# desired `PaymentRefund`.
|
123
123
|
# @return [GetPaymentRefundResponse Hash] response from the API call
|
124
124
|
def get_payment_refund(refund_id:)
|
125
125
|
# Prepare query url.
|
@@ -60,8 +60,8 @@ module Square
|
|
60
60
|
# customer by subscription creation date.
|
61
61
|
# For more information, see
|
62
62
|
# [Retrieve
|
63
|
-
# subscriptions](https://developer.squareup.com/docs/
|
64
|
-
#
|
63
|
+
# subscriptions](https://developer.squareup.com/docs/subscriptions-api/overv
|
64
|
+
# iew#retrieve-subscriptions).
|
65
65
|
# @param [SearchSubscriptionsRequest] body Required parameter: An object
|
66
66
|
# containing the fields to POST for the request. See the corresponding
|
67
67
|
# object definition for field details.
|
@@ -217,8 +217,8 @@ module Square
|
|
217
217
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
218
218
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
219
219
|
# results for the original query. For more information, see
|
220
|
-
# [Pagination](https://developer.squareup.com/docs/
|
221
|
-
#
|
220
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
221
|
+
# ion).
|
222
222
|
# @param [Integer] limit Optional parameter: The upper limit on the number
|
223
223
|
# of subscription events to return in the response. Default: `200`
|
224
224
|
# @return [ListSubscriptionEventsResponse Hash] response from the API call
|
data/lib/square/api/team_api.rb
CHANGED
@@ -11,8 +11,8 @@ module Square
|
|
11
11
|
# - `given_name`
|
12
12
|
# - `family_name`
|
13
13
|
# Learn about [Troubleshooting the Teams
|
14
|
-
# API](https://developer.squareup.com/docs/
|
15
|
-
#
|
14
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#createteamme
|
15
|
+
# mber).
|
16
16
|
# @param [CreateTeamMemberRequest] body Required parameter: An object
|
17
17
|
# containing the fields to POST for the request. See the corresponding
|
18
18
|
# object definition for field details.
|
@@ -54,8 +54,8 @@ module Square
|
|
54
54
|
# marked as failed, but the body of the response
|
55
55
|
# will contain explicit error information for this particular create.
|
56
56
|
# Learn about [Troubleshooting the Teams
|
57
|
-
# API](https://developer.squareup.com/docs/
|
58
|
-
#
|
57
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#bulkcreatete
|
58
|
+
# ammembers).
|
59
59
|
# @param [BulkCreateTeamMembersRequest] body Required parameter: An object
|
60
60
|
# containing the fields to POST for the request. See the corresponding
|
61
61
|
# object definition for field details.
|
@@ -97,8 +97,8 @@ module Square
|
|
97
97
|
# marked as failed, but the body of the response
|
98
98
|
# will contain explicit error information for this particular update.
|
99
99
|
# Learn about [Troubleshooting the Teams
|
100
|
-
# API](https://developer.squareup.com/docs/
|
101
|
-
#
|
100
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#bulkupdatete
|
101
|
+
# ammembers).
|
102
102
|
# @param [BulkUpdateTeamMembersRequest] body Required parameter: An object
|
103
103
|
# containing the fields to POST for the request. See the corresponding
|
104
104
|
# object definition for field details.
|
@@ -171,8 +171,8 @@ module Square
|
|
171
171
|
|
172
172
|
# Retrieve a `TeamMember` object for the given `TeamMember.id`.
|
173
173
|
# Learn about [Troubleshooting the Teams
|
174
|
-
# API](https://developer.squareup.com/docs/
|
175
|
-
#
|
174
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#retrieveteam
|
175
|
+
# member).
|
176
176
|
# @param [String] team_member_id Required parameter: The ID of the team
|
177
177
|
# member to retrieve.
|
178
178
|
# @return [RetrieveTeamMemberResponse Hash] response from the API call
|
@@ -210,8 +210,8 @@ module Square
|
|
210
210
|
# Updates a single `TeamMember` object. The `TeamMember` will be returned on
|
211
211
|
# successful updates.
|
212
212
|
# Learn about [Troubleshooting the Teams
|
213
|
-
# API](https://developer.squareup.com/docs/
|
214
|
-
#
|
213
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#updateteamme
|
214
|
+
# mber).
|
215
215
|
# @param [String] team_member_id Required parameter: The ID of the team
|
216
216
|
# member to update.
|
217
217
|
# @param [UpdateTeamMemberRequest] body Required parameter: An object
|
@@ -255,8 +255,8 @@ module Square
|
|
255
255
|
# Retrieve a `WageSetting` object for a team member specified
|
256
256
|
# by `TeamMember.id`.
|
257
257
|
# Learn about [Troubleshooting the Teams
|
258
|
-
# API](https://developer.squareup.com/docs/
|
259
|
-
#
|
258
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#retrievewage
|
259
|
+
# setting).
|
260
260
|
# @param [String] team_member_id Required parameter: The ID of the team
|
261
261
|
# member to retrieve wage setting for
|
262
262
|
# @return [RetrieveWageSettingResponse Hash] response from the API call
|
@@ -297,8 +297,8 @@ module Square
|
|
297
297
|
# it fully replaces the `WageSetting` object for the team member.
|
298
298
|
# The `WageSetting` will be returned upon successful update.
|
299
299
|
# Learn about [Troubleshooting the Teams
|
300
|
-
# API](https://developer.squareup.com/docs/
|
301
|
-
#
|
300
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#updatewagese
|
301
|
+
# tting).
|
302
302
|
# @param [String] team_member_id Required parameter: The ID of the team
|
303
303
|
# member to update the `WageSetting` object for.
|
304
304
|
# @param [UpdateWageSettingRequest] body Required parameter: An object
|
data/lib/square/client.rb
CHANGED
@@ -4,7 +4,7 @@ module Square
|
|
4
4
|
attr_reader :config
|
5
5
|
|
6
6
|
def sdk_version
|
7
|
-
'
|
7
|
+
'7.0.0.20201118'
|
8
8
|
end
|
9
9
|
|
10
10
|
def square_version
|
@@ -59,6 +59,12 @@ module Square
|
|
59
59
|
@bank_accounts ||= BankAccountsApi.new config
|
60
60
|
end
|
61
61
|
|
62
|
+
# Access to bookings controller.
|
63
|
+
# @return [BookingsApi] Returns the controller instance.
|
64
|
+
def bookings
|
65
|
+
@bookings ||= BookingsApi.new config
|
66
|
+
end
|
67
|
+
|
62
68
|
# Access to cash_drawers controller.
|
63
69
|
# @return [CashDrawersApi] Returns the controller instance.
|
64
70
|
def cash_drawers
|
@@ -193,7 +199,7 @@ module Square
|
|
193
199
|
|
194
200
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
195
201
|
backoff_factor: 1, environment: 'production',
|
196
|
-
square_version: '2020-
|
202
|
+
square_version: '2020-11-18', access_token: 'TODO: Replace',
|
197
203
|
additional_headers: {}, config: nil)
|
198
204
|
@config = if config.nil?
|
199
205
|
Configuration.new(timeout: timeout, max_retries: max_retries,
|
data/lib/square/configuration.rb
CHANGED
@@ -22,7 +22,7 @@ module Square
|
|
22
22
|
|
23
23
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
24
24
|
backoff_factor: 1, environment: 'production',
|
25
|
-
square_version: '2020-
|
25
|
+
square_version: '2020-11-18', access_token: 'TODO: Replace',
|
26
26
|
additional_headers: {})
|
27
27
|
# The value to use for connection timeout
|
28
28
|
@timeout = timeout
|
@@ -43,7 +43,7 @@ module Square
|
|
43
43
|
# Square Connect API versions
|
44
44
|
@square_version = square_version
|
45
45
|
|
46
|
-
# OAuth 2.0 Access Token
|
46
|
+
# The OAuth 2.0 Access Token to use for API requests.
|
47
47
|
@access_token = access_token
|
48
48
|
|
49
49
|
# Additional headers to add to each API request
|
@@ -30,7 +30,10 @@ module Square
|
|
30
30
|
http_request.query_url
|
31
31
|
) do |request|
|
32
32
|
request.headers = http_request.headers
|
33
|
-
|
33
|
+
unless http_request.http_method == HttpMethodEnum::GET &&
|
34
|
+
http_request.parameters.empty?
|
35
|
+
request.body = http_request.parameters
|
36
|
+
end
|
34
37
|
end
|
35
38
|
convert_response(response, http_request)
|
36
39
|
end
|
@@ -42,7 +45,10 @@ module Square
|
|
42
45
|
http_request.query_url
|
43
46
|
) do |request|
|
44
47
|
request.headers = http_request.headers
|
45
|
-
|
48
|
+
unless http_request.http_method == HttpMethodEnum::GET &&
|
49
|
+
http_request.parameters.empty?
|
50
|
+
request.body = http_request.parameters
|
51
|
+
end
|
46
52
|
end
|
47
53
|
convert_response(response, http_request)
|
48
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: square.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0.20201118
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Square Developer Platform
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/square/api/apple_pay_api.rb
|
140
140
|
- lib/square/api/bank_accounts_api.rb
|
141
141
|
- lib/square/api/base_api.rb
|
142
|
+
- lib/square/api/bookings_api.rb
|
142
143
|
- lib/square/api/cash_drawers_api.rb
|
143
144
|
- lib/square/api/catalog_api.rb
|
144
145
|
- lib/square/api/checkout_api.rb
|
@@ -202,7 +203,7 @@ require_paths:
|
|
202
203
|
- lib
|
203
204
|
required_ruby_version: !ruby/object:Gem::Requirement
|
204
205
|
requirements:
|
205
|
-
- - "
|
206
|
+
- - ">="
|
206
207
|
- !ruby/object:Gem::Version
|
207
208
|
version: '2.0'
|
208
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|