From a39ca935fdafb45aa3e247cfac2eee51d65ed2f9 Mon Sep 17 00:00:00 2001 From: Lea Roy Klinginsmith Date: Wed, 16 Oct 2024 15:44:41 -0600 Subject: [PATCH] Update faraday to 2.x --- Gemfile.lock | 32 +++---------------- iron_bank.gemspec | 4 +-- lib/iron_bank.rb | 2 +- .../response/raise_error.rb | 2 +- .../faraday_middleware/response/renew_auth.rb | 2 +- 5 files changed, 10 insertions(+), 32 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9a1abac..40aa604 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,8 +2,8 @@ PATH remote: . specs: iron_bank (5.4.1) - faraday (~> 1) - faraday_middleware (~> 1) + faraday (~> 2) + faraday-retry (~> 2) nokogiri (~> 1) GEM @@ -34,31 +34,10 @@ GEM ruby2_keywords factory_bot (6.2.1) activesupport (>= 5.0.0) - 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) + faraday (2.0.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-retry (2.2.0) + faraday (~> 2.0) i18n (1.13.0) concurrent-ruby (~> 1.0) json (2.6.3) @@ -66,7 +45,6 @@ GEM method_source (1.0.0) mini_portile2 (2.8.2) minitest (5.18.0) - multipart-post (2.3.0) mutex_m (0.2.0) nokogiri (1.14.3) mini_portile2 (~> 2.8.0) diff --git a/iron_bank.gemspec b/iron_bank.gemspec index 3b76963..4ab3f88 100644 --- a/iron_bank.gemspec +++ b/iron_bank.gemspec @@ -29,8 +29,8 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "faraday", "~> 1" - spec.add_dependency "faraday_middleware", "~> 1" + spec.add_dependency "faraday", "~> 2" + spec.add_dependency "faraday-retry", "~> 2" spec.add_dependency "nokogiri", "~> 1" spec.metadata["rubygems_mfa_required"] = "true" end diff --git a/lib/iron_bank.rb b/lib/iron_bank.rb index 1ec2677..a5cc5f6 100644 --- a/lib/iron_bank.rb +++ b/lib/iron_bank.rb @@ -3,10 +3,10 @@ # External librairies require "csv" require "faraday" -require "faraday_middleware" require "fileutils" require "json" require "nokogiri" +require "faraday/retry" # An opinionated Ruby interface to the Zuora REST API module IronBank diff --git a/lib/iron_bank/faraday_middleware/response/raise_error.rb b/lib/iron_bank/faraday_middleware/response/raise_error.rb index c894202..325e025 100644 --- a/lib/iron_bank/faraday_middleware/response/raise_error.rb +++ b/lib/iron_bank/faraday_middleware/response/raise_error.rb @@ -8,7 +8,7 @@ module FaradayMiddleware module Response # This class raises an exception based on the HTTP status code and the # `success` flag (if present in the response) from Zuora. - class RaiseError < Faraday::Response::Middleware + class RaiseError < Faraday::Middleware def on_complete(env) (error = IronBank::Error.from_response(env.response)) && raise(error) end diff --git a/lib/iron_bank/faraday_middleware/response/renew_auth.rb b/lib/iron_bank/faraday_middleware/response/renew_auth.rb index 77b76d0..ffac893 100644 --- a/lib/iron_bank/faraday_middleware/response/renew_auth.rb +++ b/lib/iron_bank/faraday_middleware/response/renew_auth.rb @@ -7,7 +7,7 @@ module FaradayMiddleware # IronBank Faraday response middleware module module Response # This middleware reauthorize the request on unauthorized request - class RenewAuth < Faraday::Response::Middleware + class RenewAuth < Faraday::Middleware def initialize(app, auth) @auth = auth