microsoft_kiota_abstractions 0.23.0 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/lib/microsoft_kiota_abstractions/api_error.rb +9 -0
- data/lib/microsoft_kiota_abstractions/authentication/allowed_hosts_validator.rb +8 -4
- data/lib/microsoft_kiota_abstractions/request_information.rb +18 -1
- data/lib/microsoft_kiota_abstractions/serialization/parse_node_helper.rb +9 -1
- data/lib/microsoft_kiota_abstractions/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1aa2e08176306a273c14cf184dbdb9067a5d9ec76159da97fe2edb2f55d7422e
|
|
4
|
+
data.tar.gz: f9ee50ea82f77d315e57cc843edb368ce616b4c26a0341b68430302d2c4f909a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 660a942a75900da8b91320cf79fc5c26057309d4129ea34bd3359e2f6bccd0fc37d0b76a80cc01f5d89342679ce338bd883391859008548a3b83d62124fa5f31
|
|
7
|
+
data.tar.gz: 873d46c83bb047007c30d801e69629f5bc2c60b33e5df063d89446b6b5163642febece72decaa88b147d5814ecb61f655417e8eeae364ac3bad6df647f247da8
|
data/Gemfile
CHANGED
|
@@ -5,6 +5,15 @@ module MicrosoftKiotaAbstractions
|
|
|
5
5
|
class ApiError < StandardError
|
|
6
6
|
include MicrosoftKiotaAbstractions::Parsable
|
|
7
7
|
|
|
8
|
+
# the status code and headers of the response the error was raised for
|
|
9
|
+
attr_accessor :response_status_code, :response_headers
|
|
10
|
+
|
|
11
|
+
def initialize(message = nil, response_status_code: nil, response_headers: nil)
|
|
12
|
+
super(message)
|
|
13
|
+
@response_status_code = response_status_code
|
|
14
|
+
@response_headers = response_headers
|
|
15
|
+
end
|
|
16
|
+
|
|
8
17
|
##
|
|
9
18
|
## The deserialization information for the current model
|
|
10
19
|
## @return a i_dictionary
|
|
@@ -8,14 +8,18 @@ module MicrosoftKiotaAbstractions
|
|
|
8
8
|
class AllowedHostsValidator
|
|
9
9
|
# creates a new AllocatedHostsValidator with provided values
|
|
10
10
|
def initialize(allowed_hosts)
|
|
11
|
-
|
|
12
|
-
allowed_hosts.each { |host| @allowed_hosts[host.downcase] = true }
|
|
11
|
+
self.allowed_hosts = allowed_hosts
|
|
13
12
|
end
|
|
14
13
|
|
|
15
14
|
# sets the list of valid hosts with provided value (val)
|
|
16
15
|
def allowed_hosts=(val)
|
|
17
|
-
|
|
18
|
-
val.each
|
|
16
|
+
hosts = {}
|
|
17
|
+
val.each do |host|
|
|
18
|
+
raise ArgumentError, "host should not contain http or https prefix: #{host}" if host.match?(%r{\Ahttps?://}i)
|
|
19
|
+
|
|
20
|
+
hosts[host.downcase] = true
|
|
21
|
+
end
|
|
22
|
+
@allowed_hosts = hosts
|
|
19
23
|
end
|
|
20
24
|
|
|
21
25
|
# checks whether the provided host is valid
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'date'
|
|
4
|
+
require 'time'
|
|
3
5
|
require 'uri'
|
|
4
6
|
require 'stduritemplate'
|
|
5
7
|
require_relative 'http_method'
|
|
@@ -32,7 +34,8 @@ module MicrosoftKiotaAbstractions
|
|
|
32
34
|
return @uri unless @uri.nil?
|
|
33
35
|
|
|
34
36
|
if path_parameters[@@raw_url_key].nil?
|
|
35
|
-
|
|
37
|
+
values = path_parameters.merge(query_parameters).transform_values { |v| template_value(v) }
|
|
38
|
+
return URI(StdUriTemplate.expand(@url_template, values))
|
|
36
39
|
end
|
|
37
40
|
|
|
38
41
|
self.uri = path_parameters[@@raw_url_key]
|
|
@@ -144,5 +147,19 @@ module MicrosoftKiotaAbstractions
|
|
|
144
147
|
query_parameters[key] = value unless value.nil?
|
|
145
148
|
end
|
|
146
149
|
end
|
|
150
|
+
|
|
151
|
+
private
|
|
152
|
+
|
|
153
|
+
# the template engine only takes strings, numbers, booleans and lists of them
|
|
154
|
+
def template_value(value)
|
|
155
|
+
case value
|
|
156
|
+
when nil, String, Integer, Float, true, false then value
|
|
157
|
+
when Array then value.map { |v| template_value(v) }
|
|
158
|
+
when Hash then value.transform_values { |v| template_value(v) }
|
|
159
|
+
when Date, Time then value.iso8601
|
|
160
|
+
when MicrosoftKiotaAbstractions::ISODuration then value.string
|
|
161
|
+
else value.to_s
|
|
162
|
+
end
|
|
163
|
+
end
|
|
147
164
|
end
|
|
148
165
|
end
|
|
@@ -5,7 +5,15 @@ module MicrosoftKiotaAbstractions
|
|
|
5
5
|
def self.merge_deserializers_for_intersection_wrapper(*targets)
|
|
6
6
|
result = {}
|
|
7
7
|
targets.each do |target|
|
|
8
|
-
|
|
8
|
+
next if target.nil?
|
|
9
|
+
|
|
10
|
+
# a field that several targets declare belongs to each of them
|
|
11
|
+
result.merge!(target.get_field_deserializers) do |_, earlier, later|
|
|
12
|
+
lambda do |node|
|
|
13
|
+
earlier.call(node)
|
|
14
|
+
later.call(node)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
9
17
|
end
|
|
10
18
|
result
|
|
11
19
|
end
|