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,54 +1,54 @@
|
|
1
|
-
# square
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
module Square
|
7
|
-
# CheckoutApi
|
8
|
-
class CheckoutApi < BaseApi
|
9
|
-
def initialize(config, http_call_back: nil)
|
10
|
-
super(config, http_call_back: http_call_back)
|
11
|
-
end
|
12
|
-
|
13
|
-
# Links a `checkoutId` to a `checkout_page_url` that customers will
|
14
|
-
# be directed to in order to provide their payment information using a
|
15
|
-
# payment processing workflow hosted on connect.squareup.com.
|
16
|
-
# @param [String] location_id Required parameter: The ID of the business
|
17
|
-
# location to associate the checkout with.
|
18
|
-
# @param [CreateCheckoutRequest] body Required parameter: An object
|
19
|
-
# containing the fields to POST for the request. See the corresponding
|
20
|
-
# object definition for field details.
|
21
|
-
# @return [CreateCheckoutResponse Hash] response from the API call
|
22
|
-
def create_checkout(location_id:,
|
23
|
-
body:)
|
24
|
-
# Prepare query url.
|
25
|
-
_query_builder = config.get_base_uri
|
26
|
-
_query_builder << '/v2/locations/{location_id}/checkouts'
|
27
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
28
|
-
_query_builder,
|
29
|
-
'location_id' => location_id
|
30
|
-
)
|
31
|
-
_query_url = APIHelper.clean_url _query_builder
|
32
|
-
|
33
|
-
# Prepare headers.
|
34
|
-
_headers = {
|
35
|
-
'accept' => 'application/json',
|
36
|
-
'content-type' => 'application/json; charset=utf-8'
|
37
|
-
}
|
38
|
-
|
39
|
-
# Prepare and execute HttpRequest.
|
40
|
-
_request = config.http_client.post(
|
41
|
-
_query_url,
|
42
|
-
headers: _headers,
|
43
|
-
parameters: body.to_json
|
44
|
-
)
|
45
|
-
OAuth2.apply(config, _request)
|
46
|
-
_response = execute_request(_request)
|
47
|
-
|
48
|
-
# Return appropriate response type.
|
49
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
50
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
51
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Square
|
7
|
+
# CheckoutApi
|
8
|
+
class CheckoutApi < BaseApi
|
9
|
+
def initialize(config, http_call_back: nil)
|
10
|
+
super(config, http_call_back: http_call_back)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Links a `checkoutId` to a `checkout_page_url` that customers will
|
14
|
+
# be directed to in order to provide their payment information using a
|
15
|
+
# payment processing workflow hosted on connect.squareup.com.
|
16
|
+
# @param [String] location_id Required parameter: The ID of the business
|
17
|
+
# location to associate the checkout with.
|
18
|
+
# @param [CreateCheckoutRequest] body Required parameter: An object
|
19
|
+
# containing the fields to POST for the request. See the corresponding
|
20
|
+
# object definition for field details.
|
21
|
+
# @return [CreateCheckoutResponse Hash] response from the API call
|
22
|
+
def create_checkout(location_id:,
|
23
|
+
body:)
|
24
|
+
# Prepare query url.
|
25
|
+
_query_builder = config.get_base_uri
|
26
|
+
_query_builder << '/v2/locations/{location_id}/checkouts'
|
27
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
28
|
+
_query_builder,
|
29
|
+
'location_id' => location_id
|
30
|
+
)
|
31
|
+
_query_url = APIHelper.clean_url _query_builder
|
32
|
+
|
33
|
+
# Prepare headers.
|
34
|
+
_headers = {
|
35
|
+
'accept' => 'application/json',
|
36
|
+
'content-type' => 'application/json; charset=utf-8'
|
37
|
+
}
|
38
|
+
|
39
|
+
# Prepare and execute HttpRequest.
|
40
|
+
_request = config.http_client.post(
|
41
|
+
_query_url,
|
42
|
+
headers: _headers,
|
43
|
+
parameters: body.to_json
|
44
|
+
)
|
45
|
+
OAuth2.apply(config, _request)
|
46
|
+
_response = execute_request(_request)
|
47
|
+
|
48
|
+
# Return appropriate response type.
|
49
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
50
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
51
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|