square.rb 8.0.0.20201216 → 26.1.0.20230119
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/LICENSE +1 -1
- data/README.md +79 -221
- data/lib/square/api/apple_pay_api.rb +15 -8
- data/lib/square/api/bank_accounts_api.rb +5 -5
- data/lib/square/api/base_api.rb +27 -9
- data/lib/square/api/booking_custom_attributes_api.rb +555 -0
- data/lib/square/api/bookings_api.rb +107 -15
- data/lib/square/api/cards_api.rb +171 -0
- data/lib/square/api/cash_drawers_api.rb +2 -2
- data/lib/square/api/catalog_api.rb +167 -73
- data/lib/square/api/checkout_api.rb +205 -3
- data/lib/square/api/customer_custom_attributes_api.rb +561 -0
- data/lib/square/api/customer_groups_api.rb +17 -8
- data/lib/square/api/customer_segments_api.rb +15 -6
- data/lib/square/api/customers_api.rb +67 -33
- data/lib/square/api/devices_api.rb +3 -2
- data/lib/square/api/disputes_api.rb +109 -105
- data/lib/square/api/gift_card_activities_api.rb +132 -0
- data/lib/square/api/gift_cards_api.rb +298 -0
- data/lib/square/api/inventory_api.rb +263 -24
- data/lib/square/api/invoices_api.rb +21 -21
- data/lib/square/api/labor_api.rb +70 -68
- data/lib/square/api/location_custom_attributes_api.rb +584 -0
- data/lib/square/api/locations_api.rb +21 -14
- data/lib/square/api/loyalty_api.rb +333 -50
- data/lib/square/api/merchants_api.rb +11 -9
- data/lib/square/api/mobile_authorization_api.rb +4 -4
- data/lib/square/api/o_auth_api.rb +78 -25
- data/lib/square/api/order_custom_attributes_api.rb +601 -0
- data/lib/square/api/orders_api.rb +84 -45
- data/lib/square/api/payments_api.rb +72 -24
- data/lib/square/api/payouts_api.rb +173 -0
- data/lib/square/api/refunds_api.rb +18 -7
- data/lib/square/api/sites_api.rb +43 -0
- data/lib/square/api/snippets_api.rb +146 -0
- data/lib/square/api/subscriptions_api.rb +190 -15
- data/lib/square/api/team_api.rb +46 -46
- data/lib/square/api/terminal_api.rb +172 -22
- data/lib/square/api/transactions_api.rb +15 -191
- data/lib/square/api/v1_transactions_api.rb +52 -124
- data/lib/square/api/vendors_api.rb +257 -0
- data/lib/square/api/webhook_subscriptions_api.rb +327 -0
- data/lib/square/api_helper.rb +217 -57
- data/lib/square/client.rb +90 -18
- data/lib/square/configuration.rb +64 -20
- data/lib/square/exceptions/validation_exception.rb +13 -0
- data/lib/square/http/api_response.rb +7 -9
- data/lib/square/http/faraday_client.rb +40 -9
- data/lib/square/http/http_client.rb +31 -12
- data/lib/square/http/http_request.rb +6 -2
- data/lib/square/utilities/date_time_helper.rb +151 -0
- data/lib/square/utilities/file_wrapper.rb +1 -2
- data/lib/square.rb +56 -44
- data/test/api/test_locations_api.rb +2 -5
- data/test/test_helper.rb +2 -2
- metadata +83 -15
- data/lib/square/api/v1_employees_api.rb +0 -751
- data/lib/square/api/v1_items_api.rb +0 -1766
@@ -0,0 +1,146 @@
|
|
1
|
+
module Square
|
2
|
+
# SnippetsApi
|
3
|
+
class SnippetsApi < BaseApi
|
4
|
+
def initialize(config, http_call_back: nil)
|
5
|
+
super(config, http_call_back: http_call_back)
|
6
|
+
end
|
7
|
+
|
8
|
+
# Removes your snippet from a Square Online site.
|
9
|
+
# You can call [ListSites]($e/Sites/ListSites) to get the IDs of the sites
|
10
|
+
# that belong to a seller.
|
11
|
+
# __Note:__ Square Online APIs are publicly available as part of an early
|
12
|
+
# access program. For more information, see [Early access program for Square
|
13
|
+
# Online
|
14
|
+
# APIs](https://developer.squareup.com/docs/online-api#early-access-program-
|
15
|
+
# for-square-online-apis).
|
16
|
+
# @param [String] site_id Required parameter: The ID of the site that
|
17
|
+
# contains the snippet.
|
18
|
+
# @return [DeleteSnippetResponse Hash] response from the API call
|
19
|
+
def delete_snippet(site_id:)
|
20
|
+
# Prepare query url.
|
21
|
+
_query_builder = config.get_base_uri
|
22
|
+
_query_builder << '/v2/sites/{site_id}/snippet'
|
23
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
24
|
+
_query_builder,
|
25
|
+
'site_id' => { 'value' => site_id, 'encode' => true }
|
26
|
+
)
|
27
|
+
_query_url = APIHelper.clean_url _query_builder
|
28
|
+
|
29
|
+
# Prepare headers.
|
30
|
+
_headers = {
|
31
|
+
'accept' => 'application/json'
|
32
|
+
}
|
33
|
+
|
34
|
+
# Prepare and execute HttpRequest.
|
35
|
+
_request = config.http_client.delete(
|
36
|
+
_query_url,
|
37
|
+
headers: _headers
|
38
|
+
)
|
39
|
+
OAuth2.apply(config, _request)
|
40
|
+
_response = execute_request(_request)
|
41
|
+
|
42
|
+
# Return appropriate response type.
|
43
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
44
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
45
|
+
ApiResponse.new(
|
46
|
+
_response, data: decoded, errors: _errors
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Retrieves your snippet from a Square Online site. A site can contain
|
51
|
+
# snippets from multiple snippet applications, but you can retrieve only the
|
52
|
+
# snippet that was added by your application.
|
53
|
+
# You can call [ListSites]($e/Sites/ListSites) to get the IDs of the sites
|
54
|
+
# that belong to a seller.
|
55
|
+
# __Note:__ Square Online APIs are publicly available as part of an early
|
56
|
+
# access program. For more information, see [Early access program for Square
|
57
|
+
# Online
|
58
|
+
# APIs](https://developer.squareup.com/docs/online-api#early-access-program-
|
59
|
+
# for-square-online-apis).
|
60
|
+
# @param [String] site_id Required parameter: The ID of the site that
|
61
|
+
# contains the snippet.
|
62
|
+
# @return [RetrieveSnippetResponse Hash] response from the API call
|
63
|
+
def retrieve_snippet(site_id:)
|
64
|
+
# Prepare query url.
|
65
|
+
_query_builder = config.get_base_uri
|
66
|
+
_query_builder << '/v2/sites/{site_id}/snippet'
|
67
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
68
|
+
_query_builder,
|
69
|
+
'site_id' => { 'value' => site_id, 'encode' => true }
|
70
|
+
)
|
71
|
+
_query_url = APIHelper.clean_url _query_builder
|
72
|
+
|
73
|
+
# Prepare headers.
|
74
|
+
_headers = {
|
75
|
+
'accept' => 'application/json'
|
76
|
+
}
|
77
|
+
|
78
|
+
# Prepare and execute HttpRequest.
|
79
|
+
_request = config.http_client.get(
|
80
|
+
_query_url,
|
81
|
+
headers: _headers
|
82
|
+
)
|
83
|
+
OAuth2.apply(config, _request)
|
84
|
+
_response = execute_request(_request)
|
85
|
+
|
86
|
+
# Return appropriate response type.
|
87
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
88
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
89
|
+
ApiResponse.new(
|
90
|
+
_response, data: decoded, errors: _errors
|
91
|
+
)
|
92
|
+
end
|
93
|
+
|
94
|
+
# Adds a snippet to a Square Online site or updates the existing snippet on
|
95
|
+
# the site.
|
96
|
+
# The snippet code is appended to the end of the `head` element on every
|
97
|
+
# page of the site, except checkout pages. A snippet application can add one
|
98
|
+
# snippet to a given site.
|
99
|
+
# You can call [ListSites]($e/Sites/ListSites) to get the IDs of the sites
|
100
|
+
# that belong to a seller.
|
101
|
+
# __Note:__ Square Online APIs are publicly available as part of an early
|
102
|
+
# access program. For more information, see [Early access program for Square
|
103
|
+
# Online
|
104
|
+
# APIs](https://developer.squareup.com/docs/online-api#early-access-program-
|
105
|
+
# for-square-online-apis).
|
106
|
+
# @param [String] site_id Required parameter: The ID of the site where you
|
107
|
+
# want to add or update the snippet.
|
108
|
+
# @param [UpsertSnippetRequest] body Required parameter: An object
|
109
|
+
# containing the fields to POST for the request. See the corresponding
|
110
|
+
# object definition for field details.
|
111
|
+
# @return [UpsertSnippetResponse Hash] response from the API call
|
112
|
+
def upsert_snippet(site_id:,
|
113
|
+
body:)
|
114
|
+
# Prepare query url.
|
115
|
+
_query_builder = config.get_base_uri
|
116
|
+
_query_builder << '/v2/sites/{site_id}/snippet'
|
117
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
118
|
+
_query_builder,
|
119
|
+
'site_id' => { 'value' => site_id, 'encode' => true }
|
120
|
+
)
|
121
|
+
_query_url = APIHelper.clean_url _query_builder
|
122
|
+
|
123
|
+
# Prepare headers.
|
124
|
+
_headers = {
|
125
|
+
'accept' => 'application/json',
|
126
|
+
'Content-Type' => 'application/json'
|
127
|
+
}
|
128
|
+
|
129
|
+
# Prepare and execute HttpRequest.
|
130
|
+
_request = config.http_client.post(
|
131
|
+
_query_url,
|
132
|
+
headers: _headers,
|
133
|
+
parameters: body.to_json
|
134
|
+
)
|
135
|
+
OAuth2.apply(config, _request)
|
136
|
+
_response = execute_request(_request)
|
137
|
+
|
138
|
+
# Return appropriate response type.
|
139
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
140
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
141
|
+
ApiResponse.new(
|
142
|
+
_response, data: decoded, errors: _errors
|
143
|
+
)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
@@ -5,7 +5,7 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Creates a subscription
|
8
|
+
# Creates a subscription to a subscription plan by a customer.
|
9
9
|
# If you provide a card on file in the request, Square charges the card for
|
10
10
|
# the subscription. Otherwise, Square bills an invoice to the customer's
|
11
11
|
# email
|
@@ -25,7 +25,7 @@ module Square
|
|
25
25
|
# Prepare headers.
|
26
26
|
_headers = {
|
27
27
|
'accept' => 'application/json',
|
28
|
-
'
|
28
|
+
'Content-Type' => 'application/json'
|
29
29
|
}
|
30
30
|
|
31
31
|
# Prepare and execute HttpRequest.
|
@@ -75,7 +75,7 @@ module Square
|
|
75
75
|
# Prepare headers.
|
76
76
|
_headers = {
|
77
77
|
'accept' => 'application/json',
|
78
|
-
'
|
78
|
+
'Content-Type' => 'application/json'
|
79
79
|
}
|
80
80
|
|
81
81
|
# Prepare and execute HttpRequest.
|
@@ -98,8 +98,13 @@ module Square
|
|
98
98
|
# Retrieves a subscription.
|
99
99
|
# @param [String] subscription_id Required parameter: The ID of the
|
100
100
|
# subscription to retrieve.
|
101
|
+
# @param [String] include Optional parameter: A query parameter to specify
|
102
|
+
# related information to be included in the response. The supported query
|
103
|
+
# parameter values are: - `actions`: to include scheduled actions on the
|
104
|
+
# targeted subscription.
|
101
105
|
# @return [RetrieveSubscriptionResponse Hash] response from the API call
|
102
|
-
def retrieve_subscription(subscription_id
|
106
|
+
def retrieve_subscription(subscription_id:,
|
107
|
+
include: nil)
|
103
108
|
# Prepare query url.
|
104
109
|
_query_builder = config.get_base_uri
|
105
110
|
_query_builder << '/v2/subscriptions/{subscription_id}'
|
@@ -107,6 +112,10 @@ module Square
|
|
107
112
|
_query_builder,
|
108
113
|
'subscription_id' => { 'value' => subscription_id, 'encode' => true }
|
109
114
|
)
|
115
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
116
|
+
_query_builder,
|
117
|
+
'include' => include
|
118
|
+
)
|
110
119
|
_query_url = APIHelper.clean_url _query_builder
|
111
120
|
|
112
121
|
# Prepare headers.
|
@@ -132,7 +141,7 @@ module Square
|
|
132
141
|
|
133
142
|
# Updates a subscription. You can set, modify, and clear the
|
134
143
|
# `subscription` field values.
|
135
|
-
# @param [String] subscription_id Required parameter: The ID
|
144
|
+
# @param [String] subscription_id Required parameter: The ID of the
|
136
145
|
# subscription to update.
|
137
146
|
# @param [UpdateSubscriptionRequest] body Required parameter: An object
|
138
147
|
# containing the fields to POST for the request. See the corresponding
|
@@ -152,7 +161,7 @@ module Square
|
|
152
161
|
# Prepare headers.
|
153
162
|
_headers = {
|
154
163
|
'accept' => 'application/json',
|
155
|
-
'
|
164
|
+
'Content-Type' => 'application/json'
|
156
165
|
}
|
157
166
|
|
158
167
|
# Prepare and execute HttpRequest.
|
@@ -172,8 +181,50 @@ module Square
|
|
172
181
|
)
|
173
182
|
end
|
174
183
|
|
175
|
-
#
|
176
|
-
#
|
184
|
+
# Deletes a scheduled action for a subscription.
|
185
|
+
# @param [String] subscription_id Required parameter: The ID of the
|
186
|
+
# subscription the targeted action is to act upon.
|
187
|
+
# @param [String] action_id Required parameter: The ID of the targeted
|
188
|
+
# action to be deleted.
|
189
|
+
# @return [DeleteSubscriptionActionResponse Hash] response from the API call
|
190
|
+
def delete_subscription_action(subscription_id:,
|
191
|
+
action_id:)
|
192
|
+
# Prepare query url.
|
193
|
+
_query_builder = config.get_base_uri
|
194
|
+
_query_builder << '/v2/subscriptions/{subscription_id}/actions/{action_id}'
|
195
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
196
|
+
_query_builder,
|
197
|
+
'subscription_id' => { 'value' => subscription_id, 'encode' => true },
|
198
|
+
'action_id' => { 'value' => action_id, 'encode' => true }
|
199
|
+
)
|
200
|
+
_query_url = APIHelper.clean_url _query_builder
|
201
|
+
|
202
|
+
# Prepare headers.
|
203
|
+
_headers = {
|
204
|
+
'accept' => 'application/json'
|
205
|
+
}
|
206
|
+
|
207
|
+
# Prepare and execute HttpRequest.
|
208
|
+
_request = config.http_client.delete(
|
209
|
+
_query_url,
|
210
|
+
headers: _headers
|
211
|
+
)
|
212
|
+
OAuth2.apply(config, _request)
|
213
|
+
_response = execute_request(_request)
|
214
|
+
|
215
|
+
# Return appropriate response type.
|
216
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
217
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
218
|
+
ApiResponse.new(
|
219
|
+
_response, data: decoded, errors: _errors
|
220
|
+
)
|
221
|
+
end
|
222
|
+
|
223
|
+
# Schedules a `CANCEL` action to cancel an active subscription
|
224
|
+
# by setting the `canceled_date` field to the end of the active billing
|
225
|
+
# period
|
226
|
+
# and changing the subscription status from ACTIVE to CANCELED after this
|
227
|
+
# date.
|
177
228
|
# @param [String] subscription_id Required parameter: The ID of the
|
178
229
|
# subscription to cancel.
|
179
230
|
# @return [CancelSubscriptionResponse Hash] response from the API call
|
@@ -209,18 +260,17 @@ module Square
|
|
209
260
|
end
|
210
261
|
|
211
262
|
# Lists all events for a specific subscription.
|
212
|
-
# In the current implementation, only `START_SUBSCRIPTION` and
|
213
|
-
# `STOP_SUBSCRIPTION` (when the subscription was canceled) events are
|
214
|
-
# returned.
|
215
263
|
# @param [String] subscription_id Required parameter: The ID of the
|
216
264
|
# subscription to retrieve the events for.
|
217
|
-
# @param [String] cursor Optional parameter:
|
218
|
-
#
|
219
|
-
#
|
265
|
+
# @param [String] cursor Optional parameter: When the total number of
|
266
|
+
# resulting subscription events exceeds the limit of a paged response,
|
267
|
+
# specify the cursor returned from a preceding response here to fetch the
|
268
|
+
# next set of results. If the cursor is unset, the response contains the
|
269
|
+
# last page of the results. For more information, see
|
220
270
|
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
221
271
|
# ion).
|
222
272
|
# @param [Integer] limit Optional parameter: The upper limit on the number
|
223
|
-
# of subscription events to return
|
273
|
+
# of subscription events to return in a paged response.
|
224
274
|
# @return [ListSubscriptionEventsResponse Hash] response from the API call
|
225
275
|
def list_subscription_events(subscription_id:,
|
226
276
|
cursor: nil,
|
@@ -259,5 +309,130 @@ module Square
|
|
259
309
|
_response, data: decoded, errors: _errors
|
260
310
|
)
|
261
311
|
end
|
312
|
+
|
313
|
+
# Schedules a `PAUSE` action to pause an active subscription.
|
314
|
+
# @param [String] subscription_id Required parameter: The ID of the
|
315
|
+
# subscription to pause.
|
316
|
+
# @param [PauseSubscriptionRequest] body Required parameter: An object
|
317
|
+
# containing the fields to POST for the request. See the corresponding
|
318
|
+
# object definition for field details.
|
319
|
+
# @return [PauseSubscriptionResponse Hash] response from the API call
|
320
|
+
def pause_subscription(subscription_id:,
|
321
|
+
body:)
|
322
|
+
# Prepare query url.
|
323
|
+
_query_builder = config.get_base_uri
|
324
|
+
_query_builder << '/v2/subscriptions/{subscription_id}/pause'
|
325
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
326
|
+
_query_builder,
|
327
|
+
'subscription_id' => { 'value' => subscription_id, 'encode' => true }
|
328
|
+
)
|
329
|
+
_query_url = APIHelper.clean_url _query_builder
|
330
|
+
|
331
|
+
# Prepare headers.
|
332
|
+
_headers = {
|
333
|
+
'accept' => 'application/json',
|
334
|
+
'Content-Type' => 'application/json'
|
335
|
+
}
|
336
|
+
|
337
|
+
# Prepare and execute HttpRequest.
|
338
|
+
_request = config.http_client.post(
|
339
|
+
_query_url,
|
340
|
+
headers: _headers,
|
341
|
+
parameters: body.to_json
|
342
|
+
)
|
343
|
+
OAuth2.apply(config, _request)
|
344
|
+
_response = execute_request(_request)
|
345
|
+
|
346
|
+
# Return appropriate response type.
|
347
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
348
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
349
|
+
ApiResponse.new(
|
350
|
+
_response, data: decoded, errors: _errors
|
351
|
+
)
|
352
|
+
end
|
353
|
+
|
354
|
+
# Schedules a `RESUME` action to resume a paused or a deactivated
|
355
|
+
# subscription.
|
356
|
+
# @param [String] subscription_id Required parameter: The ID of the
|
357
|
+
# subscription to resume.
|
358
|
+
# @param [ResumeSubscriptionRequest] body Required parameter: An object
|
359
|
+
# containing the fields to POST for the request. See the corresponding
|
360
|
+
# object definition for field details.
|
361
|
+
# @return [ResumeSubscriptionResponse Hash] response from the API call
|
362
|
+
def resume_subscription(subscription_id:,
|
363
|
+
body:)
|
364
|
+
# Prepare query url.
|
365
|
+
_query_builder = config.get_base_uri
|
366
|
+
_query_builder << '/v2/subscriptions/{subscription_id}/resume'
|
367
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
368
|
+
_query_builder,
|
369
|
+
'subscription_id' => { 'value' => subscription_id, 'encode' => true }
|
370
|
+
)
|
371
|
+
_query_url = APIHelper.clean_url _query_builder
|
372
|
+
|
373
|
+
# Prepare headers.
|
374
|
+
_headers = {
|
375
|
+
'accept' => 'application/json',
|
376
|
+
'Content-Type' => 'application/json'
|
377
|
+
}
|
378
|
+
|
379
|
+
# Prepare and execute HttpRequest.
|
380
|
+
_request = config.http_client.post(
|
381
|
+
_query_url,
|
382
|
+
headers: _headers,
|
383
|
+
parameters: body.to_json
|
384
|
+
)
|
385
|
+
OAuth2.apply(config, _request)
|
386
|
+
_response = execute_request(_request)
|
387
|
+
|
388
|
+
# Return appropriate response type.
|
389
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
390
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
391
|
+
ApiResponse.new(
|
392
|
+
_response, data: decoded, errors: _errors
|
393
|
+
)
|
394
|
+
end
|
395
|
+
|
396
|
+
# Schedules a `SWAP_PLAN` action to swap a subscription plan in an existing
|
397
|
+
# subscription.
|
398
|
+
# @param [String] subscription_id Required parameter: The ID of the
|
399
|
+
# subscription to swap the subscription plan for.
|
400
|
+
# @param [SwapPlanRequest] body Required parameter: An object containing the
|
401
|
+
# fields to POST for the request. See the corresponding object definition
|
402
|
+
# for field details.
|
403
|
+
# @return [SwapPlanResponse Hash] response from the API call
|
404
|
+
def swap_plan(subscription_id:,
|
405
|
+
body:)
|
406
|
+
# Prepare query url.
|
407
|
+
_query_builder = config.get_base_uri
|
408
|
+
_query_builder << '/v2/subscriptions/{subscription_id}/swap-plan'
|
409
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
410
|
+
_query_builder,
|
411
|
+
'subscription_id' => { 'value' => subscription_id, 'encode' => true }
|
412
|
+
)
|
413
|
+
_query_url = APIHelper.clean_url _query_builder
|
414
|
+
|
415
|
+
# Prepare headers.
|
416
|
+
_headers = {
|
417
|
+
'accept' => 'application/json',
|
418
|
+
'Content-Type' => 'application/json'
|
419
|
+
}
|
420
|
+
|
421
|
+
# Prepare and execute HttpRequest.
|
422
|
+
_request = config.http_client.post(
|
423
|
+
_query_url,
|
424
|
+
headers: _headers,
|
425
|
+
parameters: body.to_json
|
426
|
+
)
|
427
|
+
OAuth2.apply(config, _request)
|
428
|
+
_response = execute_request(_request)
|
429
|
+
|
430
|
+
# Return appropriate response type.
|
431
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
432
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
433
|
+
ApiResponse.new(
|
434
|
+
_response, data: decoded, errors: _errors
|
435
|
+
)
|
436
|
+
end
|
262
437
|
end
|
263
438
|
end
|
data/lib/square/api/team_api.rb
CHANGED
@@ -5,12 +5,12 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Creates a single `TeamMember` object. The `TeamMember`
|
9
|
-
# successful creates.
|
8
|
+
# Creates a single `TeamMember` object. The `TeamMember` object is returned
|
9
|
+
# on successful creates.
|
10
10
|
# You must provide the following values in your request to this endpoint:
|
11
11
|
# - `given_name`
|
12
12
|
# - `family_name`
|
13
|
-
# Learn about [Troubleshooting the
|
13
|
+
# Learn about [Troubleshooting the Team
|
14
14
|
# API](https://developer.squareup.com/docs/team/troubleshooting#createteamme
|
15
15
|
# mber).
|
16
16
|
# @param [CreateTeamMemberRequest] body Required parameter: An object
|
@@ -26,7 +26,7 @@ module Square
|
|
26
26
|
# Prepare headers.
|
27
27
|
_headers = {
|
28
28
|
'accept' => 'application/json',
|
29
|
-
'
|
29
|
+
'Content-Type' => 'application/json'
|
30
30
|
}
|
31
31
|
|
32
32
|
# Prepare and execute HttpRequest.
|
@@ -47,15 +47,15 @@ module Square
|
|
47
47
|
end
|
48
48
|
|
49
49
|
# Creates multiple `TeamMember` objects. The created `TeamMember` objects
|
50
|
-
#
|
51
|
-
# This process is non-transactional and
|
52
|
-
#
|
53
|
-
# the request cannot be successfully processed, the request
|
54
|
-
#
|
55
|
-
#
|
56
|
-
# Learn about [Troubleshooting the
|
57
|
-
# API](https://developer.squareup.com/docs/team/troubleshooting#
|
58
|
-
#
|
50
|
+
# are returned on successful creates.
|
51
|
+
# This process is non-transactional and processes as much of the request as
|
52
|
+
# possible. If one of the creates in
|
53
|
+
# the request cannot be successfully processed, the request is not marked as
|
54
|
+
# failed, but the body of the response
|
55
|
+
# contains explicit error information for the failed create.
|
56
|
+
# Learn about [Troubleshooting the Team
|
57
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#bulk-create-
|
58
|
+
# team-members).
|
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.
|
@@ -69,7 +69,7 @@ module Square
|
|
69
69
|
# Prepare headers.
|
70
70
|
_headers = {
|
71
71
|
'accept' => 'application/json',
|
72
|
-
'
|
72
|
+
'Content-Type' => 'application/json'
|
73
73
|
}
|
74
74
|
|
75
75
|
# Prepare and execute HttpRequest.
|
@@ -90,15 +90,15 @@ module Square
|
|
90
90
|
end
|
91
91
|
|
92
92
|
# Updates multiple `TeamMember` objects. The updated `TeamMember` objects
|
93
|
-
#
|
94
|
-
# This process is non-transactional and
|
95
|
-
#
|
96
|
-
# the request cannot be successfully processed, the request
|
97
|
-
#
|
98
|
-
#
|
99
|
-
# Learn about [Troubleshooting the
|
100
|
-
# API](https://developer.squareup.com/docs/team/troubleshooting#
|
101
|
-
#
|
93
|
+
# are returned on successful updates.
|
94
|
+
# This process is non-transactional and processes as much of the request as
|
95
|
+
# possible. If one of the updates in
|
96
|
+
# the request cannot be successfully processed, the request is not marked as
|
97
|
+
# failed, but the body of the response
|
98
|
+
# contains explicit error information for the failed update.
|
99
|
+
# Learn about [Troubleshooting the Team
|
100
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-
|
101
|
+
# team-members).
|
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.
|
@@ -112,7 +112,7 @@ module Square
|
|
112
112
|
# Prepare headers.
|
113
113
|
_headers = {
|
114
114
|
'accept' => 'application/json',
|
115
|
-
'
|
115
|
+
'Content-Type' => 'application/json'
|
116
116
|
}
|
117
117
|
|
118
118
|
# Prepare and execute HttpRequest.
|
@@ -133,8 +133,8 @@ module Square
|
|
133
133
|
end
|
134
134
|
|
135
135
|
# Returns a paginated list of `TeamMember` objects for a business.
|
136
|
-
# The list
|
137
|
-
# - location IDs
|
136
|
+
# The list can be filtered by the following:
|
137
|
+
# - location IDs
|
138
138
|
# - `status`
|
139
139
|
# @param [SearchTeamMembersRequest] body Required parameter: An object
|
140
140
|
# containing the fields to POST for the request. See the corresponding
|
@@ -149,7 +149,7 @@ module Square
|
|
149
149
|
# Prepare headers.
|
150
150
|
_headers = {
|
151
151
|
'accept' => 'application/json',
|
152
|
-
'
|
152
|
+
'Content-Type' => 'application/json'
|
153
153
|
}
|
154
154
|
|
155
155
|
# Prepare and execute HttpRequest.
|
@@ -169,10 +169,10 @@ module Square
|
|
169
169
|
)
|
170
170
|
end
|
171
171
|
|
172
|
-
#
|
173
|
-
# Learn about [Troubleshooting the
|
174
|
-
# API](https://developer.squareup.com/docs/team/troubleshooting#
|
175
|
-
# member).
|
172
|
+
# Retrieves a `TeamMember` object for the given `TeamMember.id`.
|
173
|
+
# Learn about [Troubleshooting the Team
|
174
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-t
|
175
|
+
# eam-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
|
@@ -207,11 +207,11 @@ module Square
|
|
207
207
|
)
|
208
208
|
end
|
209
209
|
|
210
|
-
# Updates a single `TeamMember` object. The `TeamMember`
|
211
|
-
# successful updates.
|
212
|
-
# Learn about [Troubleshooting the
|
213
|
-
# API](https://developer.squareup.com/docs/team/troubleshooting#
|
214
|
-
#
|
210
|
+
# Updates a single `TeamMember` object. The `TeamMember` object is returned
|
211
|
+
# on successful updates.
|
212
|
+
# Learn about [Troubleshooting the Team
|
213
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#update-a-tea
|
214
|
+
# m-member).
|
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
|
@@ -232,7 +232,7 @@ module Square
|
|
232
232
|
# Prepare headers.
|
233
233
|
_headers = {
|
234
234
|
'accept' => 'application/json',
|
235
|
-
'
|
235
|
+
'Content-Type' => 'application/json'
|
236
236
|
}
|
237
237
|
|
238
238
|
# Prepare and execute HttpRequest.
|
@@ -252,13 +252,13 @@ module Square
|
|
252
252
|
)
|
253
253
|
end
|
254
254
|
|
255
|
-
#
|
255
|
+
# Retrieves a `WageSetting` object for a team member specified
|
256
256
|
# by `TeamMember.id`.
|
257
|
-
# Learn about [Troubleshooting the
|
257
|
+
# Learn about [Troubleshooting the Team
|
258
258
|
# API](https://developer.squareup.com/docs/team/troubleshooting#retrievewage
|
259
259
|
# setting).
|
260
260
|
# @param [String] team_member_id Required parameter: The ID of the team
|
261
|
-
# member to retrieve wage setting
|
261
|
+
# member for which to retrieve the wage setting.
|
262
262
|
# @return [RetrieveWageSettingResponse Hash] response from the API call
|
263
263
|
def retrieve_wage_setting(team_member_id:)
|
264
264
|
# Prepare query url.
|
@@ -295,12 +295,12 @@ module Square
|
|
295
295
|
# `WageSetting` with the specified `team_member_id` does not exist.
|
296
296
|
# Otherwise,
|
297
297
|
# it fully replaces the `WageSetting` object for the team member.
|
298
|
-
# The `WageSetting`
|
299
|
-
# Learn about [Troubleshooting the
|
300
|
-
# API](https://developer.squareup.com/docs/team/troubleshooting#
|
301
|
-
#
|
298
|
+
# The `WageSetting` is returned on a successful update.
|
299
|
+
# Learn about [Troubleshooting the Team
|
300
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#create-or-up
|
301
|
+
# date-a-wage-setting).
|
302
302
|
# @param [String] team_member_id Required parameter: The ID of the team
|
303
|
-
# member to update the `WageSetting` object
|
303
|
+
# member for which to update the `WageSetting` object.
|
304
304
|
# @param [UpdateWageSettingRequest] body Required parameter: An object
|
305
305
|
# containing the fields to POST for the request. See the corresponding
|
306
306
|
# object definition for field details.
|
@@ -319,7 +319,7 @@ module Square
|
|
319
319
|
# Prepare headers.
|
320
320
|
_headers = {
|
321
321
|
'accept' => 'application/json',
|
322
|
-
'
|
322
|
+
'Content-Type' => 'application/json'
|
323
323
|
}
|
324
324
|
|
325
325
|
# Prepare and execute HttpRequest.
|