square.rb 6.1.0.20200722 → 7.0.0.20201118
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 +38 -31
- data/lib/square.rb +62 -61
- data/lib/square/api/apple_pay_api.rb +5 -3
- data/lib/square/api/bank_accounts_api.rb +16 -19
- 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 +13 -6
- data/lib/square/api/catalog_api.rb +50 -28
- 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 +9 -5
- 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 +39 -34
- data/lib/square/api/employees_api.rb +10 -5
- data/lib/square/api/inventory_api.rb +30 -15
- data/lib/square/api/invoices_api.rb +31 -30
- data/lib/square/api/labor_api.rb +131 -22
- data/lib/square/api/locations_api.rb +16 -13
- data/lib/square/api/loyalty_api.rb +60 -66
- data/lib/square/api/merchants_api.rb +7 -3
- data/lib/square/api/mobile_authorization_api.rb +5 -3
- data/lib/square/api/o_auth_api.rb +11 -8
- data/lib/square/api/orders_api.rb +111 -90
- data/lib/square/api/payments_api.rb +75 -65
- data/lib/square/api/refunds_api.rb +37 -27
- data/lib/square/api/subscriptions_api.rb +263 -0
- data/lib/square/api/team_api.rb +46 -30
- 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 +20 -14
- data/lib/square/configuration.rb +2 -2
- data/lib/square/http/api_response.rb +2 -0
- data/lib/square/http/faraday_client.rb +9 -2
- data/spec/user_journey_spec.rb +2 -5
- data/test/api/api_test_base.rb +1 -6
- data/test/api/test_catalog_api.rb +1 -4
- data/test/api/test_customers_api.rb +1 -4
- data/test/api/test_employees_api.rb +1 -4
- data/test/api/test_labor_api.rb +2 -6
- data/test/api/test_locations_api.rb +22 -33
- data/test/api/test_merchants_api.rb +1 -4
- data/test/api/test_payments_api.rb +3 -6
- data/test/api/test_refunds_api.rb +3 -6
- data/test/http_response_catcher.rb +0 -5
- data/test/test_helper.rb +0 -5
- metadata +34 -15
- data/lib/square/api/reporting_api.rb +0 -138
@@ -8,16 +8,13 @@ module Square
|
|
8
8
|
# Returns a list of invoices for a given location. The response
|
9
9
|
# is paginated. If truncated, the response includes a `cursor` that you
|
10
10
|
# use in a subsequent request to fetch the next set of invoices.
|
11
|
-
# For more information about retrieving invoices, see [Retrieve
|
12
|
-
# invoices](https://developer.squareup.com/docs/docs/invoices-api/overview#r
|
13
|
-
# etrieve-invoices).
|
14
11
|
# @param [String] location_id Required parameter: The ID of the location for
|
15
12
|
# which to list invoices.
|
16
13
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
17
14
|
# a previous call to this endpoint. Provide this cursor to retrieve the
|
18
15
|
# next set of results for your original query. For more information, see
|
19
|
-
# [Pagination](https://developer.squareup.com/docs/
|
20
|
-
#
|
16
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
17
|
+
# ion).
|
21
18
|
# @param [Integer] limit Optional parameter: The maximum number of invoices
|
22
19
|
# to return (200 is the maximum `limit`). If not provided, the server uses
|
23
20
|
# a default limit of 100 invoices.
|
@@ -52,7 +49,9 @@ module Square
|
|
52
49
|
# Return appropriate response type.
|
53
50
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
54
51
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
55
|
-
ApiResponse.new(
|
52
|
+
ApiResponse.new(
|
53
|
+
_response, data: decoded, errors: _errors
|
54
|
+
)
|
56
55
|
end
|
57
56
|
|
58
57
|
# Creates a draft [invoice](#type-invoice)
|
@@ -60,8 +59,6 @@ module Square
|
|
60
59
|
# A draft invoice remains in your account and no action is taken.
|
61
60
|
# You must publish the invoice before Square can process it (send it to the
|
62
61
|
# customer's email address or charge the customer’s card on file).
|
63
|
-
# For more information, see [Manage Invoices Using the Invoices
|
64
|
-
# API](https://developer.squareup.com/docs/docs/invoices-api/overview).
|
65
62
|
# @param [CreateInvoiceRequest] body Required parameter: An object
|
66
63
|
# containing the fields to POST for the request. See the corresponding
|
67
64
|
# object definition for field details.
|
@@ -90,7 +87,9 @@ module Square
|
|
90
87
|
# Return appropriate response type.
|
91
88
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
92
89
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
93
|
-
ApiResponse.new(
|
90
|
+
ApiResponse.new(
|
91
|
+
_response, data: decoded, errors: _errors
|
92
|
+
)
|
94
93
|
end
|
95
94
|
|
96
95
|
# Searches for invoices from a location specified in
|
@@ -100,9 +99,6 @@ module Square
|
|
100
99
|
# optionally one customer.
|
101
100
|
# The response is paginated. If truncated, the response includes a `cursor`
|
102
101
|
# that you use in a subsequent request to fetch the next set of invoices.
|
103
|
-
# For more information about retrieving invoices, see [Retrieve
|
104
|
-
# invoices](https://developer.squareup.com/docs/docs/invoices-api/overview#r
|
105
|
-
# etrieve-invoices).
|
106
102
|
# @param [SearchInvoicesRequest] body Required parameter: An object
|
107
103
|
# containing the fields to POST for the request. See the corresponding
|
108
104
|
# object definition for field details.
|
@@ -131,7 +127,9 @@ module Square
|
|
131
127
|
# Return appropriate response type.
|
132
128
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
133
129
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
134
|
-
ApiResponse.new(
|
130
|
+
ApiResponse.new(
|
131
|
+
_response, data: decoded, errors: _errors
|
132
|
+
)
|
135
133
|
end
|
136
134
|
|
137
135
|
# Deletes the specified invoice. When an invoice is deleted, the
|
@@ -152,7 +150,7 @@ module Square
|
|
152
150
|
_query_builder << '/v2/invoices/{invoice_id}'
|
153
151
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
154
152
|
_query_builder,
|
155
|
-
'invoice_id' => invoice_id
|
153
|
+
'invoice_id' => { 'value' => invoice_id, 'encode' => true }
|
156
154
|
)
|
157
155
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
158
156
|
_query_builder,
|
@@ -176,7 +174,9 @@ module Square
|
|
176
174
|
# Return appropriate response type.
|
177
175
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
178
176
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
179
|
-
ApiResponse.new(
|
177
|
+
ApiResponse.new(
|
178
|
+
_response, data: decoded, errors: _errors
|
179
|
+
)
|
180
180
|
end
|
181
181
|
|
182
182
|
# Retrieves an invoice by invoice ID.
|
@@ -189,7 +189,7 @@ module Square
|
|
189
189
|
_query_builder << '/v2/invoices/{invoice_id}'
|
190
190
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
191
191
|
_query_builder,
|
192
|
-
'invoice_id' => invoice_id
|
192
|
+
'invoice_id' => { 'value' => invoice_id, 'encode' => true }
|
193
193
|
)
|
194
194
|
_query_url = APIHelper.clean_url _query_builder
|
195
195
|
|
@@ -209,7 +209,9 @@ module Square
|
|
209
209
|
# Return appropriate response type.
|
210
210
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
211
211
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
212
|
-
ApiResponse.new(
|
212
|
+
ApiResponse.new(
|
213
|
+
_response, data: decoded, errors: _errors
|
214
|
+
)
|
213
215
|
end
|
214
216
|
|
215
217
|
# Updates an invoice by modifying field values, clearing field values, or
|
@@ -217,9 +219,6 @@ module Square
|
|
217
219
|
# as specified in the request.
|
218
220
|
# There are no restrictions to updating an invoice in a draft state.
|
219
221
|
# However, there are guidelines for updating a published invoice.
|
220
|
-
# For more information, see [Update an
|
221
|
-
# invoice](https://developer.squareup.com/docs/docs/invoices-api/overview#up
|
222
|
-
# date-an-invoice).
|
223
222
|
# @param [String] invoice_id Required parameter: The id of the invoice to
|
224
223
|
# update.
|
225
224
|
# @param [UpdateInvoiceRequest] body Required parameter: An object
|
@@ -233,7 +232,7 @@ module Square
|
|
233
232
|
_query_builder << '/v2/invoices/{invoice_id}'
|
234
233
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
235
234
|
_query_builder,
|
236
|
-
'invoice_id' => invoice_id
|
235
|
+
'invoice_id' => { 'value' => invoice_id, 'encode' => true }
|
237
236
|
)
|
238
237
|
_query_url = APIHelper.clean_url _query_builder
|
239
238
|
|
@@ -255,7 +254,9 @@ module Square
|
|
255
254
|
# Return appropriate response type.
|
256
255
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
257
256
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
258
|
-
ApiResponse.new(
|
257
|
+
ApiResponse.new(
|
258
|
+
_response, data: decoded, errors: _errors
|
259
|
+
)
|
259
260
|
end
|
260
261
|
|
261
262
|
# Cancels an invoice. The seller cannot collect payments for
|
@@ -275,7 +276,7 @@ module Square
|
|
275
276
|
_query_builder << '/v2/invoices/{invoice_id}/cancel'
|
276
277
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
277
278
|
_query_builder,
|
278
|
-
'invoice_id' => invoice_id
|
279
|
+
'invoice_id' => { 'value' => invoice_id, 'encode' => true }
|
279
280
|
)
|
280
281
|
_query_url = APIHelper.clean_url _query_builder
|
281
282
|
|
@@ -297,7 +298,9 @@ module Square
|
|
297
298
|
# Return appropriate response type.
|
298
299
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
299
300
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
300
|
-
ApiResponse.new(
|
301
|
+
ApiResponse.new(
|
302
|
+
_response, data: decoded, errors: _errors
|
303
|
+
)
|
301
304
|
end
|
302
305
|
|
303
306
|
# Publishes the specified draft invoice.
|
@@ -313,10 +316,6 @@ module Square
|
|
313
316
|
# Square emails the invoice or `PARTIALLY_PAID` if Square charge a card on
|
314
317
|
# file for a portion of the
|
315
318
|
# invoice amount).
|
316
|
-
# For more information, see
|
317
|
-
# [Create and publish an
|
318
|
-
# invoice](https://developer.squareup.com/docs/docs/invoices-api/overview#cr
|
319
|
-
# eate-and-publish-an-invoice).
|
320
319
|
# @param [String] invoice_id Required parameter: The id of the invoice to
|
321
320
|
# publish.
|
322
321
|
# @param [PublishInvoiceRequest] body Required parameter: An object
|
@@ -330,7 +329,7 @@ module Square
|
|
330
329
|
_query_builder << '/v2/invoices/{invoice_id}/publish'
|
331
330
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
332
331
|
_query_builder,
|
333
|
-
'invoice_id' => invoice_id
|
332
|
+
'invoice_id' => { 'value' => invoice_id, 'encode' => true }
|
334
333
|
)
|
335
334
|
_query_url = APIHelper.clean_url _query_builder
|
336
335
|
|
@@ -352,7 +351,9 @@ module Square
|
|
352
351
|
# Return appropriate response type.
|
353
352
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
354
353
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
355
|
-
ApiResponse.new(
|
354
|
+
ApiResponse.new(
|
355
|
+
_response, data: decoded, errors: _errors
|
356
|
+
)
|
356
357
|
end
|
357
358
|
end
|
358
359
|
end
|
data/lib/square/api/labor_api.rb
CHANGED
@@ -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
|
# Creates a new `BreakType`.
|
@@ -88,7 +90,9 @@ module Square
|
|
88
90
|
# Return appropriate response type.
|
89
91
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
90
92
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
91
|
-
ApiResponse.new(
|
93
|
+
ApiResponse.new(
|
94
|
+
_response, data: decoded, errors: _errors
|
95
|
+
)
|
92
96
|
end
|
93
97
|
|
94
98
|
# Deletes an existing `BreakType`.
|
@@ -102,7 +106,7 @@ module Square
|
|
102
106
|
_query_builder << '/v2/labor/break-types/{id}'
|
103
107
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
104
108
|
_query_builder,
|
105
|
-
'id' => id
|
109
|
+
'id' => { 'value' => id, 'encode' => true }
|
106
110
|
)
|
107
111
|
_query_url = APIHelper.clean_url _query_builder
|
108
112
|
|
@@ -122,7 +126,9 @@ module Square
|
|
122
126
|
# Return appropriate response type.
|
123
127
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
124
128
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
125
|
-
ApiResponse.new(
|
129
|
+
ApiResponse.new(
|
130
|
+
_response, data: decoded, errors: _errors
|
131
|
+
)
|
126
132
|
end
|
127
133
|
|
128
134
|
# Returns a single `BreakType` specified by id.
|
@@ -135,7 +141,7 @@ module Square
|
|
135
141
|
_query_builder << '/v2/labor/break-types/{id}'
|
136
142
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
137
143
|
_query_builder,
|
138
|
-
'id' => id
|
144
|
+
'id' => { 'value' => id, 'encode' => true }
|
139
145
|
)
|
140
146
|
_query_url = APIHelper.clean_url _query_builder
|
141
147
|
|
@@ -155,7 +161,9 @@ module Square
|
|
155
161
|
# Return appropriate response type.
|
156
162
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
157
163
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
158
|
-
ApiResponse.new(
|
164
|
+
ApiResponse.new(
|
165
|
+
_response, data: decoded, errors: _errors
|
166
|
+
)
|
159
167
|
end
|
160
168
|
|
161
169
|
# Updates an existing `BreakType`.
|
@@ -172,7 +180,7 @@ module Square
|
|
172
180
|
_query_builder << '/v2/labor/break-types/{id}'
|
173
181
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
174
182
|
_query_builder,
|
175
|
-
'id' => id
|
183
|
+
'id' => { 'value' => id, 'encode' => true }
|
176
184
|
)
|
177
185
|
_query_url = APIHelper.clean_url _query_builder
|
178
186
|
|
@@ -194,7 +202,9 @@ module Square
|
|
194
202
|
# Return appropriate response type.
|
195
203
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
196
204
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
197
|
-
ApiResponse.new(
|
205
|
+
ApiResponse.new(
|
206
|
+
_response, data: decoded, errors: _errors
|
207
|
+
)
|
198
208
|
end
|
199
209
|
|
200
210
|
# Returns a paginated list of `EmployeeWage` instances for a business.
|
@@ -209,6 +219,7 @@ module Square
|
|
209
219
|
def list_employee_wages(employee_id: nil,
|
210
220
|
limit: nil,
|
211
221
|
cursor: nil)
|
222
|
+
warn 'Endpoint list_employee_wages in LaborApi is deprecated'
|
212
223
|
# Prepare query url.
|
213
224
|
_query_builder = config.get_base_uri
|
214
225
|
_query_builder << '/v2/labor/employee-wages'
|
@@ -236,7 +247,9 @@ module Square
|
|
236
247
|
# Return appropriate response type.
|
237
248
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
238
249
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
239
|
-
ApiResponse.new(
|
250
|
+
ApiResponse.new(
|
251
|
+
_response, data: decoded, errors: _errors
|
252
|
+
)
|
240
253
|
end
|
241
254
|
|
242
255
|
# Returns a single `EmployeeWage` specified by id.
|
@@ -244,12 +257,13 @@ module Square
|
|
244
257
|
# retrieved.
|
245
258
|
# @return [GetEmployeeWageResponse Hash] response from the API call
|
246
259
|
def get_employee_wage(id:)
|
260
|
+
warn 'Endpoint get_employee_wage in LaborApi is deprecated'
|
247
261
|
# Prepare query url.
|
248
262
|
_query_builder = config.get_base_uri
|
249
263
|
_query_builder << '/v2/labor/employee-wages/{id}'
|
250
264
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
251
265
|
_query_builder,
|
252
|
-
'id' => id
|
266
|
+
'id' => { 'value' => id, 'encode' => true }
|
253
267
|
)
|
254
268
|
_query_url = APIHelper.clean_url _query_builder
|
255
269
|
|
@@ -269,7 +283,9 @@ module Square
|
|
269
283
|
# Return appropriate response type.
|
270
284
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
271
285
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
272
|
-
ApiResponse.new(
|
286
|
+
ApiResponse.new(
|
287
|
+
_response, data: decoded, errors: _errors
|
288
|
+
)
|
273
289
|
end
|
274
290
|
|
275
291
|
# Creates a new `Shift`.
|
@@ -317,7 +333,9 @@ module Square
|
|
317
333
|
# Return appropriate response type.
|
318
334
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
319
335
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
320
|
-
ApiResponse.new(
|
336
|
+
ApiResponse.new(
|
337
|
+
_response, data: decoded, errors: _errors
|
338
|
+
)
|
321
339
|
end
|
322
340
|
|
323
341
|
# Returns a paginated list of `Shift` records for a business.
|
@@ -361,7 +379,9 @@ module Square
|
|
361
379
|
# Return appropriate response type.
|
362
380
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
363
381
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
364
|
-
ApiResponse.new(
|
382
|
+
ApiResponse.new(
|
383
|
+
_response, data: decoded, errors: _errors
|
384
|
+
)
|
365
385
|
end
|
366
386
|
|
367
387
|
# Deletes a `Shift`.
|
@@ -374,7 +394,7 @@ module Square
|
|
374
394
|
_query_builder << '/v2/labor/shifts/{id}'
|
375
395
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
376
396
|
_query_builder,
|
377
|
-
'id' => id
|
397
|
+
'id' => { 'value' => id, 'encode' => true }
|
378
398
|
)
|
379
399
|
_query_url = APIHelper.clean_url _query_builder
|
380
400
|
|
@@ -394,7 +414,9 @@ module Square
|
|
394
414
|
# Return appropriate response type.
|
395
415
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
396
416
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
397
|
-
ApiResponse.new(
|
417
|
+
ApiResponse.new(
|
418
|
+
_response, data: decoded, errors: _errors
|
419
|
+
)
|
398
420
|
end
|
399
421
|
|
400
422
|
# Returns a single `Shift` specified by id.
|
@@ -407,7 +429,7 @@ module Square
|
|
407
429
|
_query_builder << '/v2/labor/shifts/{id}'
|
408
430
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
409
431
|
_query_builder,
|
410
|
-
'id' => id
|
432
|
+
'id' => { 'value' => id, 'encode' => true }
|
411
433
|
)
|
412
434
|
_query_url = APIHelper.clean_url _query_builder
|
413
435
|
|
@@ -427,7 +449,9 @@ module Square
|
|
427
449
|
# Return appropriate response type.
|
428
450
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
429
451
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
430
|
-
ApiResponse.new(
|
452
|
+
ApiResponse.new(
|
453
|
+
_response, data: decoded, errors: _errors
|
454
|
+
)
|
431
455
|
end
|
432
456
|
|
433
457
|
# Updates an existing `Shift`.
|
@@ -449,7 +473,7 @@ module Square
|
|
449
473
|
_query_builder << '/v2/labor/shifts/{id}'
|
450
474
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
451
475
|
_query_builder,
|
452
|
-
'id' => id
|
476
|
+
'id' => { 'value' => id, 'encode' => true }
|
453
477
|
)
|
454
478
|
_query_url = APIHelper.clean_url _query_builder
|
455
479
|
|
@@ -471,7 +495,88 @@ module Square
|
|
471
495
|
# Return appropriate response type.
|
472
496
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
473
497
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
474
|
-
ApiResponse.new(
|
498
|
+
ApiResponse.new(
|
499
|
+
_response, data: decoded, errors: _errors
|
500
|
+
)
|
501
|
+
end
|
502
|
+
|
503
|
+
# Returns a paginated list of `TeamMemberWage` instances for a business.
|
504
|
+
# @param [String] team_member_id Optional parameter: Filter wages returned
|
505
|
+
# to only those that are associated with the specified team member.
|
506
|
+
# @param [Integer] limit Optional parameter: Maximum number of Team Member
|
507
|
+
# Wages to return per page. Can range between 1 and 200. The default is the
|
508
|
+
# maximum at 200.
|
509
|
+
# @param [String] cursor Optional parameter: Pointer to the next page of
|
510
|
+
# Employee Wage results to fetch.
|
511
|
+
# @return [ListTeamMemberWagesResponse Hash] response from the API call
|
512
|
+
def list_team_member_wages(team_member_id: nil,
|
513
|
+
limit: nil,
|
514
|
+
cursor: nil)
|
515
|
+
# Prepare query url.
|
516
|
+
_query_builder = config.get_base_uri
|
517
|
+
_query_builder << '/v2/labor/team-member-wages'
|
518
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
519
|
+
_query_builder,
|
520
|
+
'team_member_id' => team_member_id,
|
521
|
+
'limit' => limit,
|
522
|
+
'cursor' => cursor
|
523
|
+
)
|
524
|
+
_query_url = APIHelper.clean_url _query_builder
|
525
|
+
|
526
|
+
# Prepare headers.
|
527
|
+
_headers = {
|
528
|
+
'accept' => 'application/json'
|
529
|
+
}
|
530
|
+
|
531
|
+
# Prepare and execute HttpRequest.
|
532
|
+
_request = config.http_client.get(
|
533
|
+
_query_url,
|
534
|
+
headers: _headers
|
535
|
+
)
|
536
|
+
OAuth2.apply(config, _request)
|
537
|
+
_response = execute_request(_request)
|
538
|
+
|
539
|
+
# Return appropriate response type.
|
540
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
541
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
542
|
+
ApiResponse.new(
|
543
|
+
_response, data: decoded, errors: _errors
|
544
|
+
)
|
545
|
+
end
|
546
|
+
|
547
|
+
# Returns a single `TeamMemberWage` specified by id.
|
548
|
+
# @param [String] id Required parameter: UUID for the `TeamMemberWage` being
|
549
|
+
# retrieved.
|
550
|
+
# @return [GetTeamMemberWageResponse Hash] response from the API call
|
551
|
+
def get_team_member_wage(id:)
|
552
|
+
# Prepare query url.
|
553
|
+
_query_builder = config.get_base_uri
|
554
|
+
_query_builder << '/v2/labor/team-member-wages/{id}'
|
555
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
556
|
+
_query_builder,
|
557
|
+
'id' => { 'value' => id, 'encode' => true }
|
558
|
+
)
|
559
|
+
_query_url = APIHelper.clean_url _query_builder
|
560
|
+
|
561
|
+
# Prepare headers.
|
562
|
+
_headers = {
|
563
|
+
'accept' => 'application/json'
|
564
|
+
}
|
565
|
+
|
566
|
+
# Prepare and execute HttpRequest.
|
567
|
+
_request = config.http_client.get(
|
568
|
+
_query_url,
|
569
|
+
headers: _headers
|
570
|
+
)
|
571
|
+
OAuth2.apply(config, _request)
|
572
|
+
_response = execute_request(_request)
|
573
|
+
|
574
|
+
# Return appropriate response type.
|
575
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
576
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
577
|
+
ApiResponse.new(
|
578
|
+
_response, data: decoded, errors: _errors
|
579
|
+
)
|
475
580
|
end
|
476
581
|
|
477
582
|
# Returns a list of `WorkweekConfig` instances for a business.
|
@@ -508,7 +613,9 @@ module Square
|
|
508
613
|
# Return appropriate response type.
|
509
614
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
510
615
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
511
|
-
ApiResponse.new(
|
616
|
+
ApiResponse.new(
|
617
|
+
_response, data: decoded, errors: _errors
|
618
|
+
)
|
512
619
|
end
|
513
620
|
|
514
621
|
# Updates a `WorkweekConfig`.
|
@@ -525,7 +632,7 @@ module Square
|
|
525
632
|
_query_builder << '/v2/labor/workweek-configs/{id}'
|
526
633
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
527
634
|
_query_builder,
|
528
|
-
'id' => id
|
635
|
+
'id' => { 'value' => id, 'encode' => true }
|
529
636
|
)
|
530
637
|
_query_url = APIHelper.clean_url _query_builder
|
531
638
|
|
@@ -547,7 +654,9 @@ module Square
|
|
547
654
|
# Return appropriate response type.
|
548
655
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
549
656
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
550
|
-
ApiResponse.new(
|
657
|
+
ApiResponse.new(
|
658
|
+
_response, data: decoded, errors: _errors
|
659
|
+
)
|
551
660
|
end
|
552
661
|
end
|
553
662
|
end
|