microsoft_kiota_abstractions 0.12.0
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 +7 -0
 - data/.github/CODEOWNERS +1 -0
 - data/.github/dependabot.yml +12 -0
 - data/.github/workflows/code-ql.yml +76 -0
 - data/.github/workflows/conflicting-pr-label.yml +34 -0
 - data/.github/workflows/projectsbot.yml +81 -0
 - data/.github/workflows/release.yml +45 -0
 - data/.github/workflows/ruby.yml +34 -0
 - data/.gitignore +58 -0
 - data/CHANGELOG.md +18 -0
 - data/CODE_OF_CONDUCT.md +9 -0
 - data/Gemfile +6 -0
 - data/LICENSE +21 -0
 - data/README.md +51 -0
 - data/Rakefile +8 -0
 - data/SECURITY.md +41 -0
 - data/SUPPORT.md +25 -0
 - data/lib/microsoft_kiota_abstractions/api_client_builder.rb +19 -0
 - data/lib/microsoft_kiota_abstractions/api_error.rb +23 -0
 - data/lib/microsoft_kiota_abstractions/authentication/access_token_provider.rb +20 -0
 - data/lib/microsoft_kiota_abstractions/authentication/allowed_hosts_validator.rb +39 -0
 - data/lib/microsoft_kiota_abstractions/authentication/anonymous_authentication_provider.rb +7 -0
 - data/lib/microsoft_kiota_abstractions/authentication/authentication_provider.rb +7 -0
 - data/lib/microsoft_kiota_abstractions/authentication/base_bearer_token_authentication_provider.rb +26 -0
 - data/lib/microsoft_kiota_abstractions/http_method.rb +17 -0
 - data/lib/microsoft_kiota_abstractions/request_adapter.rb +25 -0
 - data/lib/microsoft_kiota_abstractions/request_headers.rb +44 -0
 - data/lib/microsoft_kiota_abstractions/request_information.rb +130 -0
 - data/lib/microsoft_kiota_abstractions/request_option.rb +7 -0
 - data/lib/microsoft_kiota_abstractions/serialization/additional_data_holder.rb +7 -0
 - data/lib/microsoft_kiota_abstractions/serialization/iso_duration.rb +209 -0
 - data/lib/microsoft_kiota_abstractions/serialization/parsable.rb +11 -0
 - data/lib/microsoft_kiota_abstractions/serialization/parse_node.rb +61 -0
 - data/lib/microsoft_kiota_abstractions/serialization/parse_node_factory.rb +7 -0
 - data/lib/microsoft_kiota_abstractions/serialization/parse_node_factory_registry.rb +42 -0
 - data/lib/microsoft_kiota_abstractions/serialization/serialization_writer.rb +69 -0
 - data/lib/microsoft_kiota_abstractions/serialization/serialization_writer_factory.rb +9 -0
 - data/lib/microsoft_kiota_abstractions/serialization/serialization_writer_factory_registry.rb +40 -0
 - data/lib/microsoft_kiota_abstractions/version.rb +5 -0
 - data/lib/microsoft_kiota_abstractions.rb +25 -0
 - data/microsoft_kiota_abstractions.gemspec +36 -0
 - metadata +165 -0
 
    
        data/lib/microsoft_kiota_abstractions/authentication/base_bearer_token_authentication_provider.rb
    ADDED
    
    | 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative './authentication_provider'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require_relative './access_token_provider'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module MicrosoftKiotaAbstractions
         
     | 
| 
      
 7 
     | 
    
         
            +
              # Provides a base class for implementing AuthenticationProvider for Bearer token scheme
         
     | 
| 
      
 8 
     | 
    
         
            +
              class BaseBearerTokenAuthenticationProvider
         
     | 
| 
      
 9 
     | 
    
         
            +
                include MicrosoftKiotaAbstractions::AuthenticationProvider
         
     | 
| 
      
 10 
     | 
    
         
            +
                def initialize(access_token_provider)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  raise StandardError, 'access_token_provider parameter cannot be nil' if access_token_provider.nil?
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  @access_token_provider = access_token_provider
         
     | 
| 
      
 14 
     | 
    
         
            +
                end 
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                AUTHORIZATION_HEADER_KEY = 'Authorization'
         
     | 
| 
      
 17 
     | 
    
         
            +
                def authenticate_request(request, additional_properties = {})
         
     | 
| 
      
 18 
     | 
    
         
            +
                  raise StandardError, 'Request cannot be null' if request.nil?
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  Fiber.new do
         
     | 
| 
      
 21 
     | 
    
         
            +
                    token = @access_token_provider.get_authorization_token(request.uri, additional_properties).resume
         
     | 
| 
      
 22 
     | 
    
         
            +
                    request.headers.add(AUTHORIZATION_HEADER_KEY, "Bearer #{token}") unless token.nil? || token.empty?
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end unless request.headers.get_all.key?(AUTHORIZATION_HEADER_KEY)
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module MicrosoftKiotaAbstractions
         
     | 
| 
      
 2 
     | 
    
         
            +
              module HttpMethod
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                HTTP_METHOD = {
         
     | 
| 
      
 5 
     | 
    
         
            +
                  GET: :GET,
         
     | 
| 
      
 6 
     | 
    
         
            +
                  POST: :POST,
         
     | 
| 
      
 7 
     | 
    
         
            +
                  PATCH: :PATCH,
         
     | 
| 
      
 8 
     | 
    
         
            +
                  DELETE: :DELETE,
         
     | 
| 
      
 9 
     | 
    
         
            +
                  OPTIONS: :OPTIONS,
         
     | 
| 
      
 10 
     | 
    
         
            +
                  CONNECT: :CONNECT,
         
     | 
| 
      
 11 
     | 
    
         
            +
                  PUT: :PUT,
         
     | 
| 
      
 12 
     | 
    
         
            +
                  TRACE: :TRACE,
         
     | 
| 
      
 13 
     | 
    
         
            +
                  HEAD: :HEAD
         
     | 
| 
      
 14 
     | 
    
         
            +
                }
         
     | 
| 
      
 15 
     | 
    
         
            +
                
         
     | 
| 
      
 16 
     | 
    
         
            +
                end 
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'request_information'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module MicrosoftKiotaAbstractions
         
     | 
| 
      
 4 
     | 
    
         
            +
              module RequestAdapter
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                def send_async(request_info, factory, errors_mapping)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                # TODO we're most likley missing something for enums and collections or at least at the implemenation level
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def get_serialization_writer_factory()
         
     | 
| 
      
 13 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                def set_base_url(base_url)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                def get_base_url()
         
     | 
| 
      
 21 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,44 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module MicrosoftKiotaAbstractions
         
     | 
| 
      
 2 
     | 
    
         
            +
                class RequestHeaders
         
     | 
| 
      
 3 
     | 
    
         
            +
                    def initialize()
         
     | 
| 
      
 4 
     | 
    
         
            +
                        @headers = Hash.new
         
     | 
| 
      
 5 
     | 
    
         
            +
                    end
         
     | 
| 
      
 6 
     | 
    
         
            +
                    def add(key, value)
         
     | 
| 
      
 7 
     | 
    
         
            +
                        if key.nil? || key.empty? || value.nil? || value.empty? then
         
     | 
| 
      
 8 
     | 
    
         
            +
                          raise ArgumentError, 'key and value cannot be nil or empty'
         
     | 
| 
      
 9 
     | 
    
         
            +
                        end
         
     | 
| 
      
 10 
     | 
    
         
            +
                        existing_value = @headers[key]
         
     | 
| 
      
 11 
     | 
    
         
            +
                        if existing_value.nil? then
         
     | 
| 
      
 12 
     | 
    
         
            +
                          if value.kind_of?(Array) then
         
     | 
| 
      
 13 
     | 
    
         
            +
                            @headers[key] = value
         
     | 
| 
      
 14 
     | 
    
         
            +
                          else
         
     | 
| 
      
 15 
     | 
    
         
            +
                            @headers[key] = Array[value.to_s]
         
     | 
| 
      
 16 
     | 
    
         
            +
                          end
         
     | 
| 
      
 17 
     | 
    
         
            +
                        else
         
     | 
| 
      
 18 
     | 
    
         
            +
                          if value.kind_of?(Array) then
         
     | 
| 
      
 19 
     | 
    
         
            +
                            @headers[key] = existing_value | value
         
     | 
| 
      
 20 
     | 
    
         
            +
                          else
         
     | 
| 
      
 21 
     | 
    
         
            +
                            existing_value << value.to_s
         
     | 
| 
      
 22 
     | 
    
         
            +
                          end
         
     | 
| 
      
 23 
     | 
    
         
            +
                        end
         
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
                    def get(key)
         
     | 
| 
      
 26 
     | 
    
         
            +
                        if key.nil? || key.empty? then
         
     | 
| 
      
 27 
     | 
    
         
            +
                          raise ArgumentError, 'key cannot be nil or empty'
         
     | 
| 
      
 28 
     | 
    
         
            +
                        end
         
     | 
| 
      
 29 
     | 
    
         
            +
                        return @headers[key]
         
     | 
| 
      
 30 
     | 
    
         
            +
                    end
         
     | 
| 
      
 31 
     | 
    
         
            +
                    def remove(key)
         
     | 
| 
      
 32 
     | 
    
         
            +
                        if key.nil? || key.empty? then
         
     | 
| 
      
 33 
     | 
    
         
            +
                          raise ArgumentError, 'key cannot be nil or empty'
         
     | 
| 
      
 34 
     | 
    
         
            +
                        end
         
     | 
| 
      
 35 
     | 
    
         
            +
                        @headers.delete(key)
         
     | 
| 
      
 36 
     | 
    
         
            +
                    end
         
     | 
| 
      
 37 
     | 
    
         
            +
                    def clear()
         
     | 
| 
      
 38 
     | 
    
         
            +
                        @headers.clear()
         
     | 
| 
      
 39 
     | 
    
         
            +
                    end
         
     | 
| 
      
 40 
     | 
    
         
            +
                    def get_all()
         
     | 
| 
      
 41 
     | 
    
         
            +
                        return @headers
         
     | 
| 
      
 42 
     | 
    
         
            +
                    end
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,130 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'uri'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'addressable/template'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative 'http_method'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require_relative 'request_headers'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module MicrosoftKiotaAbstractions
         
     | 
| 
      
 7 
     | 
    
         
            +
              class RequestInformation
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_reader :content, :http_method, :headers
         
     | 
| 
      
 9 
     | 
    
         
            +
                attr_accessor :url_template, :path_parameters, :query_parameters
         
     | 
| 
      
 10 
     | 
    
         
            +
                @@binary_content_type = 'application/octet-stream'
         
     | 
| 
      
 11 
     | 
    
         
            +
                @@content_type_header = 'Content-Type'
         
     | 
| 
      
 12 
     | 
    
         
            +
                @@raw_url_key = 'request-raw-url'
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                def initialize()
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @headers = RequestHeaders.new
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @query_parameters = Hash.new
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @path_parameters = Hash.new
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
                
         
     | 
| 
      
 20 
     | 
    
         
            +
                def uri=(arg)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  if arg.nil? || arg.empty?
         
     | 
| 
      
 22 
     | 
    
         
            +
                    raise ArgumentError, 'arg cannot be nil or empty'
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
                  self.path_parameters.clear()
         
     | 
| 
      
 25 
     | 
    
         
            +
                  self.query_parameters.clear()
         
     | 
| 
      
 26 
     | 
    
         
            +
                  @uri = URI(arg)
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                def uri
         
     | 
| 
      
 30 
     | 
    
         
            +
                  if @uri != nil
         
     | 
| 
      
 31 
     | 
    
         
            +
                    return @uri
         
     | 
| 
      
 32 
     | 
    
         
            +
                  else
         
     | 
| 
      
 33 
     | 
    
         
            +
                    if self.path_parameters[@@raw_url_key] != nil
         
     | 
| 
      
 34 
     | 
    
         
            +
                      self.uri = self.path_parameters[@@raw_url_key]
         
     | 
| 
      
 35 
     | 
    
         
            +
                      return @uri
         
     | 
| 
      
 36 
     | 
    
         
            +
                    else
         
     | 
| 
      
 37 
     | 
    
         
            +
                      template = Addressable::Template.new(@url_template)
         
     | 
| 
      
 38 
     | 
    
         
            +
                      return URI(template.expand(self.path_parameters.merge(self.query_parameters)).to_s)
         
     | 
| 
      
 39 
     | 
    
         
            +
                    end
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                def add_request_options(request_options_to_add)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  unless request_options_to_add.nil? then
         
     | 
| 
      
 45 
     | 
    
         
            +
                    @request_options ||= Hash.new
         
     | 
| 
      
 46 
     | 
    
         
            +
                    unless request_options_to_add.kind_of?(Array) then
         
     | 
| 
      
 47 
     | 
    
         
            +
                      request_options_to_add = [request_options_to_add]
         
     | 
| 
      
 48 
     | 
    
         
            +
                    end
         
     | 
| 
      
 49 
     | 
    
         
            +
                    request_options_to_add.each do |request_option|
         
     | 
| 
      
 50 
     | 
    
         
            +
                      key = request_option.get_key
         
     | 
| 
      
 51 
     | 
    
         
            +
                      @request_options[key] = request_option
         
     | 
| 
      
 52 
     | 
    
         
            +
                    end
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                def get_request_options()
         
     | 
| 
      
 57 
     | 
    
         
            +
                  if @request_options.nil? then
         
     | 
| 
      
 58 
     | 
    
         
            +
                    return []
         
     | 
| 
      
 59 
     | 
    
         
            +
                  else
         
     | 
| 
      
 60 
     | 
    
         
            +
                    return @request_options.values
         
     | 
| 
      
 61 
     | 
    
         
            +
                  end
         
     | 
| 
      
 62 
     | 
    
         
            +
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                def get_request_option(key)
         
     | 
| 
      
 65 
     | 
    
         
            +
                  if @request_options.nil? || key.nil? || key.empty? then
         
     | 
| 
      
 66 
     | 
    
         
            +
                    return nil
         
     | 
| 
      
 67 
     | 
    
         
            +
                  else
         
     | 
| 
      
 68 
     | 
    
         
            +
                    return @request_options[key]
         
     | 
| 
      
 69 
     | 
    
         
            +
                  end
         
     | 
| 
      
 70 
     | 
    
         
            +
                end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                def remove_request_options(keys)
         
     | 
| 
      
 73 
     | 
    
         
            +
                  unless keys.nil? || @request_options.nil? then
         
     | 
| 
      
 74 
     | 
    
         
            +
                    unless keys.kind_of?(Array) then
         
     | 
| 
      
 75 
     | 
    
         
            +
                      keys = [keys]
         
     | 
| 
      
 76 
     | 
    
         
            +
                    end
         
     | 
| 
      
 77 
     | 
    
         
            +
                    keys.each do |key|
         
     | 
| 
      
 78 
     | 
    
         
            +
                      @request_options.delete(key)
         
     | 
| 
      
 79 
     | 
    
         
            +
                    end
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
                end
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                def http_method=(method)
         
     | 
| 
      
 84 
     | 
    
         
            +
                  @http_method = HttpMethod::HTTP_METHOD[method]
         
     | 
| 
      
 85 
     | 
    
         
            +
                end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                def set_stream_content(value = $stdin)
         
     | 
| 
      
 88 
     | 
    
         
            +
                  @content = value
         
     | 
| 
      
 89 
     | 
    
         
            +
                  @headers.add(@@content_type_header, @@binary_content_type)
         
     | 
| 
      
 90 
     | 
    
         
            +
                end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                def set_content_from_parsable(request_adapter, content_type, values)
         
     | 
| 
      
 93 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 94 
     | 
    
         
            +
                    writer  = request_adapter.get_serialization_writer_factory().get_serialization_writer(content_type)
         
     | 
| 
      
 95 
     | 
    
         
            +
                    @headers.add(@@content_type_header, content_type)
         
     | 
| 
      
 96 
     | 
    
         
            +
                    if values != nil && values.kind_of?(Array)
         
     | 
| 
      
 97 
     | 
    
         
            +
                      writer.write_collection_of_object_values(nil, values)
         
     | 
| 
      
 98 
     | 
    
         
            +
                    else
         
     | 
| 
      
 99 
     | 
    
         
            +
                      writer.write_object_value(nil, values);
         
     | 
| 
      
 100 
     | 
    
         
            +
                    end
         
     | 
| 
      
 101 
     | 
    
         
            +
                    this.content = writer.get_serialized_content();
         
     | 
| 
      
 102 
     | 
    
         
            +
                  rescue => exception
         
     | 
| 
      
 103 
     | 
    
         
            +
                    raise Exception.new "could not serialize payload"
         
     | 
| 
      
 104 
     | 
    
         
            +
                  end
         
     | 
| 
      
 105 
     | 
    
         
            +
                end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                def add_headers_from_raw_object(h)
         
     | 
| 
      
 108 
     | 
    
         
            +
                  h.select{|x,y| @headers.add(x.to_s, y)} unless !h
         
     | 
| 
      
 109 
     | 
    
         
            +
                end
         
     | 
| 
      
 110 
     | 
    
         
            +
                
         
     | 
| 
      
 111 
     | 
    
         
            +
                def set_query_string_parameters_from_raw_object(q)
         
     | 
| 
      
 112 
     | 
    
         
            +
                  if !q || q.is_a?(Hash) || q.is_a?(Array)
         
     | 
| 
      
 113 
     | 
    
         
            +
                    return
         
     | 
| 
      
 114 
     | 
    
         
            +
                  end
         
     | 
| 
      
 115 
     | 
    
         
            +
                  q.class.instance_methods(false).select{|x|
         
     | 
| 
      
 116 
     | 
    
         
            +
                    method_name = x.to_s
         
     | 
| 
      
 117 
     | 
    
         
            +
                    unless method_name == "compare_by_identity" || method_name == "get_query_parameter" || method_name.end_with?("=") || method_name.end_with?("?") || method_name.end_with?("!") then
         
     | 
| 
      
 118 
     | 
    
         
            +
                      begin
         
     | 
| 
      
 119 
     | 
    
         
            +
                        key = q.get_query_parameter(method_name)
         
     | 
| 
      
 120 
     | 
    
         
            +
                      rescue => exception
         
     | 
| 
      
 121 
     | 
    
         
            +
                        key = method_name
         
     | 
| 
      
 122 
     | 
    
         
            +
                      end
         
     | 
| 
      
 123 
     | 
    
         
            +
                      value = eval("q.#{method_name}")
         
     | 
| 
      
 124 
     | 
    
         
            +
                      self.query_parameters[key] = value unless value.nil?
         
     | 
| 
      
 125 
     | 
    
         
            +
                    end
         
     | 
| 
      
 126 
     | 
    
         
            +
                  }
         
     | 
| 
      
 127 
     | 
    
         
            +
                end
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
              end
         
     | 
| 
      
 130 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,209 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'iso8601'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module MicrosoftKiotaAbstractions
         
     | 
| 
      
 5 
     | 
    
         
            +
              # Wrapper Class for ISO8601::Duration
         
     | 
| 
      
 6 
     | 
    
         
            +
              # Integer support for :years, :months, :weeks, :days, :hours, :minutes, :seconds
         
     | 
| 
      
 7 
     | 
    
         
            +
              # Initialize with a hash of symbols to integers eg { :years => 3, :days => 4, seconds: => 2}
         
     | 
| 
      
 8 
     | 
    
         
            +
              # or with an ISO8601 formated string eg "PT3H12M5S".
         
     | 
| 
      
 9 
     | 
    
         
            +
              class ISODuration
         
     | 
| 
      
 10 
     | 
    
         
            +
                attr_reader :years, :months, :weeks, :days, :hours, :minutes, :seconds
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                UNITS = { :years => 'Y', 
         
     | 
| 
      
 13 
     | 
    
         
            +
                          :months => 'M', 
         
     | 
| 
      
 14 
     | 
    
         
            +
                          :weeks => 'W', 
         
     | 
| 
      
 15 
     | 
    
         
            +
                          :days => 'D', 
         
     | 
| 
      
 16 
     | 
    
         
            +
                          :hours => 'H', 
         
     | 
| 
      
 17 
     | 
    
         
            +
                          :minutes => 'M',
         
     | 
| 
      
 18 
     | 
    
         
            +
                          :seconds => 'S'}
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                CONVERSIONS = {
         
     | 
| 
      
 21 
     | 
    
         
            +
                  :ms_to_s => 1000,
         
     | 
| 
      
 22 
     | 
    
         
            +
                  :s_to_m => 60,
         
     | 
| 
      
 23 
     | 
    
         
            +
                  :m_to_h => 60,
         
     | 
| 
      
 24 
     | 
    
         
            +
                  :h_to_d => 24,
         
     | 
| 
      
 25 
     | 
    
         
            +
                  :d_to_w => 7,
         
     | 
| 
      
 26 
     | 
    
         
            +
                  :m_to_y => 12
         
     | 
| 
      
 27 
     | 
    
         
            +
                }
         
     | 
| 
      
 28 
     | 
    
         
            +
                def initialize(input)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  if input.is_a? String
         
     | 
| 
      
 30 
     | 
    
         
            +
                    @duration_obj = ISO8601::Duration.new(input)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  elsif input.is_a? Hash
         
     | 
| 
      
 32 
     | 
    
         
            +
                    @duration_obj = parse_hash(input)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  else
         
     | 
| 
      
 34 
     | 
    
         
            +
                    raise StandardError, 'Must provide initialize ISODuration by providing a hash or an ISO8601-formatted string.'
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
                  update_member_variables
         
     | 
| 
      
 37 
     | 
    
         
            +
                  normalize
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                def string
         
     | 
| 
      
 41 
     | 
    
         
            +
                  input = { :seconds => @seconds, :minutes => @minutes, :hours => @hours, 
         
     | 
| 
      
 42 
     | 
    
         
            +
                            :days => @days, :weeks => @weeks, :months => @months, 
         
     | 
| 
      
 43 
     | 
    
         
            +
                            :years => @years } 
         
     | 
| 
      
 44 
     | 
    
         
            +
                  iso_str = 'P'
         
     | 
| 
      
 45 
     | 
    
         
            +
                  UNITS.each do |unit, abrev|
         
     | 
| 
      
 46 
     | 
    
         
            +
                    iso_str += input[unit].to_s + abrev unless input[unit].zero?
         
     | 
| 
      
 47 
     | 
    
         
            +
                    iso_str += 'T' if unit == :days
         
     | 
| 
      
 48 
     | 
    
         
            +
                  end
         
     | 
| 
      
 49 
     | 
    
         
            +
                  iso_str = iso_str.strip
         
     | 
| 
      
 50 
     | 
    
         
            +
                  iso_str = iso_str.chomp('T') if (iso_str[-1]).eql? 'T'
         
     | 
| 
      
 51 
     | 
    
         
            +
                  iso_str
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                def normalize
         
     | 
| 
      
 55 
     | 
    
         
            +
                  if @seconds >= CONVERSIONS[:s_to_m]
         
     | 
| 
      
 56 
     | 
    
         
            +
                    @minutes += (@seconds / CONVERSIONS[:s_to_m]).floor
         
     | 
| 
      
 57 
     | 
    
         
            +
                    @seconds %= CONVERSIONS[:s_to_m]
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
                  if @minutes >= CONVERSIONS[:m_to_h]
         
     | 
| 
      
 60 
     | 
    
         
            +
                    @hours += (@minutes / CONVERSIONS[:m_to_h]).floor
         
     | 
| 
      
 61 
     | 
    
         
            +
                    @minutes %= CONVERSIONS[:m_to_h]
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
                  if @hours >= CONVERSIONS[:h_to_d]
         
     | 
| 
      
 64 
     | 
    
         
            +
                    @days += (@hours / CONVERSIONS[:h_to_d]).floor
         
     | 
| 
      
 65 
     | 
    
         
            +
                    @hours %= CONVERSIONS[:h_to_d]
         
     | 
| 
      
 66 
     | 
    
         
            +
                  end
         
     | 
| 
      
 67 
     | 
    
         
            +
                  if @days >= CONVERSIONS[:d_to_w] && @months == 0 && @years == 0
         
     | 
| 
      
 68 
     | 
    
         
            +
                    @weeks += (@days / CONVERSIONS[:d_to_w]).floor
         
     | 
| 
      
 69 
     | 
    
         
            +
                    @days %= CONVERSIONS[:d_to_w]
         
     | 
| 
      
 70 
     | 
    
         
            +
                  end
         
     | 
| 
      
 71 
     | 
    
         
            +
                  if @months > CONVERSIONS[:m_to_y]
         
     | 
| 
      
 72 
     | 
    
         
            +
                    @years += (@months / CONVERSIONS[:m_to_y]).floor
         
     | 
| 
      
 73 
     | 
    
         
            +
                    @months %= CONVERSIONS[:m_to_y]
         
     | 
| 
      
 74 
     | 
    
         
            +
                  end
         
     | 
| 
      
 75 
     | 
    
         
            +
                end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                def seconds=(value)
         
     | 
| 
      
 78 
     | 
    
         
            +
                  input = { :seconds => value, :minutes => @minutes, :hours => @hours, 
         
     | 
| 
      
 79 
     | 
    
         
            +
                            :days => @days, :weeks => @weeks, :months => @months, 
         
     | 
| 
      
 80 
     | 
    
         
            +
                            :years => @years } 
         
     | 
| 
      
 81 
     | 
    
         
            +
                  @duration_obj = parse_hash(input)
         
     | 
| 
      
 82 
     | 
    
         
            +
                  @seconds = value
         
     | 
| 
      
 83 
     | 
    
         
            +
                  normalize
         
     | 
| 
      
 84 
     | 
    
         
            +
                end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                def minutes=(value)
         
     | 
| 
      
 87 
     | 
    
         
            +
                  input = { :seconds => @seconds, :minutes => value, :hours => @hours, 
         
     | 
| 
      
 88 
     | 
    
         
            +
                            :days => @days, :weeks => @weeks, :months => @months, 
         
     | 
| 
      
 89 
     | 
    
         
            +
                            :years => @years } 
         
     | 
| 
      
 90 
     | 
    
         
            +
                  @duration_obj = parse_hash(input)
         
     | 
| 
      
 91 
     | 
    
         
            +
                  @minutes = value
         
     | 
| 
      
 92 
     | 
    
         
            +
                  normalize
         
     | 
| 
      
 93 
     | 
    
         
            +
                end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
                def hours=(value)
         
     | 
| 
      
 96 
     | 
    
         
            +
                  input = { :seconds => @seconds, :minutes => @minutes, :hours => value, 
         
     | 
| 
      
 97 
     | 
    
         
            +
                            :days => @days, :weeks => @weeks, :months => @months, 
         
     | 
| 
      
 98 
     | 
    
         
            +
                            :years => @years } 
         
     | 
| 
      
 99 
     | 
    
         
            +
                  @duration_obj = parse_hash(input)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  @hours = value
         
     | 
| 
      
 101 
     | 
    
         
            +
                  normalize
         
     | 
| 
      
 102 
     | 
    
         
            +
                end
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
                def days=(value)
         
     | 
| 
      
 105 
     | 
    
         
            +
                  input = { :seconds => @seconds, :minutes => @minutes, :hours => @hours, 
         
     | 
| 
      
 106 
     | 
    
         
            +
                            :days => value, :weeks => @weeks, :months => @months, 
         
     | 
| 
      
 107 
     | 
    
         
            +
                            :years => @years } 
         
     | 
| 
      
 108 
     | 
    
         
            +
                  @duration_obj = parse_hash(input)
         
     | 
| 
      
 109 
     | 
    
         
            +
                  @days = value
         
     | 
| 
      
 110 
     | 
    
         
            +
                  normalize
         
     | 
| 
      
 111 
     | 
    
         
            +
                end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
                def weeks=(value)
         
     | 
| 
      
 114 
     | 
    
         
            +
                  input = { :seconds => @seconds, :minutes => @minutes, :hours => @hours, 
         
     | 
| 
      
 115 
     | 
    
         
            +
                            :days => @days, :weeks => value, :months => @months, 
         
     | 
| 
      
 116 
     | 
    
         
            +
                            :years => @years } 
         
     | 
| 
      
 117 
     | 
    
         
            +
                  @duration_obj = parse_hash(input)
         
     | 
| 
      
 118 
     | 
    
         
            +
                  @weeks = value
         
     | 
| 
      
 119 
     | 
    
         
            +
                  normalize
         
     | 
| 
      
 120 
     | 
    
         
            +
                end
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
                def months=(value)
         
     | 
| 
      
 123 
     | 
    
         
            +
                  input = { :seconds => @seconds, :minutes => @minutes, :hours => @hours, 
         
     | 
| 
      
 124 
     | 
    
         
            +
                            :days => @days, :weeks => @weeks, :months => value, 
         
     | 
| 
      
 125 
     | 
    
         
            +
                            :years => @years } 
         
     | 
| 
      
 126 
     | 
    
         
            +
                  @duration_obj = parse_hash(input)
         
     | 
| 
      
 127 
     | 
    
         
            +
                  @months = value
         
     | 
| 
      
 128 
     | 
    
         
            +
                  normalize
         
     | 
| 
      
 129 
     | 
    
         
            +
                end
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
                def years=(value)
         
     | 
| 
      
 132 
     | 
    
         
            +
                  input = { :seconds => @seconds, :minutes => @minutes, :hours => @hours, 
         
     | 
| 
      
 133 
     | 
    
         
            +
                    :days => @days, :weeks => @weeks, :months => @months, 
         
     | 
| 
      
 134 
     | 
    
         
            +
                    :years => value } 
         
     | 
| 
      
 135 
     | 
    
         
            +
                  @duration_obj = parse_hash(input)
         
     | 
| 
      
 136 
     | 
    
         
            +
                  @years = value
         
     | 
| 
      
 137 
     | 
    
         
            +
                  normalize
         
     | 
| 
      
 138 
     | 
    
         
            +
                end
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
                def abs
         
     | 
| 
      
 141 
     | 
    
         
            +
                  @duration_obj = @duration_obj.abs
         
     | 
| 
      
 142 
     | 
    
         
            +
                  update_member_variables
         
     | 
| 
      
 143 
     | 
    
         
            +
                  return self
         
     | 
| 
      
 144 
     | 
    
         
            +
                end
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
                def +(other)
         
     | 
| 
      
 147 
     | 
    
         
            +
                  new_obj = self.duration_obj + other.duration_obj
         
     | 
| 
      
 148 
     | 
    
         
            +
                  MicrosoftKiotaAbstractions::ISODuration.new(dur_obj_to_hash(new_obj))
         
     | 
| 
      
 149 
     | 
    
         
            +
                end
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
      
 151 
     | 
    
         
            +
                def -(other)
         
     | 
| 
      
 152 
     | 
    
         
            +
                  new_obj = self.duration_obj - other.duration_obj
         
     | 
| 
      
 153 
     | 
    
         
            +
                  MicrosoftKiotaAbstractions::ISODuration.new(dur_obj_to_hash(new_obj))
         
     | 
| 
      
 154 
     | 
    
         
            +
                end
         
     | 
| 
      
 155 
     | 
    
         
            +
             
     | 
| 
      
 156 
     | 
    
         
            +
                def ==(other)
         
     | 
| 
      
 157 
     | 
    
         
            +
                  @duration_obj == other.duration_obj
         
     | 
| 
      
 158 
     | 
    
         
            +
                end
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
                def -@
         
     | 
| 
      
 161 
     | 
    
         
            +
                  @duration_obj = -@duration_obj
         
     | 
| 
      
 162 
     | 
    
         
            +
                  update_member_variables
         
     | 
| 
      
 163 
     | 
    
         
            +
                end
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
                def eql?(other)
         
     | 
| 
      
 166 
     | 
    
         
            +
                  @duration_obj == other.duration_obj
         
     | 
| 
      
 167 
     | 
    
         
            +
                end
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
                protected
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
      
 171 
     | 
    
         
            +
                attr_accessor :duration_obj
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
                def parse_hash(input)
         
     | 
| 
      
 174 
     | 
    
         
            +
                  iso_str = 'P'
         
     | 
| 
      
 175 
     | 
    
         
            +
                  input.each do |keys, values|
         
     | 
| 
      
 176 
     | 
    
         
            +
                    raise StandardError, "The key #{keys} is not recognized" unless UNITS.key?(keys)
         
     | 
| 
      
 177 
     | 
    
         
            +
                  end
         
     | 
| 
      
 178 
     | 
    
         
            +
                  UNITS.each do |unit, abrev|
         
     | 
| 
      
 179 
     | 
    
         
            +
                    iso_str += input[unit].to_s + abrev if input.key?(unit) && !input[unit].zero?
         
     | 
| 
      
 180 
     | 
    
         
            +
                    iso_str += 'T' if unit == :days
         
     | 
| 
      
 181 
     | 
    
         
            +
                  end
         
     | 
| 
      
 182 
     | 
    
         
            +
                  iso_str = iso_str.strip
         
     | 
| 
      
 183 
     | 
    
         
            +
                  iso_str = iso_str.chomp('T') if (iso_str[-1]).eql? 'T'
         
     | 
| 
      
 184 
     | 
    
         
            +
                  ISO8601::Duration.new(iso_str)
         
     | 
| 
      
 185 
     | 
    
         
            +
                end
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
                def update_member_variables
         
     | 
| 
      
 188 
     | 
    
         
            +
                  @seconds = @duration_obj.seconds.nil? ? 0 : ((@duration_obj.seconds.to_s).split('S')[0]).to_i
         
     | 
| 
      
 189 
     | 
    
         
            +
                  @minutes = @duration_obj.minutes.nil? ? 0 : ((@duration_obj.minutes.to_s).split('H')[0]).to_i
         
     | 
| 
      
 190 
     | 
    
         
            +
                  @hours = @duration_obj.hours.nil? ? 0 : ((@duration_obj.hours.to_s).split('H')[0]).to_i
         
     | 
| 
      
 191 
     | 
    
         
            +
                  @days = @duration_obj.days.nil? ? 0 : ((@duration_obj.days.to_s).split('D')[0]).to_i
         
     | 
| 
      
 192 
     | 
    
         
            +
                  @weeks = @duration_obj.weeks.nil? ? 0 : ((@duration_obj.weeks.to_s).split('W')[0]).to_i
         
     | 
| 
      
 193 
     | 
    
         
            +
                  @months = @duration_obj.months.nil? ? 0 : ((@duration_obj.months.to_s).split('M')[0]).to_i
         
     | 
| 
      
 194 
     | 
    
         
            +
                  @years = @duration_obj.years.nil? ? 0 : ((@duration_obj.years.to_s).split('Y')[0]).to_i
         
     | 
| 
      
 195 
     | 
    
         
            +
                end
         
     | 
| 
      
 196 
     | 
    
         
            +
             
     | 
| 
      
 197 
     | 
    
         
            +
                def dur_obj_to_hash(dur_obj)
         
     | 
| 
      
 198 
     | 
    
         
            +
                  result_hash = {}
         
     | 
| 
      
 199 
     | 
    
         
            +
                  result_hash[:seconds] = dur_obj.seconds.nil? ? 0 : ((dur_obj.seconds.to_s).split('S')[0]).to_i
         
     | 
| 
      
 200 
     | 
    
         
            +
                  result_hash[:minutes] = dur_obj.minutes.nil? ? 0 : ((dur_obj.minutes.to_s).split('H')[0]).to_i
         
     | 
| 
      
 201 
     | 
    
         
            +
                  result_hash[:hours] = dur_obj.hours.nil? ? 0 : ((dur_obj.hours.to_s).split('H')[0]).to_i
         
     | 
| 
      
 202 
     | 
    
         
            +
                  result_hash[:days] = dur_obj.days.nil? ? 0 : ((dur_obj.days.to_s).split('D')[0]).to_i
         
     | 
| 
      
 203 
     | 
    
         
            +
                  result_hash[:weeks] = dur_obj.weeks.nil? ? 0 : ((dur_obj.weeks.to_s).split('W')[0]).to_i
         
     | 
| 
      
 204 
     | 
    
         
            +
                  result_hash[:months] = dur_obj.months.nil? ? 0 : ((dur_obj.months.to_s).split('M')[0]).to_i
         
     | 
| 
      
 205 
     | 
    
         
            +
                  result_hash[:years] = dur_obj.years.nil? ? 0 : ((dur_obj.years.to_s).split('Y')[0]).to_i
         
     | 
| 
      
 206 
     | 
    
         
            +
                  result_hash
         
     | 
| 
      
 207 
     | 
    
         
            +
                end
         
     | 
| 
      
 208 
     | 
    
         
            +
              end
         
     | 
| 
      
 209 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,61 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module MicrosoftKiotaAbstractions
         
     | 
| 
      
 2 
     | 
    
         
            +
              module ParseNode
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                def get_string_value()
         
     | 
| 
      
 5 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 6 
     | 
    
         
            +
                end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                def get_boolean_value()
         
     | 
| 
      
 9 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def get_number_value()
         
     | 
| 
      
 13 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                def get_guid_value()
         
     | 
| 
      
 17 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                def get_date_value()
         
     | 
| 
      
 21 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                def get_time_value()
         
     | 
| 
      
 25 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                def get_date_time_value()
         
     | 
| 
      
 29 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                def get_duration_value()
         
     | 
| 
      
 33 
     | 
    
         
            +
                  raise NotImplementedError.new 
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                def get_collection_of_primitive_values()
         
     | 
| 
      
 37 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                def get_collection_of_object_values(factory)
         
     | 
| 
      
 41 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                def get_object_value(factory)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 46 
     | 
    
         
            +
                end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                def assign_field_values(item)
         
     | 
| 
      
 49 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 50 
     | 
    
         
            +
                end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                def get_enum_value(type)
         
     | 
| 
      
 53 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                def get_child_node(name)
         
     | 
| 
      
 57 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 58 
     | 
    
         
            +
                end
         
     | 
| 
      
 59 
     | 
    
         
            +
                
         
     | 
| 
      
 60 
     | 
    
         
            +
              end
         
     | 
| 
      
 61 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,42 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'parse_node_factory'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module MicrosoftKiotaAbstractions
         
     | 
| 
      
 4 
     | 
    
         
            +
              class ParseNodeFactoryRegistry
         
     | 
| 
      
 5 
     | 
    
         
            +
                include ParseNodeFactory
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_accessor :default_instance
         
     | 
| 
      
 9 
     | 
    
         
            +
                def default_instance; @default_instance ||= ParseNodeFactoryRegistry.new; end
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def default_instance
         
     | 
| 
      
 13 
     | 
    
         
            +
                self.class.default_instance
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                def content_type_associated_factories
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @content_type_associated_factories ||= Hash.new
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                def get_parse_node(content_type, content)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  if !content_type
         
     | 
| 
      
 22 
     | 
    
         
            +
                    raise Exception.new 'content type cannot be undefined or empty'
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
                  if !content
         
     | 
| 
      
 25 
     | 
    
         
            +
                    raise Exception.new 'content cannot be undefined or empty'
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
      
 27 
     | 
    
         
            +
                  vendor_specific_content_type = content_type.split(';').first
         
     | 
| 
      
 28 
     | 
    
         
            +
                  factory = @content_type_associated_factories[vendor_specific_content_type]
         
     | 
| 
      
 29 
     | 
    
         
            +
                  if factory
         
     | 
| 
      
 30 
     | 
    
         
            +
                    return factory.get_parse_node(vendor_specific_content_type, content)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  clean_content_type = vendor_specific_content_type.gsub(/[^\/]+\+/i, '')
         
     | 
| 
      
 34 
     | 
    
         
            +
                  factory = @content_type_associated_factories[clean_content_type]
         
     | 
| 
      
 35 
     | 
    
         
            +
                  if factory
         
     | 
| 
      
 36 
     | 
    
         
            +
                    return factory.get_parse_node(clean_content_type, content)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
                  raise Exception.new "Content type #{contentType} does not have a factory to be parsed"
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
                    
         
     | 
| 
      
 41 
     | 
    
         
            +
              end
         
     | 
| 
      
 42 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,69 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module MicrosoftKiotaAbstractions
         
     | 
| 
      
 2 
     | 
    
         
            +
              module SerializationWriter
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                def write_string_value(key, value)
         
     | 
| 
      
 5 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 6 
     | 
    
         
            +
                end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                def write_boolean_value(key, value)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def write_number_value(key, value)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                def write_float_value(key, value)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                def get_date_value(key, value)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                def write_guid_value(key, value)
         
     | 
| 
      
 25 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                def write_date_value(key, value)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
                
         
     | 
| 
      
 32 
     | 
    
         
            +
                def write_time_value(key, value)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                def write_date_time_value(key, value)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                def write_duration_value(key, value)
         
     | 
| 
      
 41 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                def write_collection_of_primitive_values(key, value)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 46 
     | 
    
         
            +
                end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                def write_collection_of_object_values(key, value)
         
     | 
| 
      
 49 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 50 
     | 
    
         
            +
                end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                def write_enum_value(key, value)
         
     | 
| 
      
 53 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                def get_serialized_content()
         
     | 
| 
      
 57 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 58 
     | 
    
         
            +
                end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                def write_additional_data(type)
         
     | 
| 
      
 61 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 62 
     | 
    
         
            +
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                def write_any_value(key, value)
         
     | 
| 
      
 65 
     | 
    
         
            +
                  raise NotImplementedError.new
         
     | 
| 
      
 66 
     | 
    
         
            +
                end
         
     | 
| 
      
 67 
     | 
    
         
            +
                
         
     | 
| 
      
 68 
     | 
    
         
            +
              end
         
     | 
| 
      
 69 
     | 
    
         
            +
            end
         
     |