Skip to content

Commit

Permalink
Update faraday to 2.9, remove deprecated faraday_middleware gem
Browse files Browse the repository at this point in the history
  • Loading branch information
eikes committed Jun 4, 2024
1 parent 57f6726 commit 078dc48
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 45 deletions.
35 changes: 7 additions & 28 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ PATH
activemodel (>= 6.0.0)
activesupport (>= 6.0.0)
faraday (>= 1.8, < 3.0)
faraday_middleware (~> 1.2)
oauth2 (>= 2.0.2, < 3)
openssl (>= 2.2.0)

Expand Down Expand Up @@ -43,31 +42,10 @@ GEM
diff-lcs (1.5.1)
docile (1.4.0)
drb (2.2.1)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
faraday (2.9.0)
faraday-net_http (>= 2.0, < 3.2)
faraday-net_http (3.1.0)
net-http
ffi (1.15.5)
formatador (1.1.0)
guard (2.18.0)
Expand Down Expand Up @@ -109,9 +87,10 @@ GEM
mini_mime (1.1.5)
minitest (5.23.0)
multi_xml (0.6.0)
multipart-post (2.4.0)
mutex_m (0.2.0)
nenv (0.3.0)
net-http (0.4.1)
uri
net-imap (0.4.2)
date
net-protocol
Expand Down Expand Up @@ -194,7 +173,6 @@ GEM
rubocop-rspec_rails (2.28.3)
rubocop (~> 1.40)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
shellany (0.0.1)
simplecov (0.22.0)
docile (~> 1.1)
Expand All @@ -212,6 +190,7 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
uri (0.13.0)
vcr (6.2.0)
version_gem (1.1.3)
webmock (3.23.1)
Expand Down
1 change: 0 additions & 1 deletion ioki-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Gem::Specification.new do |spec|
spec.add_dependency 'activemodel', '>= 6.0.0'
spec.add_dependency 'activesupport', '>= 6.0.0'
spec.add_dependency 'faraday', '>= 1.8', '< 3.0'
spec.add_dependency 'faraday_middleware', '~> 1.2'
spec.add_dependency 'oauth2', '>= 2.0.2', '< 3'
spec.add_dependency 'openssl', '>= 2.2.0'
end
2 changes: 1 addition & 1 deletion lib/ioki/apis/endpoints/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def call(client, model, args = [], options = {})
params: options[:params]
)

return if parsed_response.nil?
return if parsed_response.empty?

model_class
.new(parsed_response['data'], response.headers[:etag], show_deprecation_warnings: false)
Expand Down
2 changes: 1 addition & 1 deletion lib/ioki/apis/endpoints/delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def call(client, args = [], options = {})
params: options[:params]
)

return if parsed_response.nil?
return if parsed_response.empty?

model_class
.new(parsed_response['data'], nil, show_deprecation_warnings: false)
Expand Down
2 changes: 1 addition & 1 deletion lib/ioki/apis/endpoints/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def call(client, model, args = [], options = {})
params: options[:params]
)

return if parsed_response.nil?
return if parsed_response.empty?

model_class
.new(parsed_response['data'], response.headers[:etag], show_deprecation_warnings: false)
Expand Down
1 change: 0 additions & 1 deletion lib/ioki/http_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require 'faraday'
require 'faraday_middleware'

module Ioki
class HttpAdapter
Expand Down
14 changes: 2 additions & 12 deletions spec/ioki/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,8 @@ class NullApi
[200, {}, '']
end

it 'returns nil' do
expect(client_response[0]).to be_nil
end
end

context 'when response body is somewhat malformed' do
let(:response) do
[200, {}, '{ look"mum" & $ : borken_json ']
end

it 'raise a proper error' do
expect { client_response }.to raise_error(Faraday::ParsingError)
it 'returns empty string' do
expect(client_response[0]).to be_empty
end
end
end
Expand Down

0 comments on commit 078dc48

Please sign in to comment.