microsoft_kiota_faraday 0.9.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ed4dfb9cf94922a3682645363ddc89c4f2b56c46a2c956f0dd9f3bc59aeb251
4
- data.tar.gz: 3fa85ddafb2c648892c93f02b4639491f5abef2cf156e16e8a1df4b5ceace8f6
3
+ metadata.gz: 78b9949aca03b66bf9410b97c72cbbc38b7ca95ca7b862cbf71e43215c5a669c
4
+ data.tar.gz: 62e37484c620d4a2522c2f98a88724c646368fcfb667ea90ce68c7fccbe710a1
5
5
  SHA512:
6
- metadata.gz: 756fdc8483daf374d04369e19020e9df2a30e5204f8f3221ed72f2f141120e605fb338dc370b650db653aea85551b6bf72e006c6ae4ed65950b3ed6ef0d8df5d
7
- data.tar.gz: 452630029c70e993ab61d92a32c2d04642edcf41955ec43ac77bce9851fb735f2d4440985bf8266e89b81544cf4c6f1eac56dd4b90676710c6ae835a0abffc98
6
+ metadata.gz: 78c847e4fd5b9f8392b49d3dcf9f02e75943d6399be46037b5747f0df6cc6885d9dd5642bbb27d268b949e16c7e8b7a46446f94a55aee142fbd17b4d8239a684
7
+ data.tar.gz: '099a13bda01cf06d64c10e77bbd7d04086151aedee682499e23221e249c697e180b5ae8a64994abdcd223829def2b139bb7a4ad2fc2a9c5b465a6a1e0e5a81fb'
@@ -13,10 +13,10 @@ name: "CodeQL"
13
13
 
14
14
  on:
15
15
  push:
16
- branches: [ "master", main ]
16
+ branches: [ main ]
17
17
  pull_request:
18
18
  # The branches below must be a subset of the branches above
19
- branches: [ "master" ]
19
+ branches: [ main ]
20
20
  schedule:
21
21
  - cron: '41 2 * * 0'
22
22
 
data/CHANGELOG.md CHANGED
@@ -11,6 +11,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
 
12
12
  ### Changed
13
13
 
14
+ ## [0.11.0] - 2023-01-10
15
+
16
+ ### Added
17
+
18
+ - Added a method to convert abstract requests to native requests in the request adapter interface.
19
+
20
+ ## [0.10.0] - 2023-01-06
21
+
22
+ ### Added
23
+
24
+ - Added a user agent handler to add the product to the request header.
25
+
14
26
  ## [0.9.0] - 2022-12-30
15
27
 
16
28
  ### Added
data/README.md CHANGED
@@ -13,7 +13,7 @@ Read more about Kiota [here](https://github.com/microsoft/kiota/blob/main/README
13
13
  Add this line to your application's Gemfile:
14
14
 
15
15
  ```ruby
16
- gem "microsoft_kiota_http", "0.9.0"
16
+ gem "microsoft_kiota_http", "0.11.0"
17
17
  ```
18
18
 
19
19
  And then execute:
@@ -25,7 +25,7 @@ bundle install
25
25
  Or install it yourself as:
26
26
 
27
27
  ```shell
28
- gem install microsoft_kiota_http --version "0.9.0"
28
+ gem install microsoft_kiota_http --version "0.11.0"
29
29
  ```
30
30
 
31
31
  ## Contributing
@@ -147,5 +147,13 @@ module MicrosoftKiotaFaraday
147
147
  end
148
148
  end
149
149
 
150
+ def convert_to_native_request_async(request_info)
151
+ raise StandardError, 'request_info cannot be null' unless request_info
152
+ return Fiber.new do
153
+ @authentication_provider.authenticate_request(request_info).resume
154
+ return self.get_request_from_request_info(request_info)
155
+ end
156
+ end
157
+
150
158
  end
151
159
  end
@@ -1,11 +1,13 @@
1
1
  require 'net/https'
2
2
  require 'faraday'
3
3
  require_relative 'middleware/parameters_name_decoding_handler'
4
+ require_relative 'middleware/user_agent_handler'
4
5
  module MicrosoftKiotaFaraday
5
6
  class KiotaClientFactory
6
7
  def self.get_default_middleware()
7
8
  return [
8
- MicrosoftKiotaFaraday::Middleware::ParametersNameDecodingHandler
9
+ MicrosoftKiotaFaraday::Middleware::ParametersNameDecodingHandler,
10
+ MicrosoftKiotaFaraday::Middleware::UserAgentHandler
9
11
  ]
10
12
  end
11
13
 
@@ -0,0 +1,24 @@
1
+ require 'faraday'
2
+ require_relative 'user_agent_option'
3
+ module MicrosoftKiotaFaraday
4
+ module Middleware
5
+ class UserAgentHandler < Faraday::Middleware
6
+ @@default_option = UserAgentOption.new
7
+ @@user_agent_key = "User-Agent"
8
+ def call(request_env)
9
+ request_option = request_env[:request][:context][@@default_option.get_key] unless request_env[:request].nil? || request_env[:request][:context].nil?
10
+ request_option = @@default_option if request_option.nil?
11
+ unless request_env[:request_headers].nil? || !request_option.enabled || request_option.product_name.nil? || request_option.product_name.empty? || request_option.product_version.nil? || request_option.product_version.empty? then
12
+ existing_value = request_env[:request_headers][@@user_agent_key]
13
+ additional_value = "#{request_option.product_name}/#{request_option.product_version}"
14
+ if !existing_value || existing_value.empty? then
15
+ request_env[:request_headers][@@user_agent_key] = additional_value
16
+ elsif !existing_value.include? additional_value then
17
+ request_env[:request_headers][@@user_agent_key] = "#{existing_value} #{additional_value}"
18
+ end
19
+ end
20
+ @app.call(request_env) unless @app.nil?
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+ require 'microsoft_kiota_abstractions'
3
+ require_relative '../version.rb'
4
+ module MicrosoftKiotaFaraday
5
+ module Middleware
6
+ class UserAgentOption
7
+ include MicrosoftKiotaAbstractions::RequestOption
8
+ attr_accessor :enabled, :product_name, :product_version
9
+ def initialize()
10
+ @enabled = true
11
+ @product_name = "kiota-ruby"
12
+ @product_version = MicrosoftKiotaFaraday::VERSION
13
+ end
14
+
15
+ def get_key()
16
+ "userAgent"
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MicrosoftKiotaFaraday
4
- VERSION = '0.9.0'
4
+ VERSION = '0.11.0'
5
5
  end
@@ -4,6 +4,8 @@ require_relative 'microsoft_kiota_faraday/version'
4
4
  require_relative 'microsoft_kiota_faraday/middleware/response_handler_option'
5
5
  require_relative 'microsoft_kiota_faraday/middleware/parameters_name_decoding_option'
6
6
  require_relative 'microsoft_kiota_faraday/middleware/parameters_name_decoding_handler'
7
+ require_relative 'microsoft_kiota_faraday/middleware/user_agent_option'
8
+ require_relative 'microsoft_kiota_faraday/middleware/user_agent_handler'
7
9
  require_relative 'microsoft_kiota_faraday/kiota_client_factory'
8
10
  require_relative 'microsoft_kiota_faraday/faraday_request_adapter'
9
11
 
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.bindir = 'bin'
29
29
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ['lib']
31
- spec.add_runtime_dependency 'microsoft_kiota_abstractions', '~> 0.12.0', '>= 0.12.0'
31
+ spec.add_runtime_dependency 'microsoft_kiota_abstractions', '~> 0.13.0', '>= 0.13.0'
32
32
  spec.add_runtime_dependency 'faraday', '~> 2.7', '>= 2.7.2'
33
33
  spec.add_development_dependency 'rake', '~> 13.0'
34
34
  spec.add_development_dependency 'rspec', '~> 3.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microsoft_kiota_faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-30 00:00:00.000000000 Z
11
+ date: 2023-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: microsoft_kiota_abstractions
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.12.0
19
+ version: 0.13.0
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.12.0
22
+ version: 0.13.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: 0.12.0
29
+ version: 0.13.0
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.12.0
32
+ version: 0.13.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: faraday
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -121,6 +121,8 @@ files:
121
121
  - lib/microsoft_kiota_faraday/middleware/parameters_name_decoding_handler.rb
122
122
  - lib/microsoft_kiota_faraday/middleware/parameters_name_decoding_option.rb
123
123
  - lib/microsoft_kiota_faraday/middleware/response_handler_option.rb
124
+ - lib/microsoft_kiota_faraday/middleware/user_agent_handler.rb
125
+ - lib/microsoft_kiota_faraday/middleware/user_agent_option.rb
124
126
  - lib/microsoft_kiota_faraday/version.rb
125
127
  - microsoft_kiota_faraday.gemspec
126
128
  homepage: https://microsoft.github.io/kiota/