square.rb 6.2.0.20200812 → 8.0.0.20201216
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 +34 -33
- data/lib/square.rb +61 -62
- 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 +308 -0
- data/lib/square/api/cash_drawers_api.rb +13 -6
- data/lib/square/api/catalog_api.rb +68 -32
- 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 +71 -68
- 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 +42 -38
- 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 +29 -28
- 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 -31
- data/lib/square/api/v1_items_api.rb +195 -115
- data/lib/square/api/v1_transactions_api.rb +49 -27
- data/lib/square/api_helper.rb +14 -9
- data/lib/square/client.rb +14 -20
- 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 +33 -16
- data/lib/square/api/reporting_api.rb +0 -138
- data/lib/square/api/v1_locations_api.rb +0 -65
@@ -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,13 +127,15 @@ 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
|
138
136
|
# associated Order status changes to CANCELED. You can only delete a draft
|
139
|
-
# invoice (you cannot delete
|
140
|
-
#
|
137
|
+
# invoice (you cannot delete a published invoice, including one that is
|
138
|
+
# scheduled for processing).
|
141
139
|
# @param [String] invoice_id Required parameter: The ID of the invoice to
|
142
140
|
# delete.
|
143
141
|
# @param [Integer] version Optional parameter: The version of 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,18 +209,20 @@ 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
|
-
# Updates an invoice by modifying
|
216
|
-
#
|
217
|
-
#
|
218
|
-
#
|
219
|
-
# However,
|
220
|
-
#
|
221
|
-
#
|
222
|
-
#
|
223
|
-
# @param [String] invoice_id Required parameter: The
|
217
|
+
# Updates an invoice by modifying fields, clearing fields, or both. For most
|
218
|
+
# updates, you can use a sparse
|
219
|
+
# `Invoice` object to add fields or change values, and use the
|
220
|
+
# `fields_to_clear` field to specify fields to clear.
|
221
|
+
# However, some restrictions apply. For example, you cannot change the
|
222
|
+
# `order_id` or `location_id` field, and you
|
223
|
+
# must provide the complete `custom_fields` list to update a custom field.
|
224
|
+
# Published invoices have additional restrictions.
|
225
|
+
# @param [String] invoice_id Required parameter: The ID of the invoice to
|
224
226
|
# update.
|
225
227
|
# @param [UpdateInvoiceRequest] body Required parameter: An object
|
226
228
|
# containing the fields to POST for the request. See the corresponding
|
@@ -233,7 +235,7 @@ module Square
|
|
233
235
|
_query_builder << '/v2/invoices/{invoice_id}'
|
234
236
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
235
237
|
_query_builder,
|
236
|
-
'invoice_id' => invoice_id
|
238
|
+
'invoice_id' => { 'value' => invoice_id, 'encode' => true }
|
237
239
|
)
|
238
240
|
_query_url = APIHelper.clean_url _query_builder
|
239
241
|
|
@@ -255,7 +257,9 @@ module Square
|
|
255
257
|
# Return appropriate response type.
|
256
258
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
257
259
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
258
|
-
ApiResponse.new(
|
260
|
+
ApiResponse.new(
|
261
|
+
_response, data: decoded, errors: _errors
|
262
|
+
)
|
259
263
|
end
|
260
264
|
|
261
265
|
# Cancels an invoice. The seller cannot collect payments for
|
@@ -275,7 +279,7 @@ module Square
|
|
275
279
|
_query_builder << '/v2/invoices/{invoice_id}/cancel'
|
276
280
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
277
281
|
_query_builder,
|
278
|
-
'invoice_id' => invoice_id
|
282
|
+
'invoice_id' => { 'value' => invoice_id, 'encode' => true }
|
279
283
|
)
|
280
284
|
_query_url = APIHelper.clean_url _query_builder
|
281
285
|
|
@@ -297,7 +301,9 @@ module Square
|
|
297
301
|
# Return appropriate response type.
|
298
302
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
299
303
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
300
|
-
ApiResponse.new(
|
304
|
+
ApiResponse.new(
|
305
|
+
_response, data: decoded, errors: _errors
|
306
|
+
)
|
301
307
|
end
|
302
308
|
|
303
309
|
# Publishes the specified draft invoice.
|
@@ -313,10 +319,6 @@ module Square
|
|
313
319
|
# Square emails the invoice or `PARTIALLY_PAID` if Square charge a card on
|
314
320
|
# file for a portion of the
|
315
321
|
# 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
322
|
# @param [String] invoice_id Required parameter: The id of the invoice to
|
321
323
|
# publish.
|
322
324
|
# @param [PublishInvoiceRequest] body Required parameter: An object
|
@@ -330,7 +332,7 @@ module Square
|
|
330
332
|
_query_builder << '/v2/invoices/{invoice_id}/publish'
|
331
333
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
332
334
|
_query_builder,
|
333
|
-
'invoice_id' => invoice_id
|
335
|
+
'invoice_id' => { 'value' => invoice_id, 'encode' => true }
|
334
336
|
)
|
335
337
|
_query_url = APIHelper.clean_url _query_builder
|
336
338
|
|
@@ -352,7 +354,9 @@ module Square
|
|
352
354
|
# Return appropriate response type.
|
353
355
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
354
356
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
355
|
-
ApiResponse.new(
|
357
|
+
ApiResponse.new(
|
358
|
+
_response, data: decoded, errors: _errors
|
359
|
+
)
|
356
360
|
end
|
357
361
|
end
|
358
362
|
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
|