Skip to content

Commit

Permalink
Allow using faraday 1.x
Browse files Browse the repository at this point in the history
While version 2 is already out, this should at least unblock some use
cases.
  • Loading branch information
ekohl authored and thde committed Jul 21, 2022
1 parent abfaee6 commit ce22842
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions netbox-client-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.6.0'

spec.add_runtime_dependency 'dry-configurable', '~> 0.13.0'
spec.add_runtime_dependency 'faraday', '~> 0.11', '>= 0.11.0'
spec.add_runtime_dependency 'faraday', '>= 0.11.0', '< 2'
spec.add_runtime_dependency 'faraday-detailed_logger', '~> 2.1'
spec.add_runtime_dependency 'faraday_middleware', '~> 0.11'
spec.add_runtime_dependency 'faraday_middleware', '>= 0.11', '< 2'
spec.add_runtime_dependency 'ipaddress', '~> 0.8', '>= 0.8.3'
spec.add_runtime_dependency 'openssl', '~> 2.0', '>= 2.0.5'

Expand Down
18 changes: 14 additions & 4 deletions spec/netbox_client_ruby/connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@
end

it 'sets the adapter' do
expect(NetboxClientRuby::Connection.new.builder.handlers)
.to include Faraday::Adapter::NetHttp
if Faraday::VERSION < '1.0'
expect(NetboxClientRuby::Connection.new.builder.handlers)
.to include Faraday::Adapter::NetHttp
else
expect(NetboxClientRuby::Connection.new.builder.adapter)
.to eq Faraday::Adapter::NetHttp
end
end

it 'adds the json middleware' do
Expand All @@ -65,8 +70,13 @@
end

it 'sets the adapter' do
expect(NetboxClientRuby::Connection.new.builder.handlers)
.to include Faraday::Adapter::NetHttpPersistent
if Faraday::VERSION < '1.0'
expect(NetboxClientRuby::Connection.new.builder.handlers)
.to include Faraday::Adapter::NetHttpPersistent
else
expect(NetboxClientRuby::Connection.new.builder.adapter)
.to eq Faraday::Adapter::NetHttpPersistent
end
end
end

Expand Down

0 comments on commit ce22842

Please sign in to comment.