relax 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e9a6f87140b7758340b4a69166c801d0953f84bb0f820f23d3d817e281985d4c
4
+ data.tar.gz: a11fd29fd730571425e4c4160e04a199e94cbab9488babd5485e8012454a694c
5
+ SHA512:
6
+ metadata.gz: 950f73a57eb7f5f7373c862e150a323814d5aba741b9ea4c62aed447f8cd9bb2dea48f8cb0213d8ee74c8e527853514bab77353ae7d16916b53c1c2a9508fcbb
7
+ data.tar.gz: e0e08e5b49c6b926d79e8910762e56cd73f0762b789fc22149c95038d6250bf0fec294205872979af7d71edbcc878ebe3ee999999f569e9adbad40ea490e8f09
@@ -0,0 +1,36 @@
1
+ name: Build
2
+ on:
3
+ - push
4
+ - pull_request
5
+
6
+ jobs:
7
+ build:
8
+ name: Ruby ${{ matrix.ruby }} / Faraday ${{ matrix.faraday }}
9
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ ruby:
14
+ - "2.6"
15
+ - "2.7"
16
+ - "3.0"
17
+ - "3.1"
18
+ faraday:
19
+ - "2.0"
20
+ - "2.7"
21
+
22
+ runs-on: "ubuntu-latest"
23
+
24
+ env:
25
+ BUNDLE_GEMFILE: gemfiles/faraday_${{ matrix.faraday }}.gemfile
26
+ RUBYOPT: "--disable-error_highlight"
27
+
28
+ steps:
29
+ - uses: actions/checkout@v2
30
+ - uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby }}
33
+ - name: Setup project
34
+ run: bundle install
35
+ - name: Run tests
36
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -10,6 +10,7 @@ _yardoc
10
10
  bin
11
11
  coverage
12
12
  doc
13
+ gemfiles/*.lock
13
14
  lib/bundler/man
14
15
  pkg
15
16
  rdoc
data/.rspec CHANGED
@@ -1,2 +1 @@
1
- --color
2
- --format progress
1
+ --require spec_helper
data/Appraisals ADDED
@@ -0,0 +1,7 @@
1
+ appraise "faraday-2.0" do
2
+ gem "faraday", "2.0.1"
3
+ end
4
+
5
+ appraise "faraday-2.7" do
6
+ gem "faraday", "2.7.1"
7
+ end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0 - November 17, 2022
4
+
5
+ * Support Faraday ~> 2.0
6
+ * Require Ruby >= 2.6
7
+
3
8
  ## 0.2.2 – June 7, 2012
4
9
 
5
10
  * Move default configuration into `Config`.
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "faraday", "2.0.1"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "faraday", "2.7.1"
6
+
7
+ gemspec path: "../"
data/lib/relax/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Relax
2
- VERSION = '0.2.2'
2
+ VERSION = '0.3.0'
3
3
  end
data/relax.gemspec CHANGED
@@ -1,19 +1,21 @@
1
1
  require './lib/relax/version'
2
2
 
3
- Gem::Specification.new do |gem|
4
- gem.name = 'relax'
5
- gem.version = Relax::VERSION
6
- gem.summary = 'A flexible library for creating web service consumers.'
7
- gem.homepage = 'http://github.com/tylerhunt/relax'
8
- gem.author = 'Tyler Hunt'
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'relax'
5
+ spec.version = Relax::VERSION
6
+ spec.authors = ['Tyler Hunt']
7
+ spec.summary = 'A flexible library for creating web service consumers.'
8
+ spec.homepage = 'http://github.com/tylerhunt/relax'
9
+ spec.license = 'MIT'
9
10
 
10
- gem.required_ruby_version = '>= 1.9'
11
+ spec.required_ruby_version = '>= 2.6'
11
12
 
12
- gem.add_dependency 'faraday', '~> 0.8.0'
13
- gem.add_development_dependency 'rspec', '~> 2.6'
13
+ spec.add_dependency 'faraday', '~> 2.0'
14
+ spec.add_development_dependency 'rspec', '~> 3.12'
15
+ spec.add_development_dependency 'appraisal', '~> 2.4'
14
16
 
15
- gem.files = `git ls-files`.split($\)
16
- gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
17
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
- gem.require_paths = ['lib']
17
+ spec.files = `git ls-files`.split($\)
18
+ spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ['lib']
19
21
  end
@@ -1,31 +1,24 @@
1
- require 'spec_helper'
2
-
3
- describe Relax::Client do
4
- let(:client) { Class.new { include Relax::Client }.new }
5
-
6
- subject { client }
1
+ RSpec.describe Relax::Client do
2
+ subject(:client) { Class.new { include Relax::Client }.new }
7
3
 
8
4
  context '#config' do
9
5
  it 'returns an instance of Relax::Config' do
10
- subject.config.should be_a(Relax::Config)
6
+ expect(client.config).to be_a Relax::Config
11
7
  end
12
8
 
13
9
  it 'memoizes the configuration' do
14
- subject.config.should == subject.config
10
+ expect(client.config).to eq client.config
15
11
  end
16
12
  end
17
13
 
18
14
  context '#configure' do
19
15
  it 'yields an instance of the configuration' do
20
- expect {
21
- subject.configure do |config|
22
- config.base_uri = 'http://api.example.com/v2'
23
- end
24
- }.to change(subject.config, :base_uri).to('http://api.example.com/v2')
16
+ expect { |block| client.configure &block }
17
+ .to yield_with_args(client.config)
25
18
  end
26
19
 
27
20
  it 'returns self' do
28
- subject.configure { }.should == client
21
+ expect(client.configure {}).to eq client
29
22
  end
30
23
  end
31
24
  end
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe Relax::Config do
1
+ RSpec.describe Relax::Config do
4
2
  {
5
3
  USER_AGENT: "Relax Ruby Gem Client #{Relax::VERSION}",
6
4
  TIMEOUT: 60
@@ -8,18 +6,33 @@ describe Relax::Config do
8
6
  context "::#{constant}" do
9
7
  subject { described_class.const_get(constant) }
10
8
 
11
- it { should == value }
9
+ it { is_expected.to eq value }
10
+ end
11
+ end
12
+
13
+ subject(:config) { described_class.new }
14
+
15
+ context '#adapter' do
16
+ it 'defaults to Faraday’s default adapter' do
17
+ expect(config.adapter).to eq Faraday.default_adapter
12
18
  end
13
19
  end
14
20
 
15
- context '.new' do
16
- subject { described_class.new }
21
+ context '#base_uri' do
22
+ it 'defaults to nil' do
23
+ expect(config.base_uri).to be_nil
24
+ end
25
+ end
26
+
27
+ context '#adapter' do
28
+ it 'has a default value' do
29
+ expect(config.timeout).to eq 60
30
+ end
31
+ end
17
32
 
18
- context 'defaults' do
19
- its(:adapter) { should == Faraday.default_adapter }
20
- its(:base_uri) { should be_nil }
21
- its(:timeout) { should == 60 }
22
- its(:user_agent) { should == "Relax Ruby Gem Client #{Relax::VERSION}" }
33
+ context '#adapter' do
34
+ it 'has a default value' do
35
+ expect(config.user_agent).to eq "Relax Ruby Gem Client #{Relax::VERSION}"
23
36
  end
24
37
  end
25
38
  end
@@ -1,31 +1,24 @@
1
- require 'spec_helper'
2
-
3
- describe Relax::Configurable do
4
- let(:configurable) { Class.new { include Relax::Configurable }.new }
5
-
6
- subject { configurable }
1
+ RSpec.describe Relax::Configurable do
2
+ subject(:configurable) { Class.new { include Relax::Configurable }.new }
7
3
 
8
4
  context '#config' do
9
5
  it 'returns an instance of Relax::Config' do
10
- subject.config.should be_a(Relax::Config)
6
+ expect(configurable.config).to be_a Relax::Config
11
7
  end
12
8
 
13
9
  it 'memoizes the configuration' do
14
- subject.config.should == subject.config
10
+ expect(configurable.config).to eq configurable.config
15
11
  end
16
12
  end
17
13
 
18
14
  context '#configure' do
19
15
  it 'yields an instance of the configuration' do
20
- expect {
21
- subject.configure do |config|
22
- config.base_uri = 'http://api.example.com/v2'
23
- end
24
- }.to change(subject.config, :base_uri).to('http://api.example.com/v2')
16
+ expect { |block| configurable.configure &block }
17
+ .to yield_with_args(configurable.config)
25
18
  end
26
19
 
27
20
  it 'returns self' do
28
- subject.configure { }.should == configurable
21
+ expect(configurable.configure {}).to eq configurable
29
22
  end
30
23
  end
31
24
  end
@@ -1,9 +1,7 @@
1
- require 'spec_helper'
2
-
3
- describe Relax::Delegator do
1
+ RSpec.describe Relax::Delegator do
4
2
  let(:client) { Class.new { include Relax::Client } }
5
3
 
6
- subject do
4
+ subject(:delegator) do
7
5
  Class.new do
8
6
  extend Relax::Delegator[:client]
9
7
 
@@ -13,19 +11,20 @@ describe Relax::Delegator do
13
11
  end
14
12
  end
15
13
 
16
- before { subject.client = client.new }
14
+ before { delegator.client = client.new }
17
15
 
18
16
  context '.[]' do
19
17
  it 'accepts a client method name and returns a module' do
20
- described_class[:client].should be_a(Module)
18
+ expect(described_class[:client]).to be_a Module
21
19
  end
22
20
  end
23
21
 
24
22
  context 'delegation' do
25
23
  Relax::Client.instance_methods.each do |method|
26
24
  it "delegates .#{method} to the client" do
27
- subject.client.should_receive(method)
28
- subject.send(method)
25
+ expect(delegator.client).to receive(method)
26
+
27
+ delegator.send method
29
28
  end
30
29
  end
31
30
  end
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe Relax::Resource do
1
+ RSpec.describe Relax::Resource do
4
2
  let(:client) do
5
3
  Class.new do
6
4
  include Relax::Client
@@ -13,7 +11,7 @@ describe Relax::Resource do
13
11
 
14
12
  let(:resource_class) { Class.new { include Relax::Resource } }
15
13
 
16
- subject { resource_class.new(client) }
14
+ subject(:resource) { resource_class.new(client) }
17
15
 
18
16
  context '.new' do
19
17
  it 'accepts an options hash' do
@@ -22,42 +20,50 @@ describe Relax::Resource do
22
20
  end
23
21
 
24
22
  context '#connection' do
25
- let(:connection) { subject.send(:connection) }
23
+ let(:connection) { resource.send(:connection) }
26
24
 
27
25
  it 'returns an instance of Faraday::Connection' do
28
- connection.should be_a(Faraday::Connection)
26
+ expect(connection).to be_a Faraday::Connection
29
27
  end
30
28
 
31
29
  it 'uses the configured base URI as the URL' do
32
- connection.url_prefix.should == URI.parse(client.config.base_uri)
30
+ expect(connection.url_prefix).to eq URI.parse(client.config.base_uri)
33
31
  end
34
32
 
35
33
  it 'uses the configured timeout' do
36
- connection.options[:timeout].should == client.config.timeout
34
+ expect(connection.options[:timeout]).to eq client.config.timeout
37
35
  end
38
36
 
39
37
  it 'accepts an options hash to be passed to Faraday::Connection' do
40
38
  headers = { user_agent: "#{described_class} Test" }
41
- connection = subject.send(:connection, headers: headers)
42
- connection.headers['User-Agent'].should == headers[:user_agent]
39
+ connection = resource.send(:connection, headers: headers)
40
+
41
+ expect(connection.headers['User-Agent']).to eq headers[:user_agent]
43
42
  end
44
43
 
45
44
  it 'yields a builder to allow the middleware to be customized' do
46
- subject.send(:connection) do |builder|
47
- builder.use(Faraday::Response::Logger)
48
- end.builder.handlers.should include(Faraday::Response::Logger)
45
+ connection = resource.send(:connection) { |builder|
46
+ builder.use Faraday::Response::Logger
47
+ }
48
+
49
+ expect(connection.builder.handlers).to include Faraday::Response::Logger
49
50
  end
50
51
  end
51
52
 
52
53
  context 'connection delegation' do
53
- let(:connection) { stub(:connection) }
54
+ let(:connection) { double(:connection) }
54
55
 
55
- before { subject.stub(:connection).and_return(connection) }
56
+ before do
57
+ allow(resource)
58
+ .to receive(:connection)
59
+ .and_return(connection)
60
+ end
56
61
 
57
62
  Faraday::Connection::METHODS.each do |method|
58
63
  it "delegates ##{method} to #connection" do
59
- connection.should_receive(method)
60
- subject.send(method)
64
+ expect(connection).to receive(method)
65
+
66
+ resource.send method
61
67
  end
62
68
  end
63
69
  end
data/spec/spec_helper.rb CHANGED
@@ -5,7 +5,6 @@ Dir[File.expand_path('../support/**/*.rb', __FILE__)].each do |file|
5
5
  end
6
6
 
7
7
  RSpec.configure do |config|
8
- config.treat_symbols_as_metadata_keys_with_true_values = true
9
8
  config.run_all_when_everything_filtered = true
10
9
  config.filter_run :focus
11
10
  end
metadata CHANGED
@@ -1,57 +1,68 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tyler Hunt
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-06-07 00:00:00.000000000 Z
11
+ date: 2022-11-18 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: faraday
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: 0.8.0
19
+ version: '2.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: 0.8.0
26
+ version: '2.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: '2.6'
33
+ version: '3.12'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
- version: '2.6'
46
- description:
47
- email:
40
+ version: '3.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: appraisal
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.4'
55
+ description:
56
+ email:
48
57
  executables: []
49
58
  extensions: []
50
59
  extra_rdoc_files: []
51
60
  files:
52
- - .gitignore
53
- - .rspec
54
- - .travis.yml
61
+ - ".github/workflows/build.yml"
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Appraisals
55
66
  - CHANGELOG.md
56
67
  - Gemfile
57
68
  - LICENSE
@@ -60,6 +71,8 @@ files:
60
71
  - examples/delicious.rb
61
72
  - examples/flickr.rb
62
73
  - examples/vimeo.rb
74
+ - gemfiles/faraday_2.0.gemfile
75
+ - gemfiles/faraday_2.7.gemfile
63
76
  - lib/relax.rb
64
77
  - lib/relax/client.rb
65
78
  - lib/relax/config.rb
@@ -75,28 +88,27 @@ files:
75
88
  - spec/relax/resource_spec.rb
76
89
  - spec/spec_helper.rb
77
90
  homepage: http://github.com/tylerhunt/relax
78
- licenses: []
79
- post_install_message:
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
80
95
  rdoc_options: []
81
96
  require_paths:
82
97
  - lib
83
98
  required_ruby_version: !ruby/object:Gem::Requirement
84
- none: false
85
99
  requirements:
86
- - - ! '>='
100
+ - - ">="
87
101
  - !ruby/object:Gem::Version
88
- version: '1.9'
102
+ version: '2.6'
89
103
  required_rubygems_version: !ruby/object:Gem::Requirement
90
- none: false
91
104
  requirements:
92
- - - ! '>='
105
+ - - ">="
93
106
  - !ruby/object:Gem::Version
94
107
  version: '0'
95
108
  requirements: []
96
- rubyforge_project:
97
- rubygems_version: 1.8.24
98
- signing_key:
99
- specification_version: 3
109
+ rubygems_version: 3.3.7
110
+ signing_key:
111
+ specification_version: 4
100
112
  summary: A flexible library for creating web service consumers.
101
113
  test_files:
102
114
  - spec/relax/client_spec.rb