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,55 @@
|
|
1
|
-
# square
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
module Square
|
7
|
-
# ApplePayApi
|
8
|
-
class ApplePayApi < BaseApi
|
9
|
-
def initialize(config, http_call_back: nil)
|
10
|
-
super(config, http_call_back: http_call_back)
|
11
|
-
end
|
12
|
-
|
13
|
-
# Activates a domain for use with Web Apple Pay and Square. A validation
|
14
|
-
# will be performed on this domain by Apple to ensure is it properly set up
|
15
|
-
# as
|
16
|
-
# an Apple Pay enabled domain.
|
17
|
-
# This endpoint provides an easy way for platform developers to bulk
|
18
|
-
# activate
|
19
|
-
# Web Apple Pay with Square for merchants using their platform.
|
20
|
-
# To learn more about Apple Pay on Web see the Apple Pay section in the
|
21
|
-
# [Embedding the Square Payment
|
22
|
-
# Form](/payment-form/add-digital-wallets
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
_query_builder
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
'
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Square
|
7
|
+
# ApplePayApi
|
8
|
+
class ApplePayApi < BaseApi
|
9
|
+
def initialize(config, http_call_back: nil)
|
10
|
+
super(config, http_call_back: http_call_back)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Activates a domain for use with Web Apple Pay and Square. A validation
|
14
|
+
# will be performed on this domain by Apple to ensure is it properly set up
|
15
|
+
# as
|
16
|
+
# an Apple Pay enabled domain.
|
17
|
+
# This endpoint provides an easy way for platform developers to bulk
|
18
|
+
# activate
|
19
|
+
# Web Apple Pay with Square for merchants using their platform.
|
20
|
+
# To learn more about Apple Pay on Web see the Apple Pay section in the
|
21
|
+
# [Embedding the Square Payment
|
22
|
+
# Form](https://developer.squareup.com/docs/payment-form/add-digital-wallets
|
23
|
+
# /apple-pay) guide.
|
24
|
+
# @param [RegisterDomainRequest] body Required parameter: An object
|
25
|
+
# containing the fields to POST for the request. See the corresponding
|
26
|
+
# object definition for field details.
|
27
|
+
# @return [RegisterDomainResponse Hash] response from the API call
|
28
|
+
def register_domain(body:)
|
29
|
+
# Prepare query url.
|
30
|
+
_query_builder = config.get_base_uri
|
31
|
+
_query_builder << '/v2/apple-pay/domains'
|
32
|
+
_query_url = APIHelper.clean_url _query_builder
|
33
|
+
|
34
|
+
# Prepare headers.
|
35
|
+
_headers = {
|
36
|
+
'accept' => 'application/json',
|
37
|
+
'content-type' => 'application/json; charset=utf-8'
|
38
|
+
}
|
39
|
+
|
40
|
+
# Prepare and execute HttpRequest.
|
41
|
+
_request = config.http_client.post(
|
42
|
+
_query_url,
|
43
|
+
headers: _headers,
|
44
|
+
parameters: body.to_json
|
45
|
+
)
|
46
|
+
OAuth2.apply(config, _request)
|
47
|
+
_response = execute_request(_request)
|
48
|
+
|
49
|
+
# Return appropriate response type.
|
50
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
51
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
52
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/square/api/base_api.rb
CHANGED
@@ -1,45 +1,45 @@
|
|
1
|
-
# square
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
module Square
|
7
|
-
# BaseApi.
|
8
|
-
class BaseApi
|
9
|
-
attr_accessor :config, :http_call_back
|
10
|
-
|
11
|
-
def initialize(config, http_call_back: nil)
|
12
|
-
@config = config
|
13
|
-
@http_call_back = http_call_back
|
14
|
-
|
15
|
-
@global_headers = {
|
16
|
-
'user-agent' => 'Square-Connect-Ruby-
|
17
|
-
'Square-Version' => '2019-
|
18
|
-
}
|
19
|
-
end
|
20
|
-
|
21
|
-
def validate_parameters(args)
|
22
|
-
args.each do |_name, value|
|
23
|
-
if value.nil?
|
24
|
-
raise ArgumentError, "Required parameter #{_name} cannot be nil."
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def execute_request(request, binary: false)
|
30
|
-
@http_call_back.on_before_request(request) if @http_call_back
|
31
|
-
|
32
|
-
APIHelper.clean_hash(request.headers)
|
33
|
-
request.headers = @global_headers.clone.merge(request.headers)
|
34
|
-
|
35
|
-
response = if binary
|
36
|
-
config.http_client.execute_as_binary(request)
|
37
|
-
else
|
38
|
-
config.http_client.execute_as_string(request)
|
39
|
-
end
|
40
|
-
@http_call_back.on_after_response(response) if @http_call_back
|
41
|
-
|
42
|
-
response
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Square
|
7
|
+
# BaseApi.
|
8
|
+
class BaseApi
|
9
|
+
attr_accessor :config, :http_call_back
|
10
|
+
|
11
|
+
def initialize(config, http_call_back: nil)
|
12
|
+
@config = config
|
13
|
+
@http_call_back = http_call_back
|
14
|
+
|
15
|
+
@global_headers = {
|
16
|
+
'user-agent' => 'Square-Connect-Ruby-3.20190814.0',
|
17
|
+
'Square-Version' => '2019-08-14'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def validate_parameters(args)
|
22
|
+
args.each do |_name, value|
|
23
|
+
if value.nil?
|
24
|
+
raise ArgumentError, "Required parameter #{_name} cannot be nil."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def execute_request(request, binary: false)
|
30
|
+
@http_call_back.on_before_request(request) if @http_call_back
|
31
|
+
|
32
|
+
APIHelper.clean_hash(request.headers)
|
33
|
+
request.headers = @global_headers.clone.merge(request.headers)
|
34
|
+
|
35
|
+
response = if binary
|
36
|
+
config.http_client.execute_as_binary(request)
|
37
|
+
else
|
38
|
+
config.http_client.execute_as_string(request)
|
39
|
+
end
|
40
|
+
@http_call_back.on_after_response(response) if @http_call_back
|
41
|
+
|
42
|
+
response
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|