From bcd58dcd09e0cd7693844a983d5d3c004bbd377c Mon Sep 17 00:00:00 2001 From: Jens Balvig Date: Thu, 14 Apr 2022 13:29:51 +0200 Subject: [PATCH] include just for test/dev --- .circleci/config.yml | 2 +- Gemfile | 4 ++++ README.md | 2 +- spyke.gemspec | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e4d0976..575586f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,7 +59,7 @@ workflows: parameters: rails_version: ["~> 4.0"] ruby_version: ["2.6.9"] - faraday_version: ["< 1.0"] + faraday_version: ["< 2.0"] - build: matrix: alias: Rails 5 diff --git a/Gemfile b/Gemfile index 6dd23a6..3d13184 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,7 @@ source 'https://rubygems.org' # Specify your gem's dependencies in spyke.gemspec gemspec + +if ENV['FARADAY_TEST_VERSION'] == '< 2.0' + gem 'faraday_middleware' +end diff --git a/README.md b/README.md index eb7ca51..3d2dbb1 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ So, for example for an API that returns JSON like this: ```ruby # config/initializers/spyke.rb -class JSONParser < Faraday::Middleware # Faraday::Response::Middleware for Faraday v1.0 +class JSONParser < Faraday::Middleware def on_complete(env) json = MultiJson.load(env.body, symbolize_keys: true) env.body = { diff --git a/spyke.gemspec b/spyke.gemspec index 0326e64..5edfaa3 100644 --- a/spyke.gemspec +++ b/spyke.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'activesupport', ENV.fetch('RAILS_TEST_VERSION', '>= 4.0.0') spec.add_dependency 'activemodel', ENV.fetch('RAILS_TEST_VERSION', '>= 4.0.0') - spec.add_dependency 'faraday', ENV.fetch('FARADAY_TEST_VERSION', '>= 0.9.0'), '< 3.0' + spec.add_dependency 'faraday', ENV.fetch('FARADAY_TEST_VERSION', '>= 1.0.0'), '< 3.0' spec.add_dependency 'faraday-multipart', '~> 1.0' spec.add_dependency 'addressable', '>= 2.5.2'