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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89372c942ff5a09ea2b866df3c4e615de4509de80b5491534b9c895d3610bae2
4
- data.tar.gz: 5936d10df4a11331d9aa45f123acc27de6fcbcd2743107f9ce65cc85a3f87724
3
+ metadata.gz: 1aa2e08176306a273c14cf184dbdb9067a5d9ec76159da97fe2edb2f55d7422e
4
+ data.tar.gz: f9ee50ea82f77d315e57cc843edb368ce616b4c26a0341b68430302d2c4f909a
5
5
  SHA512:
6
- metadata.gz: f514b097ffc651dcb6f8128664babe35add9ccfcb61571f84c76df36e9d4745e41d2d8ab1621c55d699515b6a876c7cc0b42633e94d8818d2054c28a009e510f
7
- data.tar.gz: e74d478723efde578c503110689442121e1035b1a047aac057fc618e731f9db4168be5d80ff522b3bc24e4eeeee30e4727bd033cf18b8b92676360ec0639bd3b
6
+ metadata.gz: 660a942a75900da8b91320cf79fc5c26057309d4129ea34bd3359e2f6bccd0fc37d0b76a80cc01f5d89342679ce338bd883391859008548a3b83d62124fa5f31
7
+ data.tar.gz: 873d46c83bb047007c30d801e69629f5bc2c60b33e5df063d89446b6b5163642febece72decaa88b147d5814ecb61f655417e8eeae364ac3bad6df647f247da8
data/Gemfile CHANGED
@@ -2,5 +2,7 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
+ ruby '>= 3.3.0'
6
+
5
7
  # Specify your gem's dependencies in microsoft_kiota_abstractions.gemspec
6
8
  gemspec
@@ -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
- @allowed_hosts = {}
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
- @allowed_hosts = {}
18
- val.each { |host| @allowed_hosts[host.downcase] = true }
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
- return URI(StdUriTemplate.expand(@url_template, path_parameters.merge(query_parameters)))
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
- result.merge!(target.get_field_deserializers) unless target.nil?
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MicrosoftKiotaAbstractions
4
- VERSION = '0.23.0' # x-release-please-version
4
+ VERSION = '0.24.1' # x-release-please-version
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microsoft_kiota_abstractions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.24.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation