square.rb 7.0.0.20201118 → 9.1.1.20210317

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.
@@ -83,7 +83,12 @@ module Square
83
83
  end
84
84
 
85
85
  # Refunds a payment. You can refund the entire payment amount or a
86
- # portion of it.
86
+ # portion of it. You can use this endpoint to refund a card payment or
87
+ # record a
88
+ # refund of a cash or external payment. For more information, see
89
+ # [Refund
90
+ # Payment](https://developer.squareup.com/docs/payments-api/refund-payments)
91
+ # .
87
92
  # @param [RefundPaymentRequest] body Required parameter: An object
88
93
  # containing the fields to POST for the request. See the corresponding
89
94
  # object definition for field details.
@@ -5,8 +5,9 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Creates a new Terminal checkout request and sends it to the specified
9
- # device to take a payment for the requested amount.
8
+ # Creates a Terminal checkout request and sends it to the specified device
9
+ # to take a payment
10
+ # for the requested amount.
10
11
  # @param [CreateTerminalCheckoutRequest] body Required parameter: An object
11
12
  # containing the fields to POST for the request. See the corresponding
12
13
  # object definition for field details.
@@ -75,9 +76,9 @@ module Square
75
76
  )
76
77
  end
77
78
 
78
- # Retrieves a Terminal checkout request by checkout_id.
79
- # @param [String] checkout_id Required parameter: Unique ID for the desired
80
- # `TerminalCheckout`
79
+ # Retrieves a Terminal checkout request by `checkout_id`.
80
+ # @param [String] checkout_id Required parameter: The unique ID for the
81
+ # desired `TerminalCheckout`.
81
82
  # @return [GetTerminalCheckoutResponse Hash] response from the API call
82
83
  def get_terminal_checkout(checkout_id:)
83
84
  # Prepare query url.
@@ -112,8 +113,8 @@ module Square
112
113
 
113
114
  # Cancels a Terminal checkout request if the status of the request permits
114
115
  # it.
115
- # @param [String] checkout_id Required parameter: Unique ID for the desired
116
- # `TerminalCheckout`
116
+ # @param [String] checkout_id Required parameter: The unique ID for the
117
+ # desired `TerminalCheckout`.
117
118
  # @return [CancelTerminalCheckoutResponse Hash] response from the API call
118
119
  def cancel_terminal_checkout(checkout_id:)
119
120
  # Prepare query url.
@@ -181,7 +182,7 @@ module Square
181
182
  )
182
183
  end
183
184
 
184
- # Retrieves a filtered list of Terminal Interac refund requests created by
185
+ # Retrieves a filtered list of Interac Terminal refund requests created by
185
186
  # the seller making the request.
186
187
  # @param [SearchTerminalRefundsRequest] body Required parameter: An object
187
188
  # containing the fields to POST for the request. See the corresponding
@@ -216,9 +217,9 @@ module Square
216
217
  )
217
218
  end
218
219
 
219
- # Retrieves an Interac terminal refund object by ID.
220
- # @param [String] terminal_refund_id Required parameter: Unique ID for the
221
- # desired `TerminalRefund`
220
+ # Retrieves an Interac Terminal refund object by ID.
221
+ # @param [String] terminal_refund_id Required parameter: The unique ID for
222
+ # the desired `TerminalRefund`.
222
223
  # @return [GetTerminalRefundResponse Hash] response from the API call
223
224
  def get_terminal_refund(terminal_refund_id:)
224
225
  # Prepare query url.
@@ -251,10 +252,10 @@ module Square
251
252
  )
252
253
  end
253
254
 
254
- # Cancels an Interac terminal refund request by refund request ID if the
255
+ # Cancels an Interac Terminal refund request by refund request ID if the
255
256
  # status of the request permits it.
256
- # @param [String] terminal_refund_id Required parameter: Unique ID for the
257
- # desired `TerminalRefund`
257
+ # @param [String] terminal_refund_id Required parameter: The unique ID for
258
+ # the desired `TerminalRefund`.
258
259
  # @return [CancelTerminalRefundResponse Hash] response from the API call
259
260
  def cancel_terminal_refund(terminal_refund_id:)
260
261
  # Prepare query url.
@@ -85,10 +85,8 @@ module Square
85
85
  # of `INACTIVE`. Inactive employees cannot sign in to Square Point of Sale
86
86
  # until they are activated from the Square Dashboard. Employee status
87
87
  # cannot be changed with the Connect API.
88
- # <aside class="important">
89
88
  # Employee entities cannot be deleted. To disable employee profiles,
90
89
  # set the employee's status to <code>INACTIVE</code>
91
- # </aside>
92
90
  # @param [V1Employee] body Required parameter: An object containing the
93
91
  # fields to POST for the request. See the corresponding object definition
94
92
  # for field details.
@@ -359,397 +357,5 @@ module Square
359
357
  _response, data: decoded, errors: _errors
360
358
  )
361
359
  end
362
-
363
- # Provides summary information for all of a business's employee timecards.
364
- # @param [SortOrder] order Optional parameter: The order in which timecards
365
- # are listed in the response, based on their created_at field.
366
- # @param [String] employee_id Optional parameter: If provided, the endpoint
367
- # returns only timecards for the employee with the specified ID.
368
- # @param [String] begin_clockin_time Optional parameter: If filtering
369
- # results by their clockin_time field, the beginning of the requested
370
- # reporting period, in ISO 8601 format.
371
- # @param [String] end_clockin_time Optional parameter: If filtering results
372
- # by their clockin_time field, the end of the requested reporting period, in
373
- # ISO 8601 format.
374
- # @param [String] begin_clockout_time Optional parameter: If filtering
375
- # results by their clockout_time field, the beginning of the requested
376
- # reporting period, in ISO 8601 format.
377
- # @param [String] end_clockout_time Optional parameter: If filtering results
378
- # by their clockout_time field, the end of the requested reporting period,
379
- # in ISO 8601 format.
380
- # @param [String] begin_updated_at Optional parameter: If filtering results
381
- # by their updated_at field, the beginning of the requested reporting
382
- # period, in ISO 8601 format.
383
- # @param [String] end_updated_at Optional parameter: If filtering results by
384
- # their updated_at field, the end of the requested reporting period, in ISO
385
- # 8601 format.
386
- # @param [Boolean] deleted Optional parameter: If true, only deleted
387
- # timecards are returned. If false, only valid timecards are returned.If you
388
- # don't provide this parameter, both valid and deleted timecards are
389
- # returned.
390
- # @param [Integer] limit Optional parameter: The maximum integer number of
391
- # employee entities to return in a single response. Default 100, maximum
392
- # 200.
393
- # @param [String] batch_token Optional parameter: A pagination cursor to
394
- # retrieve the next set of results for your original query to the
395
- # endpoint.
396
- # @return [List of V1Timecard Hash] response from the API call
397
- def list_timecards(order: nil,
398
- employee_id: nil,
399
- begin_clockin_time: nil,
400
- end_clockin_time: nil,
401
- begin_clockout_time: nil,
402
- end_clockout_time: nil,
403
- begin_updated_at: nil,
404
- end_updated_at: nil,
405
- deleted: false,
406
- limit: nil,
407
- batch_token: nil)
408
- warn 'Endpoint list_timecards in V1EmployeesApi is deprecated'
409
- # Prepare query url.
410
- _query_builder = config.get_base_uri
411
- _query_builder << '/v1/me/timecards'
412
- _query_builder = APIHelper.append_url_with_query_parameters(
413
- _query_builder,
414
- 'order' => order,
415
- 'employee_id' => employee_id,
416
- 'begin_clockin_time' => begin_clockin_time,
417
- 'end_clockin_time' => end_clockin_time,
418
- 'begin_clockout_time' => begin_clockout_time,
419
- 'end_clockout_time' => end_clockout_time,
420
- 'begin_updated_at' => begin_updated_at,
421
- 'end_updated_at' => end_updated_at,
422
- 'deleted' => deleted,
423
- 'limit' => limit,
424
- 'batch_token' => batch_token
425
- )
426
- _query_url = APIHelper.clean_url _query_builder
427
-
428
- # Prepare headers.
429
- _headers = {
430
- 'accept' => 'application/json'
431
- }
432
-
433
- # Prepare and execute HttpRequest.
434
- _request = config.http_client.get(
435
- _query_url,
436
- headers: _headers
437
- )
438
- OAuth2.apply(config, _request)
439
- _response = execute_request(_request)
440
-
441
- # Return appropriate response type.
442
- decoded = APIHelper.json_deserialize(_response.raw_body)
443
- _errors = APIHelper.map_response(decoded, ['errors'])
444
- ApiResponse.new(
445
- _response, data: decoded, errors: _errors
446
- )
447
- end
448
-
449
- # Creates a timecard for an employee and clocks them in with an
450
- # `API_CREATE` event and a `clockin_time` set to the current time unless
451
- # the request provides a different value.
452
- # To import timecards from another
453
- # system (rather than clocking someone in). Specify the `clockin_time`
454
- # and* `clockout_time` in the request.
455
- # Timecards correspond to exactly one shift for a given employee, bounded
456
- # by the `clockin_time` and `clockout_time` fields. An employee is
457
- # considered clocked in if they have a timecard that doesn't have a
458
- # `clockout_time` set. An employee that is currently clocked in cannot
459
- # be clocked in a second time.
460
- # @param [V1Timecard] body Required parameter: An object containing the
461
- # fields to POST for the request. See the corresponding object definition
462
- # for field details.
463
- # @return [V1Timecard Hash] response from the API call
464
- def create_timecard(body:)
465
- warn 'Endpoint create_timecard in V1EmployeesApi is deprecated'
466
- # Prepare query url.
467
- _query_builder = config.get_base_uri
468
- _query_builder << '/v1/me/timecards'
469
- _query_url = APIHelper.clean_url _query_builder
470
-
471
- # Prepare headers.
472
- _headers = {
473
- 'accept' => 'application/json',
474
- 'content-type' => 'application/json; charset=utf-8'
475
- }
476
-
477
- # Prepare and execute HttpRequest.
478
- _request = config.http_client.post(
479
- _query_url,
480
- headers: _headers,
481
- parameters: body.to_json
482
- )
483
- OAuth2.apply(config, _request)
484
- _response = execute_request(_request)
485
-
486
- # Return appropriate response type.
487
- decoded = APIHelper.json_deserialize(_response.raw_body)
488
- _errors = APIHelper.map_response(decoded, ['errors'])
489
- ApiResponse.new(
490
- _response, data: decoded, errors: _errors
491
- )
492
- end
493
-
494
- # Deletes a timecard. Timecards can also be deleted through the
495
- # Square Dashboard. Deleted timecards are still accessible through
496
- # Connect API endpoints, but cannot be modified. The `deleted` field of
497
- # the `Timecard` object indicates whether the timecard has been deleted.
498
- # __Note__: By default, deleted timecards appear alongside valid timecards
499
- # in
500
- # results returned by the
501
- # [ListTimecards](#endpoint-v1employees-listtimecards)
502
- # endpoint. To filter deleted timecards, include the `deleted` query
503
- # parameter in the list request.
504
- # Only approved accounts can manage their employees with Square.
505
- # Unapproved accounts cannot use employee management features with the
506
- # API.
507
- # @param [String] timecard_id Required parameter: The ID of the timecard to
508
- # delete.
509
- # @return [Object] response from the API call
510
- def delete_timecard(timecard_id:)
511
- warn 'Endpoint delete_timecard in V1EmployeesApi is deprecated'
512
- # Prepare query url.
513
- _query_builder = config.get_base_uri
514
- _query_builder << '/v1/me/timecards/{timecard_id}'
515
- _query_builder = APIHelper.append_url_with_template_parameters(
516
- _query_builder,
517
- 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
518
- )
519
- _query_url = APIHelper.clean_url _query_builder
520
-
521
- # Prepare and execute HttpRequest.
522
- _request = config.http_client.delete(
523
- _query_url
524
- )
525
- OAuth2.apply(config, _request)
526
- _response = execute_request(_request)
527
-
528
- # Return appropriate response type.
529
- ApiResponse.new(
530
- _response, data: _response.raw_body
531
- )
532
- end
533
-
534
- # Provides the details for a single timecard.
535
- # <aside>
536
- # Only approved accounts can manage their employees with Square.
537
- # Unapproved accounts cannot use employee management features with the
538
- # API.
539
- # </aside>
540
- # @param [String] timecard_id Required parameter: The timecard's ID.
541
- # @return [V1Timecard Hash] response from the API call
542
- def retrieve_timecard(timecard_id:)
543
- warn 'Endpoint retrieve_timecard in V1EmployeesApi is deprecated'
544
- # Prepare query url.
545
- _query_builder = config.get_base_uri
546
- _query_builder << '/v1/me/timecards/{timecard_id}'
547
- _query_builder = APIHelper.append_url_with_template_parameters(
548
- _query_builder,
549
- 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
550
- )
551
- _query_url = APIHelper.clean_url _query_builder
552
-
553
- # Prepare headers.
554
- _headers = {
555
- 'accept' => 'application/json'
556
- }
557
-
558
- # Prepare and execute HttpRequest.
559
- _request = config.http_client.get(
560
- _query_url,
561
- headers: _headers
562
- )
563
- OAuth2.apply(config, _request)
564
- _response = execute_request(_request)
565
-
566
- # Return appropriate response type.
567
- decoded = APIHelper.json_deserialize(_response.raw_body)
568
- _errors = APIHelper.map_response(decoded, ['errors'])
569
- ApiResponse.new(
570
- _response, data: decoded, errors: _errors
571
- )
572
- end
573
-
574
- # Modifies the details of a timecard with an `API_EDIT` event for
575
- # the timecard. Updating an active timecard with a `clockout_time`
576
- # clocks the employee out.
577
- # @param [String] timecard_id Required parameter: TThe ID of the timecard to
578
- # modify.
579
- # @param [V1Timecard] body Required parameter: An object containing the
580
- # fields to POST for the request. See the corresponding object definition
581
- # for field details.
582
- # @return [V1Timecard Hash] response from the API call
583
- def update_timecard(timecard_id:,
584
- body:)
585
- warn 'Endpoint update_timecard in V1EmployeesApi is deprecated'
586
- # Prepare query url.
587
- _query_builder = config.get_base_uri
588
- _query_builder << '/v1/me/timecards/{timecard_id}'
589
- _query_builder = APIHelper.append_url_with_template_parameters(
590
- _query_builder,
591
- 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
592
- )
593
- _query_url = APIHelper.clean_url _query_builder
594
-
595
- # Prepare headers.
596
- _headers = {
597
- 'accept' => 'application/json',
598
- 'content-type' => 'application/json; charset=utf-8'
599
- }
600
-
601
- # Prepare and execute HttpRequest.
602
- _request = config.http_client.put(
603
- _query_url,
604
- headers: _headers,
605
- parameters: body.to_json
606
- )
607
- OAuth2.apply(config, _request)
608
- _response = execute_request(_request)
609
-
610
- # Return appropriate response type.
611
- decoded = APIHelper.json_deserialize(_response.raw_body)
612
- _errors = APIHelper.map_response(decoded, ['errors'])
613
- ApiResponse.new(
614
- _response, data: decoded, errors: _errors
615
- )
616
- end
617
-
618
- # Provides summary information for all events associated with a
619
- # particular timecard.
620
- # <aside>
621
- # Only approved accounts can manage their employees with Square.
622
- # Unapproved accounts cannot use employee management features with the
623
- # API.
624
- # </aside>
625
- # @param [String] timecard_id Required parameter: The ID of the timecard to
626
- # list events for.
627
- # @return [List of V1TimecardEvent Hash] response from the API call
628
- def list_timecard_events(timecard_id:)
629
- warn 'Endpoint list_timecard_events in V1EmployeesApi is deprecated'
630
- # Prepare query url.
631
- _query_builder = config.get_base_uri
632
- _query_builder << '/v1/me/timecards/{timecard_id}/events'
633
- _query_builder = APIHelper.append_url_with_template_parameters(
634
- _query_builder,
635
- 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
636
- )
637
- _query_url = APIHelper.clean_url _query_builder
638
-
639
- # Prepare headers.
640
- _headers = {
641
- 'accept' => 'application/json'
642
- }
643
-
644
- # Prepare and execute HttpRequest.
645
- _request = config.http_client.get(
646
- _query_url,
647
- headers: _headers
648
- )
649
- OAuth2.apply(config, _request)
650
- _response = execute_request(_request)
651
-
652
- # Return appropriate response type.
653
- decoded = APIHelper.json_deserialize(_response.raw_body)
654
- _errors = APIHelper.map_response(decoded, ['errors'])
655
- ApiResponse.new(
656
- _response, data: decoded, errors: _errors
657
- )
658
- end
659
-
660
- # Provides the details for all of a location's cash drawer shifts during a
661
- # date range. The date range you specify cannot exceed 90 days.
662
- # @param [String] location_id Required parameter: The ID of the location to
663
- # list cash drawer shifts for.
664
- # @param [SortOrder] order Optional parameter: The order in which cash
665
- # drawer shifts are listed in the response, based on their created_at field.
666
- # Default value: ASC
667
- # @param [String] begin_time Optional parameter: The beginning of the
668
- # requested reporting period, in ISO 8601 format. Default value: The current
669
- # time minus 90 days.
670
- # @param [String] end_time Optional parameter: The beginning of the
671
- # requested reporting period, in ISO 8601 format. Default value: The current
672
- # time.
673
- # @return [List of V1CashDrawerShift Hash] response from the API call
674
- def list_cash_drawer_shifts(location_id:,
675
- order: nil,
676
- begin_time: nil,
677
- end_time: nil)
678
- warn 'Endpoint list_cash_drawer_shifts in V1EmployeesApi is deprecated'
679
- # Prepare query url.
680
- _query_builder = config.get_base_uri
681
- _query_builder << '/v1/{location_id}/cash-drawer-shifts'
682
- _query_builder = APIHelper.append_url_with_template_parameters(
683
- _query_builder,
684
- 'location_id' => { 'value' => location_id, 'encode' => true }
685
- )
686
- _query_builder = APIHelper.append_url_with_query_parameters(
687
- _query_builder,
688
- 'order' => order,
689
- 'begin_time' => begin_time,
690
- 'end_time' => end_time
691
- )
692
- _query_url = APIHelper.clean_url _query_builder
693
-
694
- # Prepare headers.
695
- _headers = {
696
- 'accept' => 'application/json'
697
- }
698
-
699
- # Prepare and execute HttpRequest.
700
- _request = config.http_client.get(
701
- _query_url,
702
- headers: _headers
703
- )
704
- OAuth2.apply(config, _request)
705
- _response = execute_request(_request)
706
-
707
- # Return appropriate response type.
708
- decoded = APIHelper.json_deserialize(_response.raw_body)
709
- _errors = APIHelper.map_response(decoded, ['errors'])
710
- ApiResponse.new(
711
- _response, data: decoded, errors: _errors
712
- )
713
- end
714
-
715
- # Provides the details for a single cash drawer shift, including all events
716
- # that occurred during the shift.
717
- # @param [String] location_id Required parameter: The ID of the location to
718
- # list cash drawer shifts for.
719
- # @param [String] shift_id Required parameter: The shift's ID.
720
- # @return [V1CashDrawerShift Hash] response from the API call
721
- def retrieve_cash_drawer_shift(location_id:,
722
- shift_id:)
723
- warn 'Endpoint retrieve_cash_drawer_shift in V1EmployeesApi is deprecated'
724
- # Prepare query url.
725
- _query_builder = config.get_base_uri
726
- _query_builder << '/v1/{location_id}/cash-drawer-shifts/{shift_id}'
727
- _query_builder = APIHelper.append_url_with_template_parameters(
728
- _query_builder,
729
- 'location_id' => { 'value' => location_id, 'encode' => true },
730
- 'shift_id' => { 'value' => shift_id, 'encode' => true }
731
- )
732
- _query_url = APIHelper.clean_url _query_builder
733
-
734
- # Prepare headers.
735
- _headers = {
736
- 'accept' => 'application/json'
737
- }
738
-
739
- # Prepare and execute HttpRequest.
740
- _request = config.http_client.get(
741
- _query_url,
742
- headers: _headers
743
- )
744
- OAuth2.apply(config, _request)
745
- _response = execute_request(_request)
746
-
747
- # Return appropriate response type.
748
- decoded = APIHelper.json_deserialize(_response.raw_body)
749
- _errors = APIHelper.map_response(decoded, ['errors'])
750
- ApiResponse.new(
751
- _response, data: decoded, errors: _errors
752
- )
753
- end
754
360
  end
755
361
  end