square.rb 6.5.0.20201028 → 9.1.0.20210317

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,69 +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(
34
- _response, data: decoded, errors: _errors
35
- )
36
- end
37
-
38
- # Provides details for all business locations associated with a Square
39
- # account, including the Square-assigned object ID for the location.
40
- # @return [List of V1Merchant Hash] response from the API call
41
- def list_locations
42
- warn 'Endpoint list_locations in V1LocationsApi is deprecated'
43
- # Prepare query url.
44
- _query_builder = config.get_base_uri
45
- _query_builder << '/v1/me/locations'
46
- _query_url = APIHelper.clean_url _query_builder
47
-
48
- # Prepare headers.
49
- _headers = {
50
- 'accept' => 'application/json'
51
- }
52
-
53
- # Prepare and execute HttpRequest.
54
- _request = config.http_client.get(
55
- _query_url,
56
- headers: _headers
57
- )
58
- OAuth2.apply(config, _request)
59
- _response = execute_request(_request)
60
-
61
- # Return appropriate response type.
62
- decoded = APIHelper.json_deserialize(_response.raw_body)
63
- _errors = APIHelper.map_response(decoded, ['errors'])
64
- ApiResponse.new(
65
- _response, data: decoded, errors: _errors
66
- )
67
- end
68
- end
69
- end