From 5c34f35b737461c503a02ca86b69dde47d1ee375 Mon Sep 17 00:00:00 2001 From: Aaron Milam Date: Tue, 31 May 2022 15:38:27 -0400 Subject: [PATCH] Remove rest-client dependency in the gemspec and default to faraday --- Gemfile | 2 ++ README.md | 6 +++--- lib/trello.rb | 4 ++-- ruby-trello.gemspec | 1 - spec/spec_helper.rb | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 61ad4419..ea36eaea 100644 --- a/Gemfile +++ b/Gemfile @@ -21,6 +21,8 @@ group :development, :spec do gem 'faraday', '~> 2.0' end + gem 'rest-client', '>= 1.8.0' + if RUBY_ENGINE == 'jruby' gem 'jruby-openssl', platforms: :jruby gem 'pry-nav', platforms: :jruby diff --git a/README.md b/README.md index b771fac3..f9ef1718 100644 --- a/README.md +++ b/README.md @@ -89,13 +89,13 @@ All the calls this library makes to Trello require authentication using these ke #### HTTP Client -By default, ruby-trello uses [rest-client](https://rubygems.org/gems/rest-client) for network calls. You can configure ruby-trello to use either rest-client or [faraday](https://rubygems.org/gems/faraday), depending on your project's needs. In the next major version, ruby-trello will not require either gem in the gemspec and will default to faraday if both are present. +ruby-trello requires either [rest-client](https://rubygems.org/gems/rest-client) or [faraday](https://rubygems.org/gems/faraday) to be present for network calls. You can configure ruby-trello to use either one, depending on your project's needs. If both are present, ruby-trello defaults to using faraday. ```ruby Trello.configure do |config| - config.http_client = 'rest-client' - # OR config.http_client = 'faraday' + # OR + config.http_client = 'rest-client' end ``` diff --git a/lib/trello.rb b/lib/trello.rb index 58838a92..f846104f 100644 --- a/lib/trello.rb +++ b/lib/trello.rb @@ -122,7 +122,7 @@ def self.logger=(logger) end # The order in which we will try the http clients - HTTP_CLIENT_PRIORITY = %w(rest-client faraday) + HTTP_CLIENT_PRIORITY = %w(faraday rest-client) HTTP_CLIENTS = { 'faraday' => Trello::TFaraday::TInternet, 'rest-client' => Trello::TRestClient::TInternet @@ -141,7 +141,7 @@ def self.http_client end end - raise ConfigurationError, 'Trello requires either rest-client or faraday installed' unless client + raise ConfigurationError, 'Trello requires either faraday or rest-client installed' unless client client end diff --git a/ruby-trello.gemspec b/ruby-trello.gemspec index 0e677fef..3673769c 100644 --- a/ruby-trello.gemspec +++ b/ruby-trello.gemspec @@ -24,5 +24,4 @@ Gem::Specification.new do |s| s.add_dependency 'addressable', '~> 2.3' s.add_dependency 'json', '>= 2.3.0' s.add_dependency 'oauth', '>= 0.4.5' - s.add_dependency 'rest-client', '>= 1.8.0' end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ef50f470..18acc8ad 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -74,7 +74,7 @@ def setup_trello Trello.configure do |config| config.developer_public_key = ENV['TRELLO_DEVELOPER_PUBLIC_KEY'] || 'developerpublickey' config.member_token = ENV['TRELLO_MEMBER_TOKEN'] || 'membertoken' - config.http_client = ENV['HTTP_CLIENT_GEM'] || 'rest-client' + config.http_client = ENV['HTTP_CLIENT_GEM'] || 'faraday' end end end