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
@@ -1,65 +0,0 @@
1
- module Square
2
- # V1LocationsApi
3
- class V1LocationsApi < BaseApi
4
- def initialize(config, http_call_back: nil)
5
- super(config, http_call_back: http_call_back)
6
- end
7
-
8
- # Get the general information for a business.
9
- # @return [V1Merchant Hash] response from the API call
10
- def retrieve_business
11
- warn 'Endpoint retrieve_business in V1LocationsApi is deprecated'
12
- # Prepare query url.
13
- _query_builder = config.get_base_uri
14
- _query_builder << '/v1/me'
15
- _query_url = APIHelper.clean_url _query_builder
16
-
17
- # Prepare headers.
18
- _headers = {
19
- 'accept' => 'application/json'
20
- }
21
-
22
- # Prepare and execute HttpRequest.
23
- _request = config.http_client.get(
24
- _query_url,
25
- headers: _headers
26
- )
27
- OAuth2.apply(config, _request)
28
- _response = execute_request(_request)
29
-
30
- # Return appropriate response type.
31
- decoded = APIHelper.json_deserialize(_response.raw_body)
32
- _errors = APIHelper.map_response(decoded, ['errors'])
33
- ApiResponse.new(_response, data: decoded, errors: _errors)
34
- end
35
-
36
- # Provides details for all business locations associated with a Square
37
- # account, including the Square-assigned object ID for the location.
38
- # @return [List of V1Merchant Hash] response from the API call
39
- def list_locations
40
- warn 'Endpoint list_locations in V1LocationsApi is deprecated'
41
- # Prepare query url.
42
- _query_builder = config.get_base_uri
43
- _query_builder << '/v1/me/locations'
44
- _query_url = APIHelper.clean_url _query_builder
45
-
46
- # Prepare headers.
47
- _headers = {
48
- 'accept' => 'application/json'
49
- }
50
-
51
- # Prepare and execute HttpRequest.
52
- _request = config.http_client.get(
53
- _query_url,
54
- headers: _headers
55
- )
56
- OAuth2.apply(config, _request)
57
- _response = execute_request(_request)
58
-
59
- # Return appropriate response type.
60
- decoded = APIHelper.json_deserialize(_response.raw_body)
61
- _errors = APIHelper.map_response(decoded, ['errors'])
62
- ApiResponse.new(_response, data: decoded, errors: _errors)
63
- end
64
- end
65
- end