-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2101 from microsoft/feature/middleware-ruby
feature/middleware ruby
- Loading branch information
Showing
37 changed files
with
353 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...ions/ruby/microsoft_kiota_abstractions/lib/microsoft_kiota_abstractions/request_option.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module MicrosoftKiotaAbstractions | ||
module RequestOption | ||
def get_key() | ||
raise NotImplementedError.new | ||
end | ||
end | ||
end |
2 changes: 1 addition & 1 deletion
2
abstractions/ruby/microsoft_kiota_abstractions/lib/microsoft_kiota_abstractions/version.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module MicrosoftKiotaAbstractions | ||
VERSION = "0.4.0" | ||
VERSION = "0.5.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
abstractions/ruby/microsoft_kiota_abstractions/spec/request_information_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'microsoft_kiota_abstractions' | ||
require_relative 'request_option_mock' | ||
|
||
RSpec.describe MicrosoftKiotaAbstractions do | ||
|
||
it "adds a request option to the request information" do | ||
request_info = MicrosoftKiotaAbstractions::RequestInformation.new | ||
mock_option = RequestOptionMock.new | ||
mock_option.value = "value" | ||
request_info.add_request_options(mock_option) | ||
expect(request_info.get_request_options().length).to eq(1) | ||
expect(request_info.get_request_option("key")).to eq(mock_option) | ||
end | ||
|
||
it "removes a request option from the request information" do | ||
request_info = MicrosoftKiotaAbstractions::RequestInformation.new | ||
mock_option = RequestOptionMock.new | ||
mock_option.value = "value" | ||
request_info.add_request_options(mock_option) | ||
expect(request_info.get_request_options().length).to eq(1) | ||
request_info.remove_request_options("key") | ||
expect(request_info.get_request_options().length).to eq(0) | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
abstractions/ruby/microsoft_kiota_abstractions/spec/request_option_mock.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'microsoft_kiota_abstractions' | ||
class RequestOptionMock | ||
include MicrosoftKiotaAbstractions::RequestOption | ||
attr_accessor :value | ||
def get_key() | ||
return "key" | ||
end | ||
end |
16 changes: 2 additions & 14 deletions
16
authentication/ruby/oauth/microsoft_kiota_authentication_oauth/Gemfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
source "https://rubygems.pkg.github.com/microsoft" | ||
|
||
# Specify your gem's dependencies in microsoft_kiota_authentication.gemspec | ||
gemspec | ||
|
||
# git_source(:github) { |repo_name| "https://rubygems.pkg.github.com/microsoft" } | ||
# gem "microsoft_kiota_abstractions", path: "../../../../abstractions/ruby/microsoft_kiota_abstractions" | ||
|
||
source "https://rubygems.pkg.github.com/microsoft" do | ||
gem "microsoft_kiota_abstractions", '0.4.0' | ||
end | ||
|
||
gem 'rake', '~> 13.0' | ||
|
||
gem 'rspec', '~> 3.0' | ||
|
||
gem 'rubocop', require: false | ||
|
||
gem 'addressable', '~> 2.7', '>= 2.7.0' | ||
|
||
gem "oauth2", "~> 2.0" |
2 changes: 1 addition & 1 deletion
2
.../microsoft_kiota_authentication_oauth/lib/microsoft_kiota_authentication_oauth/version.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module MicrosoftKiotaAuthenticationOAuth | ||
VERSION = "0.3.0" | ||
VERSION = "0.4.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
source 'https://rubygems.pkg.github.com/microsoft' | ||
|
||
gemspec | ||
|
||
# gem "microsoft_kiota_abstractions", path: "../../../../abstractions/ruby/microsoft_kiota_abstractions" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
http/ruby/faraday/microsoft_kiota_faraday/lib/microsoft_kiota_faraday.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'microsoft_kiota_faraday/version' | ||
require_relative 'microsoft_kiota_faraday/middleware/parameters_name_decoding_option' | ||
require_relative 'microsoft_kiota_faraday/middleware/parameters_name_decoding_handler' | ||
require_relative 'microsoft_kiota_faraday/kiota_client_factory' | ||
require_relative 'microsoft_kiota_faraday/faraday_request_adapter' | ||
|
||
module MicrosoftKiotaFaraday | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
.../ruby/faraday/microsoft_kiota_faraday/lib/microsoft_kiota_faraday/kiota_client_factory.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'net/https' | ||
require 'faraday' | ||
require_relative 'middleware/parameters_name_decoding_handler' | ||
module MicrosoftKiotaFaraday | ||
class KiotaClientFactory | ||
def self.get_default_middleware() | ||
return [ | ||
MicrosoftKiotaFaraday::Middleware::ParametersNameDecodingHandler | ||
] | ||
end | ||
|
||
def self.get_default_http_client(middleware=nil) | ||
if middleware.nil? #empty is fine in case the user doesn't want to use any middleware | ||
middleware = self.get_default_middleware() | ||
end | ||
conn = Faraday::Connection.new do |builder| | ||
builder.adapter Faraday.default_adapter | ||
builder.ssl.verify = true | ||
builder.ssl.verify_mode = OpenSSL::SSL::VERIFY_PEER | ||
middleware.each do |middleware| | ||
builder.use middleware | ||
end | ||
end | ||
conn | ||
end | ||
end | ||
end |
Oops, something went wrong.