apimatic_core 0.3.0 → 0.3.2
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 +10 -11
- data/lib/apimatic-core/types/union_types/leaf_type.rb +2 -2
- 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: 5bb8b07b1daea4ded5f7f3cd7552c5e9b7f47b5d88466d46ca2c166606f9b73e
|
4
|
+
data.tar.gz: 8eeb04841951ded1916d37588aca7a36254079653a1db626787e5ee958ccf338
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8157cd92fc94067895362179be7d61a594e256a46bc53a6937eaa138d74d673ce2911a3411730b628e01484932363ec2750219556e12cc1f461a78e7e76dc624
|
7
|
+
data.tar.gz: b81485a1ef18c8be37c339530ce0ab317212226c89841aa53c94d82256dbac4cf2cef401b3ee28c5be7b9062597776cb5782be8ec5f9fdd57f4bd69f8425ea96
|
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?
|
@@ -271,7 +271,6 @@ module CoreLibrary
|
|
271
271
|
_form_params.merge!(@form_params) if _has_form_params
|
272
272
|
_form_params.merge!(@multipart_params) if _has_multipart_param
|
273
273
|
_form_params.merge!(@additional_form_params) if _has_additional_form_params
|
274
|
-
# TODO: add Array serialization format support while writing the POC
|
275
274
|
return ApiHelper.form_encode_parameters(_form_params, @array_serialization_format)
|
276
275
|
elsif _has_body_param && _has_body_serializer
|
277
276
|
return @body_serializer.call(resolve_body_param)
|
@@ -279,7 +278,7 @@ module CoreLibrary
|
|
279
278
|
return resolve_body_param
|
280
279
|
end
|
281
280
|
|
282
|
-
|
281
|
+
nil
|
283
282
|
end
|
284
283
|
|
285
284
|
# Processes the part of a multipart request and assign appropriate part value and its content-type.
|
@@ -330,7 +329,7 @@ module CoreLibrary
|
|
330
329
|
def apply_auth(auth_managers, http_request)
|
331
330
|
is_valid_auth = @auth.with_auth_managers(auth_managers).valid unless @auth.nil?
|
332
331
|
@auth.apply(http_request) if is_valid_auth
|
333
|
-
raise
|
332
|
+
raise AuthValidationException, @auth.error_message if !@auth.nil? && !is_valid_auth
|
334
333
|
end
|
335
334
|
end
|
336
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
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- APIMatic Ltd.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-28 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
|