square.rb 6.4.0.20200923 → 9.0.0.20210226

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +43 -31
  4. data/lib/square.rb +60 -61
  5. data/lib/square/api/apple_pay_api.rb +5 -3
  6. data/lib/square/api/bank_accounts_api.rb +16 -19
  7. data/lib/square/api/base_api.rb +1 -1
  8. data/lib/square/api/bookings_api.rb +308 -0
  9. data/lib/square/api/cash_drawers_api.rb +13 -6
  10. data/lib/square/api/catalog_api.rb +71 -35
  11. data/lib/square/api/checkout_api.rb +4 -2
  12. data/lib/square/api/customer_groups_api.rb +18 -8
  13. data/lib/square/api/customer_segments_api.rb +9 -5
  14. data/lib/square/api/customers_api.rb +47 -27
  15. data/lib/square/api/devices_api.rb +17 -6
  16. data/lib/square/api/disputes_api.rb +70 -54
  17. data/lib/square/api/employees_api.rb +7 -3
  18. data/lib/square/api/inventory_api.rb +27 -13
  19. data/lib/square/api/invoices_api.rb +44 -25
  20. data/lib/square/api/labor_api.rb +57 -25
  21. data/lib/square/api/locations_api.rb +16 -13
  22. data/lib/square/api/loyalty_api.rb +60 -66
  23. data/lib/square/api/merchants_api.rb +7 -3
  24. data/lib/square/api/mobile_authorization_api.rb +5 -3
  25. data/lib/square/api/o_auth_api.rb +11 -8
  26. data/lib/square/api/orders_api.rb +55 -8
  27. data/lib/square/api/payments_api.rb +68 -55
  28. data/lib/square/api/refunds_api.rb +32 -26
  29. data/lib/square/api/subscriptions_api.rb +26 -14
  30. data/lib/square/api/team_api.rb +46 -30
  31. data/lib/square/api/terminal_api.rb +156 -7
  32. data/lib/square/api/transactions_api.rb +32 -18
  33. data/lib/square/api/v1_employees_api.rb +27 -389
  34. data/lib/square/api/v1_transactions_api.rb +42 -101
  35. data/lib/square/api_helper.rb +14 -9
  36. data/lib/square/client.rb +10 -14
  37. data/lib/square/configuration.rb +21 -6
  38. data/lib/square/http/api_response.rb +2 -0
  39. data/lib/square/http/faraday_client.rb +9 -2
  40. data/spec/user_journey_spec.rb +2 -5
  41. data/test/api/test_locations_api.rb +1 -1
  42. metadata +5 -6
  43. data/lib/square/api/v1_items_api.rb +0 -1686
  44. data/lib/square/api/v1_locations_api.rb +0 -65
@@ -42,7 +42,7 @@ module Square
42
42
  _query_builder << '/v2/locations/{location_id}/refunds'
43
43
  _query_builder = APIHelper.append_url_with_template_parameters(
44
44
  _query_builder,
45
- 'location_id' => location_id
45
+ 'location_id' => { 'value' => location_id, 'encode' => true }
46
46
  )
47
47
  _query_builder = APIHelper.append_url_with_query_parameters(
48
48
  _query_builder,
@@ -69,7 +69,9 @@ module Square
69
69
  # Return appropriate response type.
70
70
  decoded = APIHelper.json_deserialize(_response.raw_body)
71
71
  _errors = APIHelper.map_response(decoded, ['errors'])
72
- ApiResponse.new(_response, data: decoded, errors: _errors)
72
+ ApiResponse.new(
73
+ _response, data: decoded, errors: _errors
74
+ )
73
75
  end
74
76
 
75
77
  # Lists transactions for a particular location.
@@ -106,7 +108,7 @@ module Square
106
108
  _query_builder << '/v2/locations/{location_id}/transactions'
107
109
  _query_builder = APIHelper.append_url_with_template_parameters(
108
110
  _query_builder,
109
- 'location_id' => location_id
111
+ 'location_id' => { 'value' => location_id, 'encode' => true }
110
112
  )
111
113
  _query_builder = APIHelper.append_url_with_query_parameters(
112
114
  _query_builder,
@@ -133,7 +135,9 @@ module Square
133
135
  # Return appropriate response type.
134
136
  decoded = APIHelper.json_deserialize(_response.raw_body)
135
137
  _errors = APIHelper.map_response(decoded, ['errors'])
136
- ApiResponse.new(_response, data: decoded, errors: _errors)
138
+ ApiResponse.new(
139
+ _response, data: decoded, errors: _errors
140
+ )
137
141
  end
138
142
 
139
143
  # Charges a card represented by a card nonce or a customer's card on file.
@@ -169,7 +173,7 @@ module Square
169
173
  _query_builder << '/v2/locations/{location_id}/transactions'
170
174
  _query_builder = APIHelper.append_url_with_template_parameters(
171
175
  _query_builder,
172
- 'location_id' => location_id
176
+ 'location_id' => { 'value' => location_id, 'encode' => true }
173
177
  )
174
178
  _query_url = APIHelper.clean_url _query_builder
175
179
 
@@ -191,7 +195,9 @@ module Square
191
195
  # Return appropriate response type.
192
196
  decoded = APIHelper.json_deserialize(_response.raw_body)
193
197
  _errors = APIHelper.map_response(decoded, ['errors'])
194
- ApiResponse.new(_response, data: decoded, errors: _errors)
198
+ ApiResponse.new(
199
+ _response, data: decoded, errors: _errors
200
+ )
195
201
  end
196
202
 
197
203
  # Retrieves details for a single transaction.
@@ -208,8 +214,8 @@ module Square
208
214
  _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}'
209
215
  _query_builder = APIHelper.append_url_with_template_parameters(
210
216
  _query_builder,
211
- 'location_id' => location_id,
212
- 'transaction_id' => transaction_id
217
+ 'location_id' => { 'value' => location_id, 'encode' => true },
218
+ 'transaction_id' => { 'value' => transaction_id, 'encode' => true }
213
219
  )
214
220
  _query_url = APIHelper.clean_url _query_builder
215
221
 
@@ -229,7 +235,9 @@ module Square
229
235
  # Return appropriate response type.
230
236
  decoded = APIHelper.json_deserialize(_response.raw_body)
231
237
  _errors = APIHelper.map_response(decoded, ['errors'])
232
- ApiResponse.new(_response, data: decoded, errors: _errors)
238
+ ApiResponse.new(
239
+ _response, data: decoded, errors: _errors
240
+ )
233
241
  end
234
242
 
235
243
  # Captures a transaction that was created with the
@@ -250,8 +258,8 @@ module Square
250
258
  _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/capture'
251
259
  _query_builder = APIHelper.append_url_with_template_parameters(
252
260
  _query_builder,
253
- 'location_id' => location_id,
254
- 'transaction_id' => transaction_id
261
+ 'location_id' => { 'value' => location_id, 'encode' => true },
262
+ 'transaction_id' => { 'value' => transaction_id, 'encode' => true }
255
263
  )
256
264
  _query_url = APIHelper.clean_url _query_builder
257
265
 
@@ -271,7 +279,9 @@ module Square
271
279
  # Return appropriate response type.
272
280
  decoded = APIHelper.json_deserialize(_response.raw_body)
273
281
  _errors = APIHelper.map_response(decoded, ['errors'])
274
- ApiResponse.new(_response, data: decoded, errors: _errors)
282
+ ApiResponse.new(
283
+ _response, data: decoded, errors: _errors
284
+ )
275
285
  end
276
286
 
277
287
  # Initiates a refund for a previously charged tender.
@@ -299,8 +309,8 @@ module Square
299
309
  _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/refund'
300
310
  _query_builder = APIHelper.append_url_with_template_parameters(
301
311
  _query_builder,
302
- 'location_id' => location_id,
303
- 'transaction_id' => transaction_id
312
+ 'location_id' => { 'value' => location_id, 'encode' => true },
313
+ 'transaction_id' => { 'value' => transaction_id, 'encode' => true }
304
314
  )
305
315
  _query_url = APIHelper.clean_url _query_builder
306
316
 
@@ -322,7 +332,9 @@ module Square
322
332
  # Return appropriate response type.
323
333
  decoded = APIHelper.json_deserialize(_response.raw_body)
324
334
  _errors = APIHelper.map_response(decoded, ['errors'])
325
- ApiResponse.new(_response, data: decoded, errors: _errors)
335
+ ApiResponse.new(
336
+ _response, data: decoded, errors: _errors
337
+ )
326
338
  end
327
339
 
328
340
  # Cancels a transaction that was created with the [Charge](#endpoint-charge)
@@ -342,8 +354,8 @@ module Square
342
354
  _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/void'
343
355
  _query_builder = APIHelper.append_url_with_template_parameters(
344
356
  _query_builder,
345
- 'location_id' => location_id,
346
- 'transaction_id' => transaction_id
357
+ 'location_id' => { 'value' => location_id, 'encode' => true },
358
+ 'transaction_id' => { 'value' => transaction_id, 'encode' => true }
347
359
  )
348
360
  _query_url = APIHelper.clean_url _query_builder
349
361
 
@@ -363,7 +375,9 @@ module Square
363
375
  # Return appropriate response type.
364
376
  decoded = APIHelper.json_deserialize(_response.raw_body)
365
377
  _errors = APIHelper.map_response(decoded, ['errors'])
366
- ApiResponse.new(_response, data: decoded, errors: _errors)
378
+ ApiResponse.new(
379
+ _response, data: decoded, errors: _errors
380
+ )
367
381
  end
368
382
  end
369
383
  end
@@ -75,7 +75,9 @@ module Square
75
75
  # Return appropriate response type.
76
76
  decoded = APIHelper.json_deserialize(_response.raw_body)
77
77
  _errors = APIHelper.map_response(decoded, ['errors'])
78
- ApiResponse.new(_response, data: decoded, errors: _errors)
78
+ ApiResponse.new(
79
+ _response, data: decoded, errors: _errors
80
+ )
79
81
  end
80
82
 
81
83
  # Use the CreateEmployee endpoint to add an employee to a Square
@@ -83,10 +85,8 @@ module Square
83
85
  # of `INACTIVE`. Inactive employees cannot sign in to Square Point of Sale
84
86
  # until they are activated from the Square Dashboard. Employee status
85
87
  # cannot be changed with the Connect API.
86
- # <aside class="important">
87
88
  # Employee entities cannot be deleted. To disable employee profiles,
88
89
  # set the employee's status to <code>INACTIVE</code>
89
- # </aside>
90
90
  # @param [V1Employee] body Required parameter: An object containing the
91
91
  # fields to POST for the request. See the corresponding object definition
92
92
  # for field details.
@@ -115,7 +115,9 @@ module Square
115
115
  # Return appropriate response type.
116
116
  decoded = APIHelper.json_deserialize(_response.raw_body)
117
117
  _errors = APIHelper.map_response(decoded, ['errors'])
118
- ApiResponse.new(_response, data: decoded, errors: _errors)
118
+ ApiResponse.new(
119
+ _response, data: decoded, errors: _errors
120
+ )
119
121
  end
120
122
 
121
123
  # Provides the details for a single employee.
@@ -127,7 +129,7 @@ module Square
127
129
  _query_builder << '/v1/me/employees/{employee_id}'
128
130
  _query_builder = APIHelper.append_url_with_template_parameters(
129
131
  _query_builder,
130
- 'employee_id' => employee_id
132
+ 'employee_id' => { 'value' => employee_id, 'encode' => true }
131
133
  )
132
134
  _query_url = APIHelper.clean_url _query_builder
133
135
 
@@ -147,7 +149,9 @@ module Square
147
149
  # Return appropriate response type.
148
150
  decoded = APIHelper.json_deserialize(_response.raw_body)
149
151
  _errors = APIHelper.map_response(decoded, ['errors'])
150
- ApiResponse.new(_response, data: decoded, errors: _errors)
152
+ ApiResponse.new(
153
+ _response, data: decoded, errors: _errors
154
+ )
151
155
  end
152
156
 
153
157
  # UpdateEmployee
@@ -164,7 +168,7 @@ module Square
164
168
  _query_builder << '/v1/me/employees/{employee_id}'
165
169
  _query_builder = APIHelper.append_url_with_template_parameters(
166
170
  _query_builder,
167
- 'employee_id' => employee_id
171
+ 'employee_id' => { 'value' => employee_id, 'encode' => true }
168
172
  )
169
173
  _query_url = APIHelper.clean_url _query_builder
170
174
 
@@ -186,7 +190,9 @@ module Square
186
190
  # Return appropriate response type.
187
191
  decoded = APIHelper.json_deserialize(_response.raw_body)
188
192
  _errors = APIHelper.map_response(decoded, ['errors'])
189
- ApiResponse.new(_response, data: decoded, errors: _errors)
193
+ ApiResponse.new(
194
+ _response, data: decoded, errors: _errors
195
+ )
190
196
  end
191
197
 
192
198
  # Provides summary information for all of a business's employee roles.
@@ -230,7 +236,9 @@ module Square
230
236
  # Return appropriate response type.
231
237
  decoded = APIHelper.json_deserialize(_response.raw_body)
232
238
  _errors = APIHelper.map_response(decoded, ['errors'])
233
- ApiResponse.new(_response, data: decoded, errors: _errors)
239
+ ApiResponse.new(
240
+ _response, data: decoded, errors: _errors
241
+ )
234
242
  end
235
243
 
236
244
  # Creates an employee role you can then assign to employees.
@@ -270,7 +278,9 @@ module Square
270
278
  # Return appropriate response type.
271
279
  decoded = APIHelper.json_deserialize(_response.raw_body)
272
280
  _errors = APIHelper.map_response(decoded, ['errors'])
273
- ApiResponse.new(_response, data: decoded, errors: _errors)
281
+ ApiResponse.new(
282
+ _response, data: decoded, errors: _errors
283
+ )
274
284
  end
275
285
 
276
286
  # Provides the details for a single employee role.
@@ -282,7 +292,7 @@ module Square
282
292
  _query_builder << '/v1/me/roles/{role_id}'
283
293
  _query_builder = APIHelper.append_url_with_template_parameters(
284
294
  _query_builder,
285
- 'role_id' => role_id
295
+ 'role_id' => { 'value' => role_id, 'encode' => true }
286
296
  )
287
297
  _query_url = APIHelper.clean_url _query_builder
288
298
 
@@ -302,7 +312,9 @@ module Square
302
312
  # Return appropriate response type.
303
313
  decoded = APIHelper.json_deserialize(_response.raw_body)
304
314
  _errors = APIHelper.map_response(decoded, ['errors'])
305
- ApiResponse.new(_response, data: decoded, errors: _errors)
315
+ ApiResponse.new(
316
+ _response, data: decoded, errors: _errors
317
+ )
306
318
  end
307
319
 
308
320
  # Modifies the details of an employee role.
@@ -319,252 +331,7 @@ module Square
319
331
  _query_builder << '/v1/me/roles/{role_id}'
320
332
  _query_builder = APIHelper.append_url_with_template_parameters(
321
333
  _query_builder,
322
- 'role_id' => role_id
323
- )
324
- _query_url = APIHelper.clean_url _query_builder
325
-
326
- # Prepare headers.
327
- _headers = {
328
- 'accept' => 'application/json',
329
- 'content-type' => 'application/json; charset=utf-8'
330
- }
331
-
332
- # Prepare and execute HttpRequest.
333
- _request = config.http_client.put(
334
- _query_url,
335
- headers: _headers,
336
- parameters: body.to_json
337
- )
338
- OAuth2.apply(config, _request)
339
- _response = execute_request(_request)
340
-
341
- # Return appropriate response type.
342
- decoded = APIHelper.json_deserialize(_response.raw_body)
343
- _errors = APIHelper.map_response(decoded, ['errors'])
344
- ApiResponse.new(_response, data: decoded, errors: _errors)
345
- end
346
-
347
- # Provides summary information for all of a business's employee timecards.
348
- # @param [SortOrder] order Optional parameter: The order in which timecards
349
- # are listed in the response, based on their created_at field.
350
- # @param [String] employee_id Optional parameter: If provided, the endpoint
351
- # returns only timecards for the employee with the specified ID.
352
- # @param [String] begin_clockin_time Optional parameter: If filtering
353
- # results by their clockin_time field, the beginning of the requested
354
- # reporting period, in ISO 8601 format.
355
- # @param [String] end_clockin_time Optional parameter: If filtering results
356
- # by their clockin_time field, the end of the requested reporting period, in
357
- # ISO 8601 format.
358
- # @param [String] begin_clockout_time Optional parameter: If filtering
359
- # results by their clockout_time field, the beginning of the requested
360
- # reporting period, in ISO 8601 format.
361
- # @param [String] end_clockout_time Optional parameter: If filtering results
362
- # by their clockout_time field, the end of the requested reporting period,
363
- # in ISO 8601 format.
364
- # @param [String] begin_updated_at Optional parameter: If filtering results
365
- # by their updated_at field, the beginning of the requested reporting
366
- # period, in ISO 8601 format.
367
- # @param [String] end_updated_at Optional parameter: If filtering results by
368
- # their updated_at field, the end of the requested reporting period, in ISO
369
- # 8601 format.
370
- # @param [Boolean] deleted Optional parameter: If true, only deleted
371
- # timecards are returned. If false, only valid timecards are returned.If you
372
- # don't provide this parameter, both valid and deleted timecards are
373
- # returned.
374
- # @param [Integer] limit Optional parameter: The maximum integer number of
375
- # employee entities to return in a single response. Default 100, maximum
376
- # 200.
377
- # @param [String] batch_token Optional parameter: A pagination cursor to
378
- # retrieve the next set of results for your original query to the
379
- # endpoint.
380
- # @return [List of V1Timecard Hash] response from the API call
381
- def list_timecards(order: nil,
382
- employee_id: nil,
383
- begin_clockin_time: nil,
384
- end_clockin_time: nil,
385
- begin_clockout_time: nil,
386
- end_clockout_time: nil,
387
- begin_updated_at: nil,
388
- end_updated_at: nil,
389
- deleted: false,
390
- limit: nil,
391
- batch_token: nil)
392
- warn 'Endpoint list_timecards in V1EmployeesApi is deprecated'
393
- # Prepare query url.
394
- _query_builder = config.get_base_uri
395
- _query_builder << '/v1/me/timecards'
396
- _query_builder = APIHelper.append_url_with_query_parameters(
397
- _query_builder,
398
- 'order' => order,
399
- 'employee_id' => employee_id,
400
- 'begin_clockin_time' => begin_clockin_time,
401
- 'end_clockin_time' => end_clockin_time,
402
- 'begin_clockout_time' => begin_clockout_time,
403
- 'end_clockout_time' => end_clockout_time,
404
- 'begin_updated_at' => begin_updated_at,
405
- 'end_updated_at' => end_updated_at,
406
- 'deleted' => deleted,
407
- 'limit' => limit,
408
- 'batch_token' => batch_token
409
- )
410
- _query_url = APIHelper.clean_url _query_builder
411
-
412
- # Prepare headers.
413
- _headers = {
414
- 'accept' => 'application/json'
415
- }
416
-
417
- # Prepare and execute HttpRequest.
418
- _request = config.http_client.get(
419
- _query_url,
420
- headers: _headers
421
- )
422
- OAuth2.apply(config, _request)
423
- _response = execute_request(_request)
424
-
425
- # Return appropriate response type.
426
- decoded = APIHelper.json_deserialize(_response.raw_body)
427
- _errors = APIHelper.map_response(decoded, ['errors'])
428
- ApiResponse.new(_response, data: decoded, errors: _errors)
429
- end
430
-
431
- # Creates a timecard for an employee and clocks them in with an
432
- # `API_CREATE` event and a `clockin_time` set to the current time unless
433
- # the request provides a different value.
434
- # To import timecards from another
435
- # system (rather than clocking someone in). Specify the `clockin_time`
436
- # and* `clockout_time` in the request.
437
- # Timecards correspond to exactly one shift for a given employee, bounded
438
- # by the `clockin_time` and `clockout_time` fields. An employee is
439
- # considered clocked in if they have a timecard that doesn't have a
440
- # `clockout_time` set. An employee that is currently clocked in cannot
441
- # be clocked in a second time.
442
- # @param [V1Timecard] body Required parameter: An object containing the
443
- # fields to POST for the request. See the corresponding object definition
444
- # for field details.
445
- # @return [V1Timecard Hash] response from the API call
446
- def create_timecard(body:)
447
- warn 'Endpoint create_timecard in V1EmployeesApi is deprecated'
448
- # Prepare query url.
449
- _query_builder = config.get_base_uri
450
- _query_builder << '/v1/me/timecards'
451
- _query_url = APIHelper.clean_url _query_builder
452
-
453
- # Prepare headers.
454
- _headers = {
455
- 'accept' => 'application/json',
456
- 'content-type' => 'application/json; charset=utf-8'
457
- }
458
-
459
- # Prepare and execute HttpRequest.
460
- _request = config.http_client.post(
461
- _query_url,
462
- headers: _headers,
463
- parameters: body.to_json
464
- )
465
- OAuth2.apply(config, _request)
466
- _response = execute_request(_request)
467
-
468
- # Return appropriate response type.
469
- decoded = APIHelper.json_deserialize(_response.raw_body)
470
- _errors = APIHelper.map_response(decoded, ['errors'])
471
- ApiResponse.new(_response, data: decoded, errors: _errors)
472
- end
473
-
474
- # Deletes a timecard. Timecards can also be deleted through the
475
- # Square Dashboard. Deleted timecards are still accessible through
476
- # Connect API endpoints, but cannot be modified. The `deleted` field of
477
- # the `Timecard` object indicates whether the timecard has been deleted.
478
- # __Note__: By default, deleted timecards appear alongside valid timecards
479
- # in
480
- # results returned by the
481
- # [ListTimecards](#endpoint-v1employees-listtimecards)
482
- # endpoint. To filter deleted timecards, include the `deleted` query
483
- # parameter in the list request.
484
- # Only approved accounts can manage their employees with Square.
485
- # Unapproved accounts cannot use employee management features with the
486
- # API.
487
- # @param [String] timecard_id Required parameter: The ID of the timecard to
488
- # delete.
489
- # @return [Object] response from the API call
490
- def delete_timecard(timecard_id:)
491
- warn 'Endpoint delete_timecard in V1EmployeesApi is deprecated'
492
- # Prepare query url.
493
- _query_builder = config.get_base_uri
494
- _query_builder << '/v1/me/timecards/{timecard_id}'
495
- _query_builder = APIHelper.append_url_with_template_parameters(
496
- _query_builder,
497
- 'timecard_id' => timecard_id
498
- )
499
- _query_url = APIHelper.clean_url _query_builder
500
-
501
- # Prepare and execute HttpRequest.
502
- _request = config.http_client.delete(
503
- _query_url
504
- )
505
- OAuth2.apply(config, _request)
506
- _response = execute_request(_request)
507
-
508
- # Return appropriate response type.
509
- ApiResponse.new(_response, data: _response.raw_body)
510
- end
511
-
512
- # Provides the details for a single timecard.
513
- # <aside>
514
- # Only approved accounts can manage their employees with Square.
515
- # Unapproved accounts cannot use employee management features with the
516
- # API.
517
- # </aside>
518
- # @param [String] timecard_id Required parameter: The timecard's ID.
519
- # @return [V1Timecard Hash] response from the API call
520
- def retrieve_timecard(timecard_id:)
521
- warn 'Endpoint retrieve_timecard in V1EmployeesApi is deprecated'
522
- # Prepare query url.
523
- _query_builder = config.get_base_uri
524
- _query_builder << '/v1/me/timecards/{timecard_id}'
525
- _query_builder = APIHelper.append_url_with_template_parameters(
526
- _query_builder,
527
- 'timecard_id' => timecard_id
528
- )
529
- _query_url = APIHelper.clean_url _query_builder
530
-
531
- # Prepare headers.
532
- _headers = {
533
- 'accept' => 'application/json'
534
- }
535
-
536
- # Prepare and execute HttpRequest.
537
- _request = config.http_client.get(
538
- _query_url,
539
- headers: _headers
540
- )
541
- OAuth2.apply(config, _request)
542
- _response = execute_request(_request)
543
-
544
- # Return appropriate response type.
545
- decoded = APIHelper.json_deserialize(_response.raw_body)
546
- _errors = APIHelper.map_response(decoded, ['errors'])
547
- ApiResponse.new(_response, data: decoded, errors: _errors)
548
- end
549
-
550
- # Modifies the details of a timecard with an `API_EDIT` event for
551
- # the timecard. Updating an active timecard with a `clockout_time`
552
- # clocks the employee out.
553
- # @param [String] timecard_id Required parameter: TThe ID of the timecard to
554
- # modify.
555
- # @param [V1Timecard] body Required parameter: An object containing the
556
- # fields to POST for the request. See the corresponding object definition
557
- # for field details.
558
- # @return [V1Timecard Hash] response from the API call
559
- def update_timecard(timecard_id:,
560
- body:)
561
- warn 'Endpoint update_timecard in V1EmployeesApi is deprecated'
562
- # Prepare query url.
563
- _query_builder = config.get_base_uri
564
- _query_builder << '/v1/me/timecards/{timecard_id}'
565
- _query_builder = APIHelper.append_url_with_template_parameters(
566
- _query_builder,
567
- 'timecard_id' => timecard_id
334
+ 'role_id' => { 'value' => role_id, 'encode' => true }
568
335
  )
569
336
  _query_url = APIHelper.clean_url _query_builder
570
337
 
@@ -586,138 +353,9 @@ module Square
586
353
  # Return appropriate response type.
587
354
  decoded = APIHelper.json_deserialize(_response.raw_body)
588
355
  _errors = APIHelper.map_response(decoded, ['errors'])
589
- ApiResponse.new(_response, data: decoded, errors: _errors)
590
- end
591
-
592
- # Provides summary information for all events associated with a
593
- # particular timecard.
594
- # <aside>
595
- # Only approved accounts can manage their employees with Square.
596
- # Unapproved accounts cannot use employee management features with the
597
- # API.
598
- # </aside>
599
- # @param [String] timecard_id Required parameter: The ID of the timecard to
600
- # list events for.
601
- # @return [List of V1TimecardEvent Hash] response from the API call
602
- def list_timecard_events(timecard_id:)
603
- warn 'Endpoint list_timecard_events in V1EmployeesApi is deprecated'
604
- # Prepare query url.
605
- _query_builder = config.get_base_uri
606
- _query_builder << '/v1/me/timecards/{timecard_id}/events'
607
- _query_builder = APIHelper.append_url_with_template_parameters(
608
- _query_builder,
609
- 'timecard_id' => timecard_id
610
- )
611
- _query_url = APIHelper.clean_url _query_builder
612
-
613
- # Prepare headers.
614
- _headers = {
615
- 'accept' => 'application/json'
616
- }
617
-
618
- # Prepare and execute HttpRequest.
619
- _request = config.http_client.get(
620
- _query_url,
621
- headers: _headers
356
+ ApiResponse.new(
357
+ _response, data: decoded, errors: _errors
622
358
  )
623
- OAuth2.apply(config, _request)
624
- _response = execute_request(_request)
625
-
626
- # Return appropriate response type.
627
- decoded = APIHelper.json_deserialize(_response.raw_body)
628
- _errors = APIHelper.map_response(decoded, ['errors'])
629
- ApiResponse.new(_response, data: decoded, errors: _errors)
630
- end
631
-
632
- # Provides the details for all of a location's cash drawer shifts during a
633
- # date range. The date range you specify cannot exceed 90 days.
634
- # @param [String] location_id Required parameter: The ID of the location to
635
- # list cash drawer shifts for.
636
- # @param [SortOrder] order Optional parameter: The order in which cash
637
- # drawer shifts are listed in the response, based on their created_at field.
638
- # Default value: ASC
639
- # @param [String] begin_time Optional parameter: The beginning of the
640
- # requested reporting period, in ISO 8601 format. Default value: The current
641
- # time minus 90 days.
642
- # @param [String] end_time Optional parameter: The beginning of the
643
- # requested reporting period, in ISO 8601 format. Default value: The current
644
- # time.
645
- # @return [List of V1CashDrawerShift Hash] response from the API call
646
- def list_cash_drawer_shifts(location_id:,
647
- order: nil,
648
- begin_time: nil,
649
- end_time: nil)
650
- warn 'Endpoint list_cash_drawer_shifts in V1EmployeesApi is deprecated'
651
- # Prepare query url.
652
- _query_builder = config.get_base_uri
653
- _query_builder << '/v1/{location_id}/cash-drawer-shifts'
654
- _query_builder = APIHelper.append_url_with_template_parameters(
655
- _query_builder,
656
- 'location_id' => location_id
657
- )
658
- _query_builder = APIHelper.append_url_with_query_parameters(
659
- _query_builder,
660
- 'order' => order,
661
- 'begin_time' => begin_time,
662
- 'end_time' => end_time
663
- )
664
- _query_url = APIHelper.clean_url _query_builder
665
-
666
- # Prepare headers.
667
- _headers = {
668
- 'accept' => 'application/json'
669
- }
670
-
671
- # Prepare and execute HttpRequest.
672
- _request = config.http_client.get(
673
- _query_url,
674
- headers: _headers
675
- )
676
- OAuth2.apply(config, _request)
677
- _response = execute_request(_request)
678
-
679
- # Return appropriate response type.
680
- decoded = APIHelper.json_deserialize(_response.raw_body)
681
- _errors = APIHelper.map_response(decoded, ['errors'])
682
- ApiResponse.new(_response, data: decoded, errors: _errors)
683
- end
684
-
685
- # Provides the details for a single cash drawer shift, including all events
686
- # that occurred during the shift.
687
- # @param [String] location_id Required parameter: The ID of the location to
688
- # list cash drawer shifts for.
689
- # @param [String] shift_id Required parameter: The shift's ID.
690
- # @return [V1CashDrawerShift Hash] response from the API call
691
- def retrieve_cash_drawer_shift(location_id:,
692
- shift_id:)
693
- warn 'Endpoint retrieve_cash_drawer_shift in V1EmployeesApi is deprecated'
694
- # Prepare query url.
695
- _query_builder = config.get_base_uri
696
- _query_builder << '/v1/{location_id}/cash-drawer-shifts/{shift_id}'
697
- _query_builder = APIHelper.append_url_with_template_parameters(
698
- _query_builder,
699
- 'location_id' => location_id,
700
- 'shift_id' => shift_id
701
- )
702
- _query_url = APIHelper.clean_url _query_builder
703
-
704
- # Prepare headers.
705
- _headers = {
706
- 'accept' => 'application/json'
707
- }
708
-
709
- # Prepare and execute HttpRequest.
710
- _request = config.http_client.get(
711
- _query_url,
712
- headers: _headers
713
- )
714
- OAuth2.apply(config, _request)
715
- _response = execute_request(_request)
716
-
717
- # Return appropriate response type.
718
- decoded = APIHelper.json_deserialize(_response.raw_body)
719
- _errors = APIHelper.map_response(decoded, ['errors'])
720
- ApiResponse.new(_response, data: decoded, errors: _errors)
721
359
  end
722
360
  end
723
361
  end