New Upstream Release - ruby-sawyer

Ready changes

Summary

Merged new upstream version: 0.9.2 (was: 0.8.2).

Resulting package

Built on 2022-12-14T03:05 (took 3m13s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-releases ruby-sawyer

Lintian Result

Diff

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..3398f53
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,32 @@
+name: CI
+
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+
+env:
+  GIT_COMMIT_SHA: ${{ github.sha }}
+  GIT_BRANCH: ${{ github.ref }}
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    env:
+      FARADAY_VERSION: ${{ matrix.faraday }}
+    strategy:
+      fail-fast: false
+      matrix:
+        ruby: [ '2.6', '2.7', '3.0', '3.1', 'truffleruby', 'jruby' ]
+        faraday: [ '~> 0.17.3', '~> 1.0', '~> 2.0' ]
+
+    steps:
+      - uses: actions/checkout@v2
+      - uses: ruby/setup-ruby@v1
+        with:
+          ruby-version: ${{ matrix.ruby }}
+          bundler-cache: true
+
+      - name: Test
+        continue-on-error: ${{ contains(fromJson('["truffleruby", "jruby"]'), matrix.ruby) }}
+        run: bundle exec rake
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index fb7b6d6..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-language: ruby
-cache: bundler
-
-rvm:
-  - jruby
-  - rbx-2
-  - 2.3
-  - 2.4
-  - 2.5
-  - 2.6
-
-matrix:
-  allow_failures:
-    - rvm: rbx-2
-    - rvm: jruby
-
-notifications:
-  emails: false
diff --git a/Gemfile b/Gemfile
index b842735..23775a7 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,8 +1,13 @@
 source "http://rubygems.org"
 
 gemspec
-gem 'rake'
+
+gem "rake"
 
 group :test do
   gem "minitest"
 end
+
+install_if -> { ENV["FARADAY_VERSION"] } do
+  gem "faraday", ENV["FARADAY_VERSION"]
+end
diff --git a/debian/changelog b/debian/changelog
index effc3e4..4bd91ab 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+ruby-sawyer (0.9.2-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Wed, 14 Dec 2022 03:02:53 -0000
+
 ruby-sawyer (0.8.2-2) unstable; urgency=medium
 
   * Team Upload
diff --git a/lib/sawyer.rb b/lib/sawyer.rb
index ab3bbb8..8eb31b0 100644
--- a/lib/sawyer.rb
+++ b/lib/sawyer.rb
@@ -1,5 +1,5 @@
 module Sawyer
-  VERSION = "0.8.2"
+  VERSION = "0.9.2"
 
   class Error < StandardError; end
 end
diff --git a/lib/sawyer/agent.rb b/lib/sawyer/agent.rb
index 7555fac..61acac9 100644
--- a/lib/sawyer/agent.rb
+++ b/lib/sawyer/agent.rb
@@ -48,6 +48,11 @@ module Sawyer
       yield @conn if block_given?
     end
 
+    # Public: Close the underlying connection.
+    def close
+      @conn.close if @conn.respond_to?(:close)
+    end
+
     # Public: Retains a reference to the root relations of the API.
     #
     # Returns a Sawyer::Relation::Map.
diff --git a/lib/sawyer/resource.rb b/lib/sawyer/resource.rb
index c25d52d..a090c87 100644
--- a/lib/sawyer/resource.rb
+++ b/lib/sawyer/resource.rb
@@ -1,9 +1,12 @@
+require 'forwardable'
+
 module Sawyer
   class Resource
     SPECIAL_METHODS = Set.new(%w(agent rels fields))
     attr_reader :_agent, :_rels, :_fields
     attr_reader :attrs
     include Enumerable
+    extend Forwardable
 
     # Initializes a Resource with the given data.
     #
@@ -69,6 +72,8 @@ module Sawyer
       nil
     end
 
+    def_delegators :attrs, :dig, :fetch
+
     ATTR_SETTER    = '='.freeze
     ATTR_PREDICATE = '?'.freeze
 
diff --git a/sawyer.gemspec b/sawyer.gemspec
index 1423dd0..fe171d8 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', '>= 0.17.3', '< 3'
   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 @@ module Sawyer
       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
diff --git a/test/resource_test.rb b/test/resource_test.rb
index 15387ee..d801081 100644
--- a/test/resource_test.rb
+++ b/test/resource_test.rb
@@ -22,6 +22,25 @@ module Sawyer
       assert res.fields.include?(:a)
     end
 
+    def test_dig
+      res = Resource.new @agent, :a => {:b => 1},
+        :_links => {:self => {:href => '/'}}
+
+      assert_equal 1, res.dig(:a, :b)
+      assert_nil res.dig(:a, :c)
+      assert_nil res.dig(:a, :c, :d)
+    end
+
+    def test_fetch
+      res = Resource.new @agent, :a => 1,
+        :_links => {:self => {:href => '/'}}
+
+      assert_equal 1, res.fetch(:a)
+      assert_equal 2, res.fetch(:b, 2)
+      assert_equal 3, res.fetch(:b) { 3 }
+      assert_raises(KeyError) { res.fetch(:b) }
+    end
+
     def test_clashing_keys
       res = Resource.new @agent, :agent => 1, :rels => 2, :fields => 3,
         :_links => {:self => {:href => '/'}}

Debdiff

[The following lists of changes regard files as different if they have different names, permissions or owners.]

Files in second set of .debs but not in first

-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.9.2/lib/sawyer.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.9.2/lib/sawyer/agent.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.9.2/lib/sawyer/link_parsers/hal.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.9.2/lib/sawyer/link_parsers/simple.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.9.2/lib/sawyer/relation.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.9.2/lib/sawyer/resource.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.9.2/lib/sawyer/response.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.9.2/lib/sawyer/serializer.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/specifications/sawyer-0.9.2.gemspec
-rwxr-xr-x  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.9.2/script/bootstrap
-rwxr-xr-x  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.9.2/script/console
-rwxr-xr-x  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.9.2/script/package
-rwxr-xr-x  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.9.2/script/release
-rwxr-xr-x  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.9.2/script/test

Files in first set of .debs but not in second

-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.8.2/lib/sawyer.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.8.2/lib/sawyer/agent.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.8.2/lib/sawyer/link_parsers/hal.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.8.2/lib/sawyer/link_parsers/simple.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.8.2/lib/sawyer/relation.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.8.2/lib/sawyer/resource.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.8.2/lib/sawyer/response.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.8.2/lib/sawyer/serializer.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/specifications/sawyer-0.8.2.gemspec
-rwxr-xr-x  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.8.2/script/bootstrap
-rwxr-xr-x  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.8.2/script/console
-rwxr-xr-x  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.8.2/script/package
-rwxr-xr-x  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.8.2/script/release
-rwxr-xr-x  root/root   /usr/share/rubygems-integration/all/gems/sawyer-0.8.2/script/test

Control files: lines which differ (wdiff format)

  • Depends: ruby-faraday (>> 0.8), (>= 0.17.3), ruby-faraday (<< 2.0), 3), ruby-addressable (>= 2.3.5)
  • Ruby-Versions: all

More details

Full run details