apimatic_core 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/apimatic-core/authentication/multiple/or_auth_group.rb +4 -5
- data/lib/apimatic-core/authentication/multiple/single_auth.rb +3 -6
- data/lib/apimatic-core/exceptions/{invalid_auth_credential.rb → auth_validation_exception.rb} +1 -1
- data/lib/apimatic-core/request_builder.rb +9 -9
- data/lib/apimatic-core/types/union_types/leaf_type.rb +2 -2
- data/lib/apimatic-core/utilities/date_time_helper.rb +1 -1
- data/lib/apimatic_core.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a61392d70a018d23e1947a9886c574b0cd341e04d99ee7e1ad18b1c10f3ef22e
|
4
|
+
data.tar.gz: 9b8f29acf6e4d9703912d9b9d1a5acf774625b26d6a36dc3c693518d2f02e274
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00d16ad4522a07c009dbec86a53fb7310a2c2bc339a9403fd091da9f6ce7f43feace0dfb0e377ed9a9fc29ef144dc1b0e0a6df864fd431c2d82192c21bd8dec6
|
7
|
+
data.tar.gz: 6a2bee74082d6db01b028ee6a4265e7534c29b68848b847964a27277bfe3f7121f5478d694375a3ccfa47c7ad0e7c72dca317a23568df1606198aed68543733a
|
data/README.md
CHANGED
@@ -50,11 +50,11 @@ gem 'apimatic_core'
|
|
50
50
|
|
51
51
|
|
52
52
|
## Exceptions
|
53
|
-
| Name | Description
|
54
|
-
|
55
|
-
| [`OneOfValidationException`](lib/apimatic-core/exceptions/one_of_validation_exception.rb) |
|
56
|
-
| [`AnyOfValidationException`](lib/apimatic-core/exceptions/any_of_validation_exception.rb) |
|
57
|
-
|
53
|
+
| Name | Description |
|
54
|
+
|-------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
|
55
|
+
| [`OneOfValidationException`](lib/apimatic-core/exceptions/one_of_validation_exception.rb) | An exception class for the failed validation of oneOf (union-type) cases |
|
56
|
+
| [`AnyOfValidationException`](lib/apimatic-core/exceptions/any_of_validation_exception.rb) | An exception class for the failed validation of anyOf (union-type) cases |
|
57
|
+
| [`AuthValidationException`](lib/apimatic-core/exceptions/auth_validation_exception.rb) | An exception class for the failed validation of authentication schemes |
|
58
58
|
|
59
59
|
## Factories
|
60
60
|
| Name | Description |
|
@@ -18,11 +18,10 @@ module CoreLibrary
|
|
18
18
|
# @return [Boolean] True if the associated auth is valid, false otherwise.
|
19
19
|
def valid
|
20
20
|
@mapped_group.each do |participant|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
21
|
+
@is_valid_group = participant.valid
|
22
|
+
return true if @is_valid_group
|
23
|
+
|
24
|
+
@error_messages.append(participant.error_message)
|
26
25
|
end
|
27
26
|
|
28
27
|
@is_valid_group
|
@@ -13,7 +13,7 @@ module CoreLibrary
|
|
13
13
|
@auth_participant = auth_participant
|
14
14
|
@mapped_auth = nil
|
15
15
|
@error_message = nil
|
16
|
-
@is_valid =
|
16
|
+
@is_valid = false
|
17
17
|
end
|
18
18
|
|
19
19
|
# Extracts out the auth from the given auth managers.
|
@@ -31,11 +31,8 @@ module CoreLibrary
|
|
31
31
|
def valid
|
32
32
|
raise ArgumentError, 'The auth manager entry must not have a nil value.' if @mapped_auth.nil?
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
@is_valid = false
|
37
|
-
end
|
38
|
-
|
34
|
+
@is_valid = @mapped_auth.valid
|
35
|
+
@error_message = @mapped_auth.error_message unless @is_valid
|
39
36
|
@is_valid
|
40
37
|
end
|
41
38
|
|
@@ -207,8 +207,8 @@ module CoreLibrary
|
|
207
207
|
# @param [String] url The URL of the endpoint.
|
208
208
|
# @return [String] The URL with resolved query parameters if any.
|
209
209
|
def get_updated_url_with_query_params(url)
|
210
|
-
_has_additional_query_params =
|
211
|
-
_has_query_params =
|
210
|
+
_has_additional_query_params = !@additional_query_params.nil? and @additional_query_params.any?
|
211
|
+
_has_query_params = !@query_params.nil? and @query_params.any?
|
212
212
|
_query_params = @query_params
|
213
213
|
_query_params.merge!(@additional_query_params) if _has_additional_query_params
|
214
214
|
|
@@ -229,9 +229,9 @@ module CoreLibrary
|
|
229
229
|
_global_headers = global_configuration.get_global_headers
|
230
230
|
_additional_headers = global_configuration.get_additional_headers
|
231
231
|
|
232
|
-
_has_global_headers =
|
233
|
-
_has_additional_headers =
|
234
|
-
_has_local_headers =
|
232
|
+
_has_global_headers = !_global_headers.nil? && _global_headers.any?
|
233
|
+
_has_additional_headers = !_additional_headers.nil? && _additional_headers.any?
|
234
|
+
_has_local_headers = !@header_params.nil? and @header_params.any?
|
235
235
|
|
236
236
|
if _has_global_headers || _has_additional_headers || _has_local_headers
|
237
237
|
@endpoint_logger.info("Preparing headers for #{@endpoint_name_for_logging}.")
|
@@ -251,9 +251,9 @@ module CoreLibrary
|
|
251
251
|
# Processes the body parameter of the request (including form param, json body or xml body).
|
252
252
|
# @return [Object] The body param to be sent in the request.
|
253
253
|
def process_body
|
254
|
-
_has_form_params =
|
255
|
-
_has_additional_form_params =
|
256
|
-
_has_multipart_param =
|
254
|
+
_has_form_params = !@form_params.nil? && @form_params.any?
|
255
|
+
_has_additional_form_params = !@additional_form_params.nil? && @additional_form_params.any?
|
256
|
+
_has_multipart_param = !@multipart_params.nil? && @multipart_params.any?
|
257
257
|
_has_body_param = !@body_param.nil?
|
258
258
|
_has_body_serializer = !@body_serializer.nil?
|
259
259
|
_has_xml_attributes = !@xml_attributes.nil?
|
@@ -329,7 +329,7 @@ module CoreLibrary
|
|
329
329
|
def apply_auth(auth_managers, http_request)
|
330
330
|
is_valid_auth = @auth.with_auth_managers(auth_managers).valid unless @auth.nil?
|
331
331
|
@auth.apply(http_request) if is_valid_auth
|
332
|
-
raise
|
332
|
+
raise AuthValidationException, @auth.error_message if !@auth.nil? && !is_valid_auth
|
333
333
|
end
|
334
334
|
end
|
335
335
|
end
|
@@ -61,7 +61,7 @@ module CoreLibrary
|
|
61
61
|
def validate_dict_case(dict_value)
|
62
62
|
return false unless dict_value.instance_of?(Hash)
|
63
63
|
|
64
|
-
dict_value.
|
64
|
+
dict_value.each_value do |value|
|
65
65
|
is_valid = validate_simple_case(value)
|
66
66
|
return false unless is_valid
|
67
67
|
end
|
@@ -72,7 +72,7 @@ module CoreLibrary
|
|
72
72
|
def validate_dict_of_array_case(dict_value)
|
73
73
|
return false unless dict_value.instance_of?(Hash)
|
74
74
|
|
75
|
-
dict_value.
|
75
|
+
dict_value.each_value do |value|
|
76
76
|
is_valid = validate_array_case(value)
|
77
77
|
return false unless is_valid
|
78
78
|
end
|
@@ -116,7 +116,7 @@ module CoreLibrary
|
|
116
116
|
# @return [DateTime] A DateTime object.
|
117
117
|
def self.from_rfc3339(date_time)
|
118
118
|
# missing timezone information
|
119
|
-
if date_time.
|
119
|
+
if date_time.match?(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[-+]\d{2}:\d{2})\z$/)
|
120
120
|
DateTime.rfc3339(date_time)
|
121
121
|
else
|
122
122
|
DateTime.rfc3339("#{date_time}Z")
|
data/lib/apimatic_core.rb
CHANGED
@@ -13,7 +13,7 @@ require_relative 'apimatic-core/factories/http_response_factory'
|
|
13
13
|
|
14
14
|
require_relative 'apimatic-core/configurations/global_configuration'
|
15
15
|
|
16
|
-
require_relative 'apimatic-core/exceptions/
|
16
|
+
require_relative 'apimatic-core/exceptions/auth_validation_exception'
|
17
17
|
require_relative 'apimatic-core/exceptions/any_of_validation_exception'
|
18
18
|
require_relative 'apimatic-core/exceptions/one_of_validation_exception'
|
19
19
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apimatic_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- APIMatic Ltd.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apimatic_core_interfaces
|
@@ -180,7 +180,7 @@ files:
|
|
180
180
|
- lib/apimatic-core/authentication/query_auth.rb
|
181
181
|
- lib/apimatic-core/configurations/global_configuration.rb
|
182
182
|
- lib/apimatic-core/exceptions/any_of_validation_exception.rb
|
183
|
-
- lib/apimatic-core/exceptions/
|
183
|
+
- lib/apimatic-core/exceptions/auth_validation_exception.rb
|
184
184
|
- lib/apimatic-core/exceptions/one_of_validation_exception.rb
|
185
185
|
- lib/apimatic-core/factories/http_response_factory.rb
|
186
186
|
- lib/apimatic-core/http/configurations/http_client_configuration.rb
|