square.rb 3.20190624.0 → 3.20190814.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +10 -28
- data/README.md +281 -17235
- data/lib/square/api/apple_pay_api.rb +55 -54
- data/lib/square/api/base_api.rb +45 -45
- data/lib/square/api/catalog_api.rb +461 -460
- data/lib/square/api/checkout_api.rb +54 -54
- data/lib/square/api/customers_api.rb +335 -334
- data/lib/square/api/employees_api.rb +91 -91
- data/lib/square/api/inventory_api.rb +300 -298
- data/lib/square/api/labor_api.rb +558 -558
- data/lib/square/api/locations_api.rb +45 -45
- data/lib/square/api/mobile_authorization_api.rb +56 -56
- data/lib/square/api/o_auth_api.rb +168 -164
- data/lib/square/api/orders_api.rb +269 -151
- data/lib/square/api/payments_api.rb +282 -0
- data/lib/square/api/refunds_api.rb +149 -0
- data/lib/square/api/reporting_api.rb +143 -139
- data/lib/square/api/transactions_api.rb +379 -360
- data/lib/square/api/v1_employees_api.rb +720 -720
- data/lib/square/api/v1_items_api.rb +1651 -1651
- data/lib/square/api/v1_locations_api.rb +67 -67
- data/lib/square/api/v1_locations_api.rbe +67 -0
- data/lib/square/api/v1_transactions_api.rb +574 -574
- data/lib/square/api_helper.rb +281 -277
- data/lib/square/client.rb +139 -127
- data/lib/square/configuration.rb +88 -85
- data/lib/square/exceptions/api_exception.rb +20 -20
- data/lib/square/http/api_response.rb +50 -50
- data/lib/square/http/auth/o_auth2.rb +17 -17
- data/lib/square/http/faraday_client.rb +64 -64
- data/lib/square/http/http_call_back.rb +24 -24
- data/lib/square/http/http_client.rb +104 -104
- data/lib/square/http/http_method_enum.rb +13 -13
- data/lib/square/http/http_request.rb +50 -50
- data/lib/square/http/http_response.rb +29 -29
- data/lib/square.rb +52 -50
- data/spec/user_journey_spec.rb +4 -1
- data/test/api/api_test_base.rb +2 -1
- data/test/api/test_catalog_api.rb +59 -0
- data/test/api/test_employees_api.rb +36 -0
- data/test/api/test_locations_api.rb +35 -0
- data/test/api/test_payments_api.rb +42 -0
- data/test/api/test_refunds_api.rb +41 -0
- metadata +19 -11
@@ -1,67 +1,67 @@
|
|
1
|
-
# square
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
module Square
|
7
|
-
# V1LocationsApi
|
8
|
-
class V1LocationsApi < BaseApi
|
9
|
-
def initialize(config, http_call_back: nil)
|
10
|
-
super(config, http_call_back: http_call_back)
|
11
|
-
end
|
12
|
-
|
13
|
-
# Get a business's information.
|
14
|
-
# @return [V1Merchant Hash] response from the API call
|
15
|
-
def retrieve_business
|
16
|
-
# Prepare query url.
|
17
|
-
_query_builder = config.get_base_uri
|
18
|
-
_query_builder << '/v1/me'
|
19
|
-
_query_url = APIHelper.clean_url _query_builder
|
20
|
-
|
21
|
-
# Prepare headers.
|
22
|
-
_headers = {
|
23
|
-
'accept' => 'application/json'
|
24
|
-
}
|
25
|
-
|
26
|
-
# Prepare and execute HttpRequest.
|
27
|
-
_request = config.http_client.get(
|
28
|
-
_query_url,
|
29
|
-
headers: _headers
|
30
|
-
)
|
31
|
-
OAuth2.apply(config, _request)
|
32
|
-
_response = execute_request(_request)
|
33
|
-
|
34
|
-
# Return appropriate response type.
|
35
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
36
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
37
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Provides details for a business's locations, including their IDs.
|
41
|
-
# @return [List of V1Merchant Hash] response from the API call
|
42
|
-
def list_locations
|
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(_response, data: decoded, errors: _errors)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Square
|
7
|
+
# V1LocationsApi
|
8
|
+
class V1LocationsApi < BaseApi
|
9
|
+
def initialize(config, http_call_back: nil)
|
10
|
+
super(config, http_call_back: http_call_back)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Get a business's information.
|
14
|
+
# @return [V1Merchant Hash] response from the API call
|
15
|
+
def retrieve_business
|
16
|
+
# Prepare query url.
|
17
|
+
_query_builder = config.get_base_uri
|
18
|
+
_query_builder << '/v1/me'
|
19
|
+
_query_url = APIHelper.clean_url _query_builder
|
20
|
+
|
21
|
+
# Prepare headers.
|
22
|
+
_headers = {
|
23
|
+
'accept' => 'application/json'
|
24
|
+
}
|
25
|
+
|
26
|
+
# Prepare and execute HttpRequest.
|
27
|
+
_request = config.http_client.get(
|
28
|
+
_query_url,
|
29
|
+
headers: _headers
|
30
|
+
)
|
31
|
+
OAuth2.apply(config, _request)
|
32
|
+
_response = execute_request(_request)
|
33
|
+
|
34
|
+
# Return appropriate response type.
|
35
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
36
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
37
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Provides details for a business's locations, including their IDs.
|
41
|
+
# @return [List of V1Merchant Hash] response from the API call
|
42
|
+
def list_locations
|
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(_response, data: decoded, errors: _errors)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Square
|
7
|
+
# V1LocationsApi
|
8
|
+
class V1LocationsApi < BaseApi
|
9
|
+
def initialize(config, http_call_back: nil)
|
10
|
+
super(config, http_call_back: http_call_back)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Get a business's information.
|
14
|
+
# @return [V1Merchant Hash] response from the API call
|
15
|
+
def retrieve_business
|
16
|
+
# Prepare query url.
|
17
|
+
_query_builder = config.get_base_uri
|
18
|
+
_query_builder << '/v1/me'
|
19
|
+
_query_url = APIHelper.clean_url _query_builder
|
20
|
+
|
21
|
+
# Prepare headers.
|
22
|
+
_headers = {
|
23
|
+
'accept' => 'application/json'
|
24
|
+
}
|
25
|
+
|
26
|
+
# Prepare and execute HttpRequest.
|
27
|
+
_request = config.http_client.get(
|
28
|
+
_query_url,
|
29
|
+
headers: _headers
|
30
|
+
)
|
31
|
+
OAuth2.apply(config, _request)
|
32
|
+
_response = execute_request(_request)
|
33
|
+
|
34
|
+
# Return appropriate response type.
|
35
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
36
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
37
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Provides details for a business's locations, including their IDs.
|
41
|
+
# @return [List of V1Merchant Hash] response from the API call
|
42
|
+
def list_locations
|
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(_response, data: decoded, errors: _errors)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|