diff --git a/lib/sawyer/agent.rb b/lib/sawyer/agent.rb index 7555fac..da5f847 100644 --- a/lib/sawyer/agent.rb +++ b/lib/sawyer/agent.rb @@ -48,6 +48,11 @@ def initialize(endpoint, options = nil) yield @conn if block_given? end + # Public: Close the underlying connection. + def close + @conn.close + end + # Public: Retains a reference to the root relations of the API. # # Returns a Sawyer::Relation::Map. diff --git a/sawyer.gemspec b/sawyer.gemspec index 1423dd0..d4e8e97 100644 --- a/sawyer.gemspec +++ b/sawyer.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |spec| spec.homepage = 'https://github.com/lostisland/sawyer' spec.licenses = ['MIT'] - spec.add_dependency 'faraday', ['> 0.8', '< 2.0'] + spec.add_dependency 'faraday', "~> 1.0" spec.add_dependency 'addressable', ['>= 2.3.5'] spec.files = %w(Gemfile LICENSE.md README.md Rakefile) diff --git a/test/agent_test.rb b/test/agent_test.rb index 0c22a7e..376589e 100644 --- a/test/agent_test.rb +++ b/test/agent_test.rb @@ -22,6 +22,10 @@ def setup end end + def test_close + @agent.close + end + def test_accesses_root_relations @stubs.get '/a/' do |env| assert_equal 'foo.com', env[:url].host