square.rb 6.2.0.20200812 → 8.0.0.20201216

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +34 -33
  3. data/lib/square.rb +61 -62
  4. data/lib/square/api/apple_pay_api.rb +5 -3
  5. data/lib/square/api/bank_accounts_api.rb +16 -19
  6. data/lib/square/api/base_api.rb +1 -1
  7. data/lib/square/api/bookings_api.rb +308 -0
  8. data/lib/square/api/cash_drawers_api.rb +13 -6
  9. data/lib/square/api/catalog_api.rb +68 -32
  10. data/lib/square/api/checkout_api.rb +4 -2
  11. data/lib/square/api/customer_groups_api.rb +18 -8
  12. data/lib/square/api/customer_segments_api.rb +9 -5
  13. data/lib/square/api/customers_api.rb +47 -27
  14. data/lib/square/api/devices_api.rb +17 -6
  15. data/lib/square/api/disputes_api.rb +71 -68
  16. data/lib/square/api/employees_api.rb +10 -5
  17. data/lib/square/api/inventory_api.rb +30 -15
  18. data/lib/square/api/invoices_api.rb +42 -38
  19. data/lib/square/api/labor_api.rb +131 -22
  20. data/lib/square/api/locations_api.rb +16 -13
  21. data/lib/square/api/loyalty_api.rb +60 -66
  22. data/lib/square/api/merchants_api.rb +7 -3
  23. data/lib/square/api/mobile_authorization_api.rb +5 -3
  24. data/lib/square/api/o_auth_api.rb +11 -8
  25. data/lib/square/api/orders_api.rb +111 -90
  26. data/lib/square/api/payments_api.rb +75 -65
  27. data/lib/square/api/refunds_api.rb +37 -27
  28. data/lib/square/api/subscriptions_api.rb +29 -28
  29. data/lib/square/api/team_api.rb +46 -30
  30. data/lib/square/api/terminal_api.rb +156 -7
  31. data/lib/square/api/transactions_api.rb +32 -18
  32. data/lib/square/api/v1_employees_api.rb +59 -31
  33. data/lib/square/api/v1_items_api.rb +195 -115
  34. data/lib/square/api/v1_transactions_api.rb +49 -27
  35. data/lib/square/api_helper.rb +14 -9
  36. data/lib/square/client.rb +14 -20
  37. data/lib/square/configuration.rb +2 -2
  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/api_test_base.rb +1 -6
  42. data/test/api/test_catalog_api.rb +1 -4
  43. data/test/api/test_customers_api.rb +1 -4
  44. data/test/api/test_employees_api.rb +1 -4
  45. data/test/api/test_labor_api.rb +2 -6
  46. data/test/api/test_locations_api.rb +22 -33
  47. data/test/api/test_merchants_api.rb +1 -4
  48. data/test/api/test_payments_api.rb +3 -6
  49. data/test/api/test_refunds_api.rb +3 -6
  50. data/test/http_response_catcher.rb +0 -5
  51. data/test/test_helper.rb +0 -5
  52. metadata +33 -16
  53. data/lib/square/api/reporting_api.rb +0 -138
  54. 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