fangkuai.rb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +10 -0
  3. data/README.md +1 -0
  4. data/lib/square.rb +61 -0
  5. data/lib/square/api/apple_pay_api.rb +50 -0
  6. data/lib/square/api/bank_accounts_api.rb +136 -0
  7. data/lib/square/api/base_api.rb +43 -0
  8. data/lib/square/api/cash_drawers_api.rb +150 -0
  9. data/lib/square/api/catalog_api.rb +572 -0
  10. data/lib/square/api/checkout_api.rb +49 -0
  11. data/lib/square/api/customer_groups_api.rb +182 -0
  12. data/lib/square/api/customer_segments_api.rb +78 -0
  13. data/lib/square/api/customers_api.rb +418 -0
  14. data/lib/square/api/devices_api.rb +120 -0
  15. data/lib/square/api/disputes_api.rb +398 -0
  16. data/lib/square/api/employees_api.rb +87 -0
  17. data/lib/square/api/inventory_api.rb +296 -0
  18. data/lib/square/api/invoices_api.rb +358 -0
  19. data/lib/square/api/labor_api.rb +630 -0
  20. data/lib/square/api/locations_api.rb +151 -0
  21. data/lib/square/api/loyalty_api.rb +543 -0
  22. data/lib/square/api/merchants_api.rb +83 -0
  23. data/lib/square/api/mobile_authorization_api.rb +52 -0
  24. data/lib/square/api/o_auth_api.rb +163 -0
  25. data/lib/square/api/orders_api.rb +280 -0
  26. data/lib/square/api/payments_api.rb +279 -0
  27. data/lib/square/api/refunds_api.rb +145 -0
  28. data/lib/square/api/subscriptions_api.rb +251 -0
  29. data/lib/square/api/team_api.rb +326 -0
  30. data/lib/square/api/terminal_api.rb +141 -0
  31. data/lib/square/api/transactions_api.rb +369 -0
  32. data/lib/square/api/v1_employees_api.rb +723 -0
  33. data/lib/square/api/v1_items_api.rb +1686 -0
  34. data/lib/square/api/v1_locations_api.rb +65 -0
  35. data/lib/square/api/v1_transactions_api.rb +572 -0
  36. data/lib/square/api_helper.rb +276 -0
  37. data/lib/square/client.rb +211 -0
  38. data/lib/square/configuration.rb +101 -0
  39. data/lib/square/exceptions/api_exception.rb +15 -0
  40. data/lib/square/http/api_response.rb +45 -0
  41. data/lib/square/http/auth/o_auth2.rb +12 -0
  42. data/lib/square/http/faraday_client.rb +55 -0
  43. data/lib/square/http/http_call_back.rb +19 -0
  44. data/lib/square/http/http_client.rb +99 -0
  45. data/lib/square/http/http_method_enum.rb +8 -0
  46. data/lib/square/http/http_request.rb +45 -0
  47. data/lib/square/http/http_response.rb +24 -0
  48. data/lib/square/utilities/file_wrapper.rb +12 -0
  49. data/spec/user_journey_spec.rb +148 -0
  50. data/test/api/api_test_base.rb +24 -0
  51. data/test/api/test_catalog_api.rb +59 -0
  52. data/test/api/test_customers_api.rb +45 -0
  53. data/test/api/test_employees_api.rb +36 -0
  54. data/test/api/test_labor_api.rb +74 -0
  55. data/test/api/test_locations_api.rb +35 -0
  56. data/test/api/test_merchants_api.rb +40 -0
  57. data/test/api/test_payments_api.rb +42 -0
  58. data/test/api/test_refunds_api.rb +41 -0
  59. data/test/http_response_catcher.rb +19 -0
  60. data/test/test_helper.rb +94 -0
  61. metadata +199 -0
@@ -0,0 +1,630 @@
1
+ module Square
2
+ # LaborApi
3
+ class LaborApi < BaseApi
4
+ def initialize(config, http_call_back: nil)
5
+ super(config, http_call_back: http_call_back)
6
+ end
7
+
8
+ # Returns a paginated list of `BreakType` instances for a business.
9
+ # @param [String] location_id Optional parameter: Filter Break Types
10
+ # returned to only those that are associated with the specified location.
11
+ # @param [Integer] limit Optional parameter: Maximum number of Break Types
12
+ # to return per page. Can range between 1 and 200. The default is the
13
+ # maximum at 200.
14
+ # @param [String] cursor Optional parameter: Pointer to the next page of
15
+ # Break Type results to fetch.
16
+ # @return [ListBreakTypesResponse Hash] response from the API call
17
+ def list_break_types(location_id: nil,
18
+ limit: nil,
19
+ cursor: nil)
20
+ # Prepare query url.
21
+ _query_builder = config.get_base_uri
22
+ _query_builder << '/v2/labor/break-types'
23
+ _query_builder = APIHelper.append_url_with_query_parameters(
24
+ _query_builder,
25
+ 'location_id' => location_id,
26
+ 'limit' => limit,
27
+ 'cursor' => cursor
28
+ )
29
+ _query_url = APIHelper.clean_url _query_builder
30
+
31
+ # Prepare headers.
32
+ _headers = {
33
+ 'accept' => 'application/json'
34
+ }
35
+
36
+ # Prepare and execute HttpRequest.
37
+ _request = config.http_client.get(
38
+ _query_url,
39
+ headers: _headers
40
+ )
41
+ OAuth2.apply(config, _request)
42
+ _response = execute_request(_request)
43
+
44
+ # Return appropriate response type.
45
+ decoded = APIHelper.json_deserialize(_response.raw_body)
46
+ _errors = APIHelper.map_response(decoded, ['errors'])
47
+ ApiResponse.new(_response, data: decoded, errors: _errors)
48
+ end
49
+
50
+ # Creates a new `BreakType`.
51
+ # A `BreakType` is a template for creating `Break` objects.
52
+ # You must provide the following values in your request to this
53
+ # endpoint:
54
+ # - `location_id`
55
+ # - `break_name`
56
+ # - `expected_duration`
57
+ # - `is_paid`
58
+ # You can only have 3 `BreakType` instances per location. If you attempt to
59
+ # add a 4th
60
+ # `BreakType` for a location, an `INVALID_REQUEST_ERROR` "Exceeded limit of
61
+ # 3 breaks per location."
62
+ # is returned.
63
+ # @param [CreateBreakTypeRequest] body Required parameter: An object
64
+ # containing the fields to POST for the request. See the corresponding
65
+ # object definition for field details.
66
+ # @return [CreateBreakTypeResponse Hash] response from the API call
67
+ def create_break_type(body:)
68
+ # Prepare query url.
69
+ _query_builder = config.get_base_uri
70
+ _query_builder << '/v2/labor/break-types'
71
+ _query_url = APIHelper.clean_url _query_builder
72
+
73
+ # Prepare headers.
74
+ _headers = {
75
+ 'accept' => 'application/json',
76
+ 'content-type' => 'application/json; charset=utf-8'
77
+ }
78
+
79
+ # Prepare and execute HttpRequest.
80
+ _request = config.http_client.post(
81
+ _query_url,
82
+ headers: _headers,
83
+ parameters: body.to_json
84
+ )
85
+ OAuth2.apply(config, _request)
86
+ _response = execute_request(_request)
87
+
88
+ # Return appropriate response type.
89
+ decoded = APIHelper.json_deserialize(_response.raw_body)
90
+ _errors = APIHelper.map_response(decoded, ['errors'])
91
+ ApiResponse.new(_response, data: decoded, errors: _errors)
92
+ end
93
+
94
+ # Deletes an existing `BreakType`.
95
+ # A `BreakType` can be deleted even if it is referenced from a `Shift`.
96
+ # @param [String] id Required parameter: UUID for the `BreakType` being
97
+ # deleted.
98
+ # @return [DeleteBreakTypeResponse Hash] response from the API call
99
+ def delete_break_type(id:)
100
+ # Prepare query url.
101
+ _query_builder = config.get_base_uri
102
+ _query_builder << '/v2/labor/break-types/{id}'
103
+ _query_builder = APIHelper.append_url_with_template_parameters(
104
+ _query_builder,
105
+ 'id' => id
106
+ )
107
+ _query_url = APIHelper.clean_url _query_builder
108
+
109
+ # Prepare headers.
110
+ _headers = {
111
+ 'accept' => 'application/json'
112
+ }
113
+
114
+ # Prepare and execute HttpRequest.
115
+ _request = config.http_client.delete(
116
+ _query_url,
117
+ headers: _headers
118
+ )
119
+ OAuth2.apply(config, _request)
120
+ _response = execute_request(_request)
121
+
122
+ # Return appropriate response type.
123
+ decoded = APIHelper.json_deserialize(_response.raw_body)
124
+ _errors = APIHelper.map_response(decoded, ['errors'])
125
+ ApiResponse.new(_response, data: decoded, errors: _errors)
126
+ end
127
+
128
+ # Returns a single `BreakType` specified by id.
129
+ # @param [String] id Required parameter: UUID for the `BreakType` being
130
+ # retrieved.
131
+ # @return [GetBreakTypeResponse Hash] response from the API call
132
+ def get_break_type(id:)
133
+ # Prepare query url.
134
+ _query_builder = config.get_base_uri
135
+ _query_builder << '/v2/labor/break-types/{id}'
136
+ _query_builder = APIHelper.append_url_with_template_parameters(
137
+ _query_builder,
138
+ 'id' => id
139
+ )
140
+ _query_url = APIHelper.clean_url _query_builder
141
+
142
+ # Prepare headers.
143
+ _headers = {
144
+ 'accept' => 'application/json'
145
+ }
146
+
147
+ # Prepare and execute HttpRequest.
148
+ _request = config.http_client.get(
149
+ _query_url,
150
+ headers: _headers
151
+ )
152
+ OAuth2.apply(config, _request)
153
+ _response = execute_request(_request)
154
+
155
+ # Return appropriate response type.
156
+ decoded = APIHelper.json_deserialize(_response.raw_body)
157
+ _errors = APIHelper.map_response(decoded, ['errors'])
158
+ ApiResponse.new(_response, data: decoded, errors: _errors)
159
+ end
160
+
161
+ # Updates an existing `BreakType`.
162
+ # @param [String] id Required parameter: UUID for the `BreakType` being
163
+ # updated.
164
+ # @param [UpdateBreakTypeRequest] body Required parameter: An object
165
+ # containing the fields to POST for the request. See the corresponding
166
+ # object definition for field details.
167
+ # @return [UpdateBreakTypeResponse Hash] response from the API call
168
+ def update_break_type(id:,
169
+ body:)
170
+ # Prepare query url.
171
+ _query_builder = config.get_base_uri
172
+ _query_builder << '/v2/labor/break-types/{id}'
173
+ _query_builder = APIHelper.append_url_with_template_parameters(
174
+ _query_builder,
175
+ 'id' => id
176
+ )
177
+ _query_url = APIHelper.clean_url _query_builder
178
+
179
+ # Prepare headers.
180
+ _headers = {
181
+ 'accept' => 'application/json',
182
+ 'content-type' => 'application/json; charset=utf-8'
183
+ }
184
+
185
+ # Prepare and execute HttpRequest.
186
+ _request = config.http_client.put(
187
+ _query_url,
188
+ headers: _headers,
189
+ parameters: body.to_json
190
+ )
191
+ OAuth2.apply(config, _request)
192
+ _response = execute_request(_request)
193
+
194
+ # Return appropriate response type.
195
+ decoded = APIHelper.json_deserialize(_response.raw_body)
196
+ _errors = APIHelper.map_response(decoded, ['errors'])
197
+ ApiResponse.new(_response, data: decoded, errors: _errors)
198
+ end
199
+
200
+ # Returns a paginated list of `EmployeeWage` instances for a business.
201
+ # @param [String] employee_id Optional parameter: Filter wages returned to
202
+ # only those that are associated with the specified employee.
203
+ # @param [Integer] limit Optional parameter: Maximum number of Employee
204
+ # Wages to return per page. Can range between 1 and 200. The default is the
205
+ # maximum at 200.
206
+ # @param [String] cursor Optional parameter: Pointer to the next page of
207
+ # Employee Wage results to fetch.
208
+ # @return [ListEmployeeWagesResponse Hash] response from the API call
209
+ def list_employee_wages(employee_id: nil,
210
+ limit: nil,
211
+ cursor: nil)
212
+ warn 'Endpoint list_employee_wages in LaborApi is deprecated'
213
+ # Prepare query url.
214
+ _query_builder = config.get_base_uri
215
+ _query_builder << '/v2/labor/employee-wages'
216
+ _query_builder = APIHelper.append_url_with_query_parameters(
217
+ _query_builder,
218
+ 'employee_id' => employee_id,
219
+ 'limit' => limit,
220
+ 'cursor' => cursor
221
+ )
222
+ _query_url = APIHelper.clean_url _query_builder
223
+
224
+ # Prepare headers.
225
+ _headers = {
226
+ 'accept' => 'application/json'
227
+ }
228
+
229
+ # Prepare and execute HttpRequest.
230
+ _request = config.http_client.get(
231
+ _query_url,
232
+ headers: _headers
233
+ )
234
+ OAuth2.apply(config, _request)
235
+ _response = execute_request(_request)
236
+
237
+ # Return appropriate response type.
238
+ decoded = APIHelper.json_deserialize(_response.raw_body)
239
+ _errors = APIHelper.map_response(decoded, ['errors'])
240
+ ApiResponse.new(_response, data: decoded, errors: _errors)
241
+ end
242
+
243
+ # Returns a single `EmployeeWage` specified by id.
244
+ # @param [String] id Required parameter: UUID for the `EmployeeWage` being
245
+ # retrieved.
246
+ # @return [GetEmployeeWageResponse Hash] response from the API call
247
+ def get_employee_wage(id:)
248
+ warn 'Endpoint get_employee_wage in LaborApi is deprecated'
249
+ # Prepare query url.
250
+ _query_builder = config.get_base_uri
251
+ _query_builder << '/v2/labor/employee-wages/{id}'
252
+ _query_builder = APIHelper.append_url_with_template_parameters(
253
+ _query_builder,
254
+ 'id' => id
255
+ )
256
+ _query_url = APIHelper.clean_url _query_builder
257
+
258
+ # Prepare headers.
259
+ _headers = {
260
+ 'accept' => 'application/json'
261
+ }
262
+
263
+ # Prepare and execute HttpRequest.
264
+ _request = config.http_client.get(
265
+ _query_url,
266
+ headers: _headers
267
+ )
268
+ OAuth2.apply(config, _request)
269
+ _response = execute_request(_request)
270
+
271
+ # Return appropriate response type.
272
+ decoded = APIHelper.json_deserialize(_response.raw_body)
273
+ _errors = APIHelper.map_response(decoded, ['errors'])
274
+ ApiResponse.new(_response, data: decoded, errors: _errors)
275
+ end
276
+
277
+ # Creates a new `Shift`.
278
+ # A `Shift` represents a complete work day for a single employee.
279
+ # You must provide the following values in your request to this
280
+ # endpoint:
281
+ # - `location_id`
282
+ # - `employee_id`
283
+ # - `start_at`
284
+ # An attempt to create a new `Shift` can result in a `BAD_REQUEST` error
285
+ # when:
286
+ # - The `status` of the new `Shift` is `OPEN` and the employee has another
287
+ # shift with an `OPEN` status.
288
+ # - The `start_at` date is in the future
289
+ # - the `start_at` or `end_at` overlaps another shift for the same employee
290
+ # - If `Break`s are set in the request, a break `start_at`
291
+ # must not be before the `Shift.start_at`. A break `end_at` must not be
292
+ # after
293
+ # the `Shift.end_at`
294
+ # @param [CreateShiftRequest] body Required parameter: An object containing
295
+ # the fields to POST for the request. See the corresponding object
296
+ # definition for field details.
297
+ # @return [CreateShiftResponse Hash] response from the API call
298
+ def create_shift(body:)
299
+ # Prepare query url.
300
+ _query_builder = config.get_base_uri
301
+ _query_builder << '/v2/labor/shifts'
302
+ _query_url = APIHelper.clean_url _query_builder
303
+
304
+ # Prepare headers.
305
+ _headers = {
306
+ 'accept' => 'application/json',
307
+ 'content-type' => 'application/json; charset=utf-8'
308
+ }
309
+
310
+ # Prepare and execute HttpRequest.
311
+ _request = config.http_client.post(
312
+ _query_url,
313
+ headers: _headers,
314
+ parameters: body.to_json
315
+ )
316
+ OAuth2.apply(config, _request)
317
+ _response = execute_request(_request)
318
+
319
+ # Return appropriate response type.
320
+ decoded = APIHelper.json_deserialize(_response.raw_body)
321
+ _errors = APIHelper.map_response(decoded, ['errors'])
322
+ ApiResponse.new(_response, data: decoded, errors: _errors)
323
+ end
324
+
325
+ # Returns a paginated list of `Shift` records for a business.
326
+ # The list to be returned can be filtered by:
327
+ # - Location IDs **and**
328
+ # - employee IDs **and**
329
+ # - shift status (`OPEN`, `CLOSED`) **and**
330
+ # - shift start **and**
331
+ # - shift end **and**
332
+ # - work day details
333
+ # The list can be sorted by:
334
+ # - `start_at`
335
+ # - `end_at`
336
+ # - `created_at`
337
+ # - `updated_at`
338
+ # @param [SearchShiftsRequest] body Required parameter: An object containing
339
+ # the fields to POST for the request. See the corresponding object
340
+ # definition for field details.
341
+ # @return [SearchShiftsResponse Hash] response from the API call
342
+ def search_shifts(body:)
343
+ # Prepare query url.
344
+ _query_builder = config.get_base_uri
345
+ _query_builder << '/v2/labor/shifts/search'
346
+ _query_url = APIHelper.clean_url _query_builder
347
+
348
+ # Prepare headers.
349
+ _headers = {
350
+ 'accept' => 'application/json',
351
+ 'content-type' => 'application/json; charset=utf-8'
352
+ }
353
+
354
+ # Prepare and execute HttpRequest.
355
+ _request = config.http_client.post(
356
+ _query_url,
357
+ headers: _headers,
358
+ parameters: body.to_json
359
+ )
360
+ OAuth2.apply(config, _request)
361
+ _response = execute_request(_request)
362
+
363
+ # Return appropriate response type.
364
+ decoded = APIHelper.json_deserialize(_response.raw_body)
365
+ _errors = APIHelper.map_response(decoded, ['errors'])
366
+ ApiResponse.new(_response, data: decoded, errors: _errors)
367
+ end
368
+
369
+ # Deletes a `Shift`.
370
+ # @param [String] id Required parameter: UUID for the `Shift` being
371
+ # deleted.
372
+ # @return [DeleteShiftResponse Hash] response from the API call
373
+ def delete_shift(id:)
374
+ # Prepare query url.
375
+ _query_builder = config.get_base_uri
376
+ _query_builder << '/v2/labor/shifts/{id}'
377
+ _query_builder = APIHelper.append_url_with_template_parameters(
378
+ _query_builder,
379
+ 'id' => id
380
+ )
381
+ _query_url = APIHelper.clean_url _query_builder
382
+
383
+ # Prepare headers.
384
+ _headers = {
385
+ 'accept' => 'application/json'
386
+ }
387
+
388
+ # Prepare and execute HttpRequest.
389
+ _request = config.http_client.delete(
390
+ _query_url,
391
+ headers: _headers
392
+ )
393
+ OAuth2.apply(config, _request)
394
+ _response = execute_request(_request)
395
+
396
+ # Return appropriate response type.
397
+ decoded = APIHelper.json_deserialize(_response.raw_body)
398
+ _errors = APIHelper.map_response(decoded, ['errors'])
399
+ ApiResponse.new(_response, data: decoded, errors: _errors)
400
+ end
401
+
402
+ # Returns a single `Shift` specified by id.
403
+ # @param [String] id Required parameter: UUID for the `Shift` being
404
+ # retrieved.
405
+ # @return [GetShiftResponse Hash] response from the API call
406
+ def get_shift(id:)
407
+ # Prepare query url.
408
+ _query_builder = config.get_base_uri
409
+ _query_builder << '/v2/labor/shifts/{id}'
410
+ _query_builder = APIHelper.append_url_with_template_parameters(
411
+ _query_builder,
412
+ 'id' => id
413
+ )
414
+ _query_url = APIHelper.clean_url _query_builder
415
+
416
+ # Prepare headers.
417
+ _headers = {
418
+ 'accept' => 'application/json'
419
+ }
420
+
421
+ # Prepare and execute HttpRequest.
422
+ _request = config.http_client.get(
423
+ _query_url,
424
+ headers: _headers
425
+ )
426
+ OAuth2.apply(config, _request)
427
+ _response = execute_request(_request)
428
+
429
+ # Return appropriate response type.
430
+ decoded = APIHelper.json_deserialize(_response.raw_body)
431
+ _errors = APIHelper.map_response(decoded, ['errors'])
432
+ ApiResponse.new(_response, data: decoded, errors: _errors)
433
+ end
434
+
435
+ # Updates an existing `Shift`.
436
+ # When adding a `Break` to a `Shift`, any earlier `Breaks` in the `Shift`
437
+ # have
438
+ # the `end_at` property set to a valid RFC-3339 datetime string.
439
+ # When closing a `Shift`, all `Break` instances in the shift must be
440
+ # complete with `end_at`
441
+ # set on each `Break`.
442
+ # @param [String] id Required parameter: ID of the object being updated.
443
+ # @param [UpdateShiftRequest] body Required parameter: An object containing
444
+ # the fields to POST for the request. See the corresponding object
445
+ # definition for field details.
446
+ # @return [UpdateShiftResponse Hash] response from the API call
447
+ def update_shift(id:,
448
+ body:)
449
+ # Prepare query url.
450
+ _query_builder = config.get_base_uri
451
+ _query_builder << '/v2/labor/shifts/{id}'
452
+ _query_builder = APIHelper.append_url_with_template_parameters(
453
+ _query_builder,
454
+ 'id' => id
455
+ )
456
+ _query_url = APIHelper.clean_url _query_builder
457
+
458
+ # Prepare headers.
459
+ _headers = {
460
+ 'accept' => 'application/json',
461
+ 'content-type' => 'application/json; charset=utf-8'
462
+ }
463
+
464
+ # Prepare and execute HttpRequest.
465
+ _request = config.http_client.put(
466
+ _query_url,
467
+ headers: _headers,
468
+ parameters: body.to_json
469
+ )
470
+ OAuth2.apply(config, _request)
471
+ _response = execute_request(_request)
472
+
473
+ # Return appropriate response type.
474
+ decoded = APIHelper.json_deserialize(_response.raw_body)
475
+ _errors = APIHelper.map_response(decoded, ['errors'])
476
+ ApiResponse.new(_response, data: decoded, errors: _errors)
477
+ end
478
+
479
+ # Returns a paginated list of `TeamMemberWage` instances for a business.
480
+ # @param [String] team_member_id Optional parameter: Filter wages returned
481
+ # to only those that are associated with the specified team member.
482
+ # @param [Integer] limit Optional parameter: Maximum number of Team Member
483
+ # Wages to return per page. Can range between 1 and 200. The default is the
484
+ # maximum at 200.
485
+ # @param [String] cursor Optional parameter: Pointer to the next page of
486
+ # Employee Wage results to fetch.
487
+ # @return [ListTeamMemberWagesResponse Hash] response from the API call
488
+ def list_team_member_wages(team_member_id: nil,
489
+ limit: nil,
490
+ cursor: nil)
491
+ # Prepare query url.
492
+ _query_builder = config.get_base_uri
493
+ _query_builder << '/v2/labor/team-member-wages'
494
+ _query_builder = APIHelper.append_url_with_query_parameters(
495
+ _query_builder,
496
+ 'team_member_id' => team_member_id,
497
+ 'limit' => limit,
498
+ 'cursor' => cursor
499
+ )
500
+ _query_url = APIHelper.clean_url _query_builder
501
+
502
+ # Prepare headers.
503
+ _headers = {
504
+ 'accept' => 'application/json'
505
+ }
506
+
507
+ # Prepare and execute HttpRequest.
508
+ _request = config.http_client.get(
509
+ _query_url,
510
+ headers: _headers
511
+ )
512
+ OAuth2.apply(config, _request)
513
+ _response = execute_request(_request)
514
+
515
+ # Return appropriate response type.
516
+ decoded = APIHelper.json_deserialize(_response.raw_body)
517
+ _errors = APIHelper.map_response(decoded, ['errors'])
518
+ ApiResponse.new(_response, data: decoded, errors: _errors)
519
+ end
520
+
521
+ # Returns a single `TeamMemberWage` specified by id.
522
+ # @param [String] id Required parameter: UUID for the `TeamMemberWage` being
523
+ # retrieved.
524
+ # @return [GetTeamMemberWageResponse Hash] response from the API call
525
+ def get_team_member_wage(id:)
526
+ # Prepare query url.
527
+ _query_builder = config.get_base_uri
528
+ _query_builder << '/v2/labor/team-member-wages/{id}'
529
+ _query_builder = APIHelper.append_url_with_template_parameters(
530
+ _query_builder,
531
+ 'id' => id
532
+ )
533
+ _query_url = APIHelper.clean_url _query_builder
534
+
535
+ # Prepare headers.
536
+ _headers = {
537
+ 'accept' => 'application/json'
538
+ }
539
+
540
+ # Prepare and execute HttpRequest.
541
+ _request = config.http_client.get(
542
+ _query_url,
543
+ headers: _headers
544
+ )
545
+ OAuth2.apply(config, _request)
546
+ _response = execute_request(_request)
547
+
548
+ # Return appropriate response type.
549
+ decoded = APIHelper.json_deserialize(_response.raw_body)
550
+ _errors = APIHelper.map_response(decoded, ['errors'])
551
+ ApiResponse.new(_response, data: decoded, errors: _errors)
552
+ end
553
+
554
+ # Returns a list of `WorkweekConfig` instances for a business.
555
+ # @param [Integer] limit Optional parameter: Maximum number of Workweek
556
+ # Configs to return per page.
557
+ # @param [String] cursor Optional parameter: Pointer to the next page of
558
+ # Workweek Config results to fetch.
559
+ # @return [ListWorkweekConfigsResponse Hash] response from the API call
560
+ def list_workweek_configs(limit: nil,
561
+ cursor: nil)
562
+ # Prepare query url.
563
+ _query_builder = config.get_base_uri
564
+ _query_builder << '/v2/labor/workweek-configs'
565
+ _query_builder = APIHelper.append_url_with_query_parameters(
566
+ _query_builder,
567
+ 'limit' => limit,
568
+ 'cursor' => cursor
569
+ )
570
+ _query_url = APIHelper.clean_url _query_builder
571
+
572
+ # Prepare headers.
573
+ _headers = {
574
+ 'accept' => 'application/json'
575
+ }
576
+
577
+ # Prepare and execute HttpRequest.
578
+ _request = config.http_client.get(
579
+ _query_url,
580
+ headers: _headers
581
+ )
582
+ OAuth2.apply(config, _request)
583
+ _response = execute_request(_request)
584
+
585
+ # Return appropriate response type.
586
+ decoded = APIHelper.json_deserialize(_response.raw_body)
587
+ _errors = APIHelper.map_response(decoded, ['errors'])
588
+ ApiResponse.new(_response, data: decoded, errors: _errors)
589
+ end
590
+
591
+ # Updates a `WorkweekConfig`.
592
+ # @param [String] id Required parameter: UUID for the `WorkweekConfig`
593
+ # object being updated.
594
+ # @param [UpdateWorkweekConfigRequest] body Required parameter: An object
595
+ # containing the fields to POST for the request. See the corresponding
596
+ # object definition for field details.
597
+ # @return [UpdateWorkweekConfigResponse Hash] response from the API call
598
+ def update_workweek_config(id:,
599
+ body:)
600
+ # Prepare query url.
601
+ _query_builder = config.get_base_uri
602
+ _query_builder << '/v2/labor/workweek-configs/{id}'
603
+ _query_builder = APIHelper.append_url_with_template_parameters(
604
+ _query_builder,
605
+ 'id' => id
606
+ )
607
+ _query_url = APIHelper.clean_url _query_builder
608
+
609
+ # Prepare headers.
610
+ _headers = {
611
+ 'accept' => 'application/json',
612
+ 'content-type' => 'application/json; charset=utf-8'
613
+ }
614
+
615
+ # Prepare and execute HttpRequest.
616
+ _request = config.http_client.put(
617
+ _query_url,
618
+ headers: _headers,
619
+ parameters: body.to_json
620
+ )
621
+ OAuth2.apply(config, _request)
622
+ _response = execute_request(_request)
623
+
624
+ # Return appropriate response type.
625
+ decoded = APIHelper.json_deserialize(_response.raw_body)
626
+ _errors = APIHelper.map_response(decoded, ['errors'])
627
+ ApiResponse.new(_response, data: decoded, errors: _errors)
628
+ end
629
+ end
630
+ end