Skip to content

Commit

Permalink
Merge pull request #8 from ninech/update_faraday
Browse files Browse the repository at this point in the history
Update faraday
  • Loading branch information
cimnine authored Aug 22, 2017
2 parents c9f5cc7 + 4fcb578 commit 09cc4e6
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
sudo: false
language: ruby
before_install: gem install bundler
rvm:
- 2.3
- 2.4
notifications:
email:
on_success: never
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ Or install it yourself as:

$ gem install cloudflair

## A Note on Faraday

We have decided to not tightly control the version of faraday (anymore). The versions of faraday that are known to work are listed below. If you want to update to a newer version, you're doing it at your own risk. (But if it works, which is usually when all specs pass, please send a PR to update the list below.)

To be on the safe side, we recommend to lock `faraday` to any of the versions listed below. This can be done like this:

```ruby
gem 'cloudflair'
gem 'faraday', '>=0.13', '<0.14'
```

### Faraday Versions known to work

* `gem 'faraday', '>= 0.12', '<= 0.13'`
* `gem 'faraday', '>= 0.13', '<= 0.14'` (starting with `gem 'cloudflair', '>= 0.2.0'`)

## Usage

### Configuration
Expand Down Expand Up @@ -157,7 +173,6 @@ Bug reports and pull requests are welcome on GitHub at [ninech/cloudflair](https
* Full API support
* Metrics reporting
* Rate Limit Tracking
* (Global/Distributed) Rate Limit Tracking

## License

Expand Down
5 changes: 3 additions & 2 deletions cloudflair.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# coding: utf-8

lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cloudflair/version'
Expand All @@ -19,9 +20,9 @@ Gem::Specification.new do |spec|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = %w(lib)
spec.require_paths = %w[lib]

spec.add_runtime_dependency 'faraday', '>= 0.10.0', '< 0.13'
spec.add_runtime_dependency 'faraday', '>= 0.10.0'
spec.add_runtime_dependency 'faraday_middleware'
spec.add_runtime_dependency 'dry-configurable', '~> 0.1'
spec.add_runtime_dependency 'faraday-detailed_logger'
Expand Down
2 changes: 1 addition & 1 deletion lib/cloudflair/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def self.headers
elsif !cloudflare_auth_config.user_service_key.nil?
headers['X-Auth-User-Service-Key'] = cloudflare_auth_config.user_service_key
else
fail CloudflairError, 'Neither email & key nor user_service_key have been defined.'
raise CloudflairError, 'Neither email & key nor user_service_key have been defined.'
end
headers
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cloudflair/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Cloudflair
VERSION = '0.1.0'.freeze
VERSION = '0.2.0'.freeze
end
3 changes: 1 addition & 2 deletions spec/cloudflair/entity_array_objectfields_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ def initialize
let(:faraday_stubs) { Faraday::Adapter::Test::Stubs.new }
let(:faraday) do
Faraday.new(url: 'https://api.cloudflare.com/client/v4/', headers: Cloudflair::Connection.headers) do |faraday|
faraday.adapter :test, faraday_stubs
faraday.request :json
faraday.response :json, content_type: /\bjson$/
faraday.adapter :test, faraday_stubs
end
end
let(:response_json) do
Expand Down
3 changes: 1 addition & 2 deletions spec/cloudflair/entity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ class TestEntity4
let(:faraday_stubs) { Faraday::Adapter::Test::Stubs.new }
let(:faraday) do
Faraday.new(url: 'https://api.cloudflare.com/client/v4/', headers: Cloudflair::Connection.headers) do |faraday|
faraday.adapter :test, faraday_stubs
faraday.request :json
faraday.response :json, content_type: /\bjson$/
faraday.adapter :test, faraday_stubs
end
end
let(:raw_data) do
Expand Down
5 changes: 2 additions & 3 deletions spec/shared_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@

let(:faraday_stubs) { Faraday::Adapter::Test::Stubs.new }
let(:faraday) do
Faraday.new(url: Cloudflair.config.cloudflare.api_base_url, headers: Cloudflair::Connection.headers) do |faraday|
faraday.adapter :test, faraday_stubs
faraday.request :json
Faraday.new(url: Cloudflair.config.cloudflare.api_base_url, headers: Cloudflair::Connection.headers) do |faraday|
faraday.response :json, content_type: /\bjson$/
faraday.request faraday_logger if faraday_logger
faraday.adapter :test, faraday_stubs
end
end

Expand Down

0 comments on commit 09cc4e6

Please sign in to comment.