square.rb 8.1.0.20210121 → 9.0.0.20210226

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65883291fee1f3779feb258fe5df4efdc171b581e34b9245be01e143ed8cd819
4
- data.tar.gz: 8665e1c3187d85b979970ace13887e6bf18688e47828af12671cd6e939994174
3
+ metadata.gz: d590e351e349cad97ee0e30e6f0c281f699e9357b68007ce847cdf3d69b86451
4
+ data.tar.gz: 5f89a1777603830bb3b6878f3e45041522c862a2b625e8bdda39c2893678e93d
5
5
  SHA512:
6
- metadata.gz: 7d7b11eded83cbbbfa7e1985e9b7456568f26353681380ab370446045d15c2d8882a048ef940ef9c34b36cd6ca541a421e3cea740b38db85a7048e08b0bbb08e
7
- data.tar.gz: 88a9b4f2a1bd0ec750b83ecc8ce582bd8e7f3a8cfe30c203feadb8e13851946780a2c2ef92be350448204fa76aadcb98552d7281a3b9dea1e33f01c13aa21ba3
6
+ metadata.gz: d460315ea4f40be58b73ae56ce056ae5a7e0d09f8ca3b8604e8e347987743054228243318d4e23cbb2cf876272c88e7c5ace6cd50ddf9ad2a116f84c20a378f0
7
+ data.tar.gz: 48da57deda485630006753f057fc6962caea914f058fca58d20884696e101b3e859b8cd5bf68a6d69817ed62b66fb743bddde49b5c15d9837ccca91fe40dc806
data/README.md CHANGED
@@ -196,6 +196,15 @@ client = Square::Client.new(
196
196
  environment: 'production'
197
197
  )
198
198
  ```
199
+
200
+ - To set a custom environment provide a `custom_url`, and set environment to `custom`:
201
+
202
+ ```ruby
203
+ client = Square::Client.new(
204
+ access_token:'ACCESS TOKEN HERE',
205
+ environment: 'custom',
206
+ custom_url: 'https://your.customdomain.com'
207
+ )
199
208
 
200
209
  ### Get an Instance of an API object and call its methods
201
210
 
data/lib/square.rb CHANGED
@@ -33,7 +33,6 @@ require_relative 'square/api/mobile_authorization_api.rb'
33
33
  require_relative 'square/api/o_auth_api.rb'
34
34
  require_relative 'square/api/v1_employees_api.rb'
35
35
  require_relative 'square/api/v1_transactions_api.rb'
36
- require_relative 'square/api/v1_items_api.rb'
37
36
  require_relative 'square/api/apple_pay_api.rb'
38
37
  require_relative 'square/api/bank_accounts_api.rb'
39
38
  require_relative 'square/api/bookings_api.rb'
@@ -8,7 +8,7 @@ module Square
8
8
  @http_call_back = http_call_back
9
9
 
10
10
  @global_headers = {
11
- 'user-agent' => 'Square-Ruby-SDK/8.1.0.20210121',
11
+ 'user-agent' => 'Square-Ruby-SDK/9.0.0.20210226',
12
12
  'Square-Version' => config.square_version
13
13
  }
14
14
  end
@@ -357,393 +357,5 @@ module Square
357
357
  _response, data: decoded, errors: _errors
358
358
  )
359
359
  end
360
-
361
- # Provides summary information for all of a business's employee timecards.
362
- # @param [SortOrder] order Optional parameter: The order in which timecards
363
- # are listed in the response, based on their created_at field.
364
- # @param [String] employee_id Optional parameter: If provided, the endpoint
365
- # returns only timecards for the employee with the specified ID.
366
- # @param [String] begin_clockin_time Optional parameter: If filtering
367
- # results by their clockin_time field, the beginning of the requested
368
- # reporting period, in ISO 8601 format.
369
- # @param [String] end_clockin_time Optional parameter: If filtering results
370
- # by their clockin_time field, the end of the requested reporting period, in
371
- # ISO 8601 format.
372
- # @param [String] begin_clockout_time Optional parameter: If filtering
373
- # results by their clockout_time field, the beginning of the requested
374
- # reporting period, in ISO 8601 format.
375
- # @param [String] end_clockout_time Optional parameter: If filtering results
376
- # by their clockout_time field, the end of the requested reporting period,
377
- # in ISO 8601 format.
378
- # @param [String] begin_updated_at Optional parameter: If filtering results
379
- # by their updated_at field, the beginning of the requested reporting
380
- # period, in ISO 8601 format.
381
- # @param [String] end_updated_at Optional parameter: If filtering results by
382
- # their updated_at field, the end of the requested reporting period, in ISO
383
- # 8601 format.
384
- # @param [Boolean] deleted Optional parameter: If true, only deleted
385
- # timecards are returned. If false, only valid timecards are returned.If you
386
- # don't provide this parameter, both valid and deleted timecards are
387
- # returned.
388
- # @param [Integer] limit Optional parameter: The maximum integer number of
389
- # employee entities to return in a single response. Default 100, maximum
390
- # 200.
391
- # @param [String] batch_token Optional parameter: A pagination cursor to
392
- # retrieve the next set of results for your original query to the
393
- # endpoint.
394
- # @return [List of V1Timecard Hash] response from the API call
395
- def list_timecards(order: nil,
396
- employee_id: nil,
397
- begin_clockin_time: nil,
398
- end_clockin_time: nil,
399
- begin_clockout_time: nil,
400
- end_clockout_time: nil,
401
- begin_updated_at: nil,
402
- end_updated_at: nil,
403
- deleted: false,
404
- limit: nil,
405
- batch_token: nil)
406
- warn 'Endpoint list_timecards in V1EmployeesApi is deprecated'
407
- # Prepare query url.
408
- _query_builder = config.get_base_uri
409
- _query_builder << '/v1/me/timecards'
410
- _query_builder = APIHelper.append_url_with_query_parameters(
411
- _query_builder,
412
- 'order' => order,
413
- 'employee_id' => employee_id,
414
- 'begin_clockin_time' => begin_clockin_time,
415
- 'end_clockin_time' => end_clockin_time,
416
- 'begin_clockout_time' => begin_clockout_time,
417
- 'end_clockout_time' => end_clockout_time,
418
- 'begin_updated_at' => begin_updated_at,
419
- 'end_updated_at' => end_updated_at,
420
- 'deleted' => deleted,
421
- 'limit' => limit,
422
- 'batch_token' => batch_token
423
- )
424
- _query_url = APIHelper.clean_url _query_builder
425
-
426
- # Prepare headers.
427
- _headers = {
428
- 'accept' => 'application/json'
429
- }
430
-
431
- # Prepare and execute HttpRequest.
432
- _request = config.http_client.get(
433
- _query_url,
434
- headers: _headers
435
- )
436
- OAuth2.apply(config, _request)
437
- _response = execute_request(_request)
438
-
439
- # Return appropriate response type.
440
- decoded = APIHelper.json_deserialize(_response.raw_body)
441
- _errors = APIHelper.map_response(decoded, ['errors'])
442
- ApiResponse.new(
443
- _response, data: decoded, errors: _errors
444
- )
445
- end
446
-
447
- # Creates a timecard for an employee and clocks them in with an
448
- # `API_CREATE` event and a `clockin_time` set to the current time unless
449
- # the request provides a different value.
450
- # To import timecards from another
451
- # system (rather than clocking someone in). Specify the `clockin_time`
452
- # and* `clockout_time` in the request.
453
- # Timecards correspond to exactly one shift for a given employee, bounded
454
- # by the `clockin_time` and `clockout_time` fields. An employee is
455
- # considered clocked in if they have a timecard that doesn't have a
456
- # `clockout_time` set. An employee that is currently clocked in cannot
457
- # be clocked in a second time.
458
- # @param [V1Timecard] body Required parameter: An object containing the
459
- # fields to POST for the request. See the corresponding object definition
460
- # for field details.
461
- # @return [V1Timecard Hash] response from the API call
462
- def create_timecard(body:)
463
- warn 'Endpoint create_timecard in V1EmployeesApi is deprecated'
464
- # Prepare query url.
465
- _query_builder = config.get_base_uri
466
- _query_builder << '/v1/me/timecards'
467
- _query_url = APIHelper.clean_url _query_builder
468
-
469
- # Prepare headers.
470
- _headers = {
471
- 'accept' => 'application/json',
472
- 'content-type' => 'application/json; charset=utf-8'
473
- }
474
-
475
- # Prepare and execute HttpRequest.
476
- _request = config.http_client.post(
477
- _query_url,
478
- headers: _headers,
479
- parameters: body.to_json
480
- )
481
- OAuth2.apply(config, _request)
482
- _response = execute_request(_request)
483
-
484
- # Return appropriate response type.
485
- decoded = APIHelper.json_deserialize(_response.raw_body)
486
- _errors = APIHelper.map_response(decoded, ['errors'])
487
- ApiResponse.new(
488
- _response, data: decoded, errors: _errors
489
- )
490
- end
491
-
492
- # Deletes a timecard. Timecards can also be deleted through the
493
- # Square Dashboard. Deleted timecards are still accessible through
494
- # Connect API endpoints, but cannot be modified. The `deleted` field of
495
- # the `Timecard` object indicates whether the timecard has been deleted.
496
- # __Note__: By default, deleted timecards appear alongside valid timecards
497
- # in
498
- # results returned by the
499
- # [ListTimecards](#endpoint-v1employees-listtimecards)
500
- # endpoint. To filter deleted timecards, include the `deleted` query
501
- # parameter in the list request.
502
- # Only approved accounts can manage their employees with Square.
503
- # Unapproved accounts cannot use employee management features with the
504
- # API.
505
- # @param [String] timecard_id Required parameter: The ID of the timecard to
506
- # delete.
507
- # @return [Object] response from the API call
508
- def delete_timecard(timecard_id:)
509
- warn 'Endpoint delete_timecard in V1EmployeesApi is deprecated'
510
- # Prepare query url.
511
- _query_builder = config.get_base_uri
512
- _query_builder << '/v1/me/timecards/{timecard_id}'
513
- _query_builder = APIHelper.append_url_with_template_parameters(
514
- _query_builder,
515
- 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
516
- )
517
- _query_url = APIHelper.clean_url _query_builder
518
-
519
- # Prepare and execute HttpRequest.
520
- _request = config.http_client.delete(
521
- _query_url
522
- )
523
- OAuth2.apply(config, _request)
524
- _response = execute_request(_request)
525
-
526
- # Return appropriate response type.
527
- ApiResponse.new(
528
- _response, data: _response.raw_body
529
- )
530
- end
531
-
532
- # Provides the details for a single timecard.
533
- # Only approved accounts can manage their employees with Square.
534
- # Unapproved accounts cannot use employee management features with the
535
- # API.
536
- # @param [String] timecard_id Required parameter: The timecard's ID.
537
- # @return [V1Timecard Hash] response from the API call
538
- def retrieve_timecard(timecard_id:)
539
- warn 'Endpoint retrieve_timecard in V1EmployeesApi is deprecated'
540
- # Prepare query url.
541
- _query_builder = config.get_base_uri
542
- _query_builder << '/v1/me/timecards/{timecard_id}'
543
- _query_builder = APIHelper.append_url_with_template_parameters(
544
- _query_builder,
545
- 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
546
- )
547
- _query_url = APIHelper.clean_url _query_builder
548
-
549
- # Prepare headers.
550
- _headers = {
551
- 'accept' => 'application/json'
552
- }
553
-
554
- # Prepare and execute HttpRequest.
555
- _request = config.http_client.get(
556
- _query_url,
557
- headers: _headers
558
- )
559
- OAuth2.apply(config, _request)
560
- _response = execute_request(_request)
561
-
562
- # Return appropriate response type.
563
- decoded = APIHelper.json_deserialize(_response.raw_body)
564
- _errors = APIHelper.map_response(decoded, ['errors'])
565
- ApiResponse.new(
566
- _response, data: decoded, errors: _errors
567
- )
568
- end
569
-
570
- # Modifies the details of a timecard with an `API_EDIT` event for
571
- # the timecard. Updating an active timecard with a `clockout_time`
572
- # clocks the employee out.
573
- # @param [String] timecard_id Required parameter: TThe ID of the timecard to
574
- # modify.
575
- # @param [V1Timecard] body Required parameter: An object containing the
576
- # fields to POST for the request. See the corresponding object definition
577
- # for field details.
578
- # @return [V1Timecard Hash] response from the API call
579
- def update_timecard(timecard_id:,
580
- body:)
581
- warn 'Endpoint update_timecard in V1EmployeesApi is deprecated'
582
- # Prepare query url.
583
- _query_builder = config.get_base_uri
584
- _query_builder << '/v1/me/timecards/{timecard_id}'
585
- _query_builder = APIHelper.append_url_with_template_parameters(
586
- _query_builder,
587
- 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
588
- )
589
- _query_url = APIHelper.clean_url _query_builder
590
-
591
- # Prepare headers.
592
- _headers = {
593
- 'accept' => 'application/json',
594
- 'content-type' => 'application/json; charset=utf-8'
595
- }
596
-
597
- # Prepare and execute HttpRequest.
598
- _request = config.http_client.put(
599
- _query_url,
600
- headers: _headers,
601
- parameters: body.to_json
602
- )
603
- OAuth2.apply(config, _request)
604
- _response = execute_request(_request)
605
-
606
- # Return appropriate response type.
607
- decoded = APIHelper.json_deserialize(_response.raw_body)
608
- _errors = APIHelper.map_response(decoded, ['errors'])
609
- ApiResponse.new(
610
- _response, data: decoded, errors: _errors
611
- )
612
- end
613
-
614
- # Provides summary information for all events associated with a
615
- # particular timecard.
616
- # Only approved accounts can manage their employees with Square.
617
- # Unapproved accounts cannot use employee management features with the
618
- # API.
619
- # @param [String] timecard_id Required parameter: The ID of the timecard to
620
- # list events for.
621
- # @return [List of V1TimecardEvent Hash] response from the API call
622
- def list_timecard_events(timecard_id:)
623
- warn 'Endpoint list_timecard_events in V1EmployeesApi is deprecated'
624
- # Prepare query url.
625
- _query_builder = config.get_base_uri
626
- _query_builder << '/v1/me/timecards/{timecard_id}/events'
627
- _query_builder = APIHelper.append_url_with_template_parameters(
628
- _query_builder,
629
- 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
630
- )
631
- _query_url = APIHelper.clean_url _query_builder
632
-
633
- # Prepare headers.
634
- _headers = {
635
- 'accept' => 'application/json'
636
- }
637
-
638
- # Prepare and execute HttpRequest.
639
- _request = config.http_client.get(
640
- _query_url,
641
- headers: _headers
642
- )
643
- OAuth2.apply(config, _request)
644
- _response = execute_request(_request)
645
-
646
- # Return appropriate response type.
647
- decoded = APIHelper.json_deserialize(_response.raw_body)
648
- _errors = APIHelper.map_response(decoded, ['errors'])
649
- ApiResponse.new(
650
- _response, data: decoded, errors: _errors
651
- )
652
- end
653
-
654
- # Provides the details for all of a location's cash drawer shifts during a
655
- # date range. The date range you specify cannot exceed 90 days.
656
- # @param [String] location_id Required parameter: The ID of the location to
657
- # list cash drawer shifts for.
658
- # @param [SortOrder] order Optional parameter: The order in which cash
659
- # drawer shifts are listed in the response, based on their created_at field.
660
- # Default value: ASC
661
- # @param [String] begin_time Optional parameter: The beginning of the
662
- # requested reporting period, in ISO 8601 format. Default value: The current
663
- # time minus 90 days.
664
- # @param [String] end_time Optional parameter: The beginning of the
665
- # requested reporting period, in ISO 8601 format. Default value: The current
666
- # time.
667
- # @return [List of V1CashDrawerShift Hash] response from the API call
668
- def list_cash_drawer_shifts(location_id:,
669
- order: nil,
670
- begin_time: nil,
671
- end_time: nil)
672
- warn 'Endpoint list_cash_drawer_shifts in V1EmployeesApi is deprecated'
673
- # Prepare query url.
674
- _query_builder = config.get_base_uri
675
- _query_builder << '/v1/{location_id}/cash-drawer-shifts'
676
- _query_builder = APIHelper.append_url_with_template_parameters(
677
- _query_builder,
678
- 'location_id' => { 'value' => location_id, 'encode' => true }
679
- )
680
- _query_builder = APIHelper.append_url_with_query_parameters(
681
- _query_builder,
682
- 'order' => order,
683
- 'begin_time' => begin_time,
684
- 'end_time' => end_time
685
- )
686
- _query_url = APIHelper.clean_url _query_builder
687
-
688
- # Prepare headers.
689
- _headers = {
690
- 'accept' => 'application/json'
691
- }
692
-
693
- # Prepare and execute HttpRequest.
694
- _request = config.http_client.get(
695
- _query_url,
696
- headers: _headers
697
- )
698
- OAuth2.apply(config, _request)
699
- _response = execute_request(_request)
700
-
701
- # Return appropriate response type.
702
- decoded = APIHelper.json_deserialize(_response.raw_body)
703
- _errors = APIHelper.map_response(decoded, ['errors'])
704
- ApiResponse.new(
705
- _response, data: decoded, errors: _errors
706
- )
707
- end
708
-
709
- # Provides the details for a single cash drawer shift, including all events
710
- # that occurred during the shift.
711
- # @param [String] location_id Required parameter: The ID of the location to
712
- # list cash drawer shifts for.
713
- # @param [String] shift_id Required parameter: The shift's ID.
714
- # @return [V1CashDrawerShift Hash] response from the API call
715
- def retrieve_cash_drawer_shift(location_id:,
716
- shift_id:)
717
- warn 'Endpoint retrieve_cash_drawer_shift in V1EmployeesApi is deprecated'
718
- # Prepare query url.
719
- _query_builder = config.get_base_uri
720
- _query_builder << '/v1/{location_id}/cash-drawer-shifts/{shift_id}'
721
- _query_builder = APIHelper.append_url_with_template_parameters(
722
- _query_builder,
723
- 'location_id' => { 'value' => location_id, 'encode' => true },
724
- 'shift_id' => { 'value' => shift_id, 'encode' => true }
725
- )
726
- _query_url = APIHelper.clean_url _query_builder
727
-
728
- # Prepare headers.
729
- _headers = {
730
- 'accept' => 'application/json'
731
- }
732
-
733
- # Prepare and execute HttpRequest.
734
- _request = config.http_client.get(
735
- _query_url,
736
- headers: _headers
737
- )
738
- OAuth2.apply(config, _request)
739
- _response = execute_request(_request)
740
-
741
- # Return appropriate response type.
742
- decoded = APIHelper.json_deserialize(_response.raw_body)
743
- _errors = APIHelper.map_response(decoded, ['errors'])
744
- ApiResponse.new(
745
- _response, data: decoded, errors: _errors
746
- )
747
- end
748
360
  end
749
361
  end
@@ -5,91 +5,10 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Provides non-confidential details for all of a location's associated bank
9
- # accounts. This endpoint does not provide full bank account numbers, and
10
- # there is no way to obtain a full bank account number with the Connect API.
11
- # @param [String] location_id Required parameter: The ID of the location to
12
- # list bank accounts for.
13
- # @return [List of V1BankAccount Hash] response from the API call
14
- def list_bank_accounts(location_id:)
15
- warn 'Endpoint list_bank_accounts in V1TransactionsApi is deprecated'
16
- # Prepare query url.
17
- _query_builder = config.get_base_uri
18
- _query_builder << '/v1/{location_id}/bank-accounts'
19
- _query_builder = APIHelper.append_url_with_template_parameters(
20
- _query_builder,
21
- 'location_id' => { 'value' => location_id, 'encode' => true }
22
- )
23
- _query_url = APIHelper.clean_url _query_builder
24
-
25
- # Prepare headers.
26
- _headers = {
27
- 'accept' => 'application/json'
28
- }
29
-
30
- # Prepare and execute HttpRequest.
31
- _request = config.http_client.get(
32
- _query_url,
33
- headers: _headers
34
- )
35
- OAuth2.apply(config, _request)
36
- _response = execute_request(_request)
37
-
38
- # Return appropriate response type.
39
- decoded = APIHelper.json_deserialize(_response.raw_body)
40
- _errors = APIHelper.map_response(decoded, ['errors'])
41
- ApiResponse.new(
42
- _response, data: decoded, errors: _errors
43
- )
44
- end
45
-
46
- # Provides non-confidential details for a merchant's associated bank
47
- # account. This endpoint does not provide full bank account numbers, and
48
- # there is no way to obtain a full bank account number with the Connect API.
49
- # @param [String] location_id Required parameter: The ID of the bank
50
- # account's associated location.
51
- # @param [String] bank_account_id Required parameter: The bank account's
52
- # Square-issued ID. You obtain this value from Settlement objects
53
- # returned.
54
- # @return [V1BankAccount Hash] response from the API call
55
- def retrieve_bank_account(location_id:,
56
- bank_account_id:)
57
- warn 'Endpoint retrieve_bank_account in V1TransactionsApi is deprecated'
58
- # Prepare query url.
59
- _query_builder = config.get_base_uri
60
- _query_builder << '/v1/{location_id}/bank-accounts/{bank_account_id}'
61
- _query_builder = APIHelper.append_url_with_template_parameters(
62
- _query_builder,
63
- 'location_id' => { 'value' => location_id, 'encode' => true },
64
- 'bank_account_id' => { 'value' => bank_account_id, 'encode' => true }
65
- )
66
- _query_url = APIHelper.clean_url _query_builder
67
-
68
- # Prepare headers.
69
- _headers = {
70
- 'accept' => 'application/json'
71
- }
72
-
73
- # Prepare and execute HttpRequest.
74
- _request = config.http_client.get(
75
- _query_url,
76
- headers: _headers
77
- )
78
- OAuth2.apply(config, _request)
79
- _response = execute_request(_request)
80
-
81
- # Return appropriate response type.
82
- decoded = APIHelper.json_deserialize(_response.raw_body)
83
- _errors = APIHelper.map_response(decoded, ['errors'])
84
- ApiResponse.new(
85
- _response, data: decoded, errors: _errors
86
- )
87
- end
88
-
89
8
  # Provides summary information for a merchant's online store orders.
90
9
  # @param [String] location_id Required parameter: The ID of the location to
91
10
  # list online store orders for.
92
- # @param [SortOrder] order Optional parameter: TThe order in which payments
11
+ # @param [SortOrder] order Optional parameter: The order in which payments
93
12
  # are listed in the response.
94
13
  # @param [Integer] limit Optional parameter: The maximum number of payments
95
14
  # to return in a single response. This value cannot exceed 200.
@@ -350,7 +269,7 @@ module Square
350
269
  # year in length.
351
270
  # @param [String] location_id Required parameter: The ID of the location to
352
271
  # list refunds for.
353
- # @param [SortOrder] order Optional parameter: TThe order in which payments
272
+ # @param [SortOrder] order Optional parameter: The order in which payments
354
273
  # are listed in the response.
355
274
  # @param [String] begin_time Optional parameter: The beginning of the
356
275
  # requested reporting period, in ISO 8601 format. If this value is before