hyperclient 2.0.0 → 2.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '02694a72cb9a16a0faac55b463c859a470bce22f7976b0b77c19da138cceded8'
4
- data.tar.gz: d96697a7e493f29b2a3207850b961664cfa18e0195b526abb16c9c108b2e2bc3
3
+ metadata.gz: a8386e0cfaa50b2ee6b593a3adfbd18d510be2f614ac671eea8b10598c6e95eb
4
+ data.tar.gz: 16065c923d08bdeefd62f778052ac587362dd1dafa67f037524ca9c2b5b2c221
5
5
  SHA512:
6
- metadata.gz: 45bb98cc9a22fd721c71f32a4e7b2634610279fe66a8466d6f2339efb994853896ed33867baa3e460cd805055b2b2611108d703f7c7788b952ef3693393140fd
7
- data.tar.gz: c3c47fee4c97362f31c40a8923eec8c7573be28e215a43bdaac89c44e573cd93cec57291932718dd1bd136689c9f46f1ceff2ace244d613d76871cf9e7529df6
6
+ metadata.gz: b0bd84465e74d3eb2b7b9f0e2c5c9141a58c2f107390ca1da5d4742ff6420875abbd3d637ccfd67fc053503868b14e7129a6ba49020457f0715ffd5d92addd60
7
+ data.tar.gz: 0d6e6116a470e3720f0789fdb072b041955685135b667982fa1153a010106b860a2828363cceca09a5f43b66271336d92a90adc6e6395030272d64d32809b8c5
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: coverage
3
- on: [push, pull_request]
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
4
11
 
5
12
  env:
6
13
  COVERAGE: 1
@@ -9,16 +16,13 @@ jobs:
9
16
  build:
10
17
  runs-on: ubuntu-latest
11
18
  steps:
12
- - uses: actions/checkout@v3
13
- - name: Install Ruby (2.7)
14
- uses: ruby/setup-ruby@v1
19
+ - uses: actions/checkout@v7
20
+ - uses: ruby/setup-ruby@v1
15
21
  with:
16
- ruby-version: 2.7
22
+ ruby-version: '4.0'
17
23
  bundler-cache: true
18
- - name: Build and test with RSpec
19
- run: |
20
- bundle exec rake test
21
- - name: Coveralls
22
- uses: coverallsapp/github-action@master
24
+ - run: |
25
+ bundle exec rake test spinach
26
+ - uses: coverallsapp/github-action@v2
23
27
  with:
24
28
  github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,18 @@
1
+ name: Danger Comment
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: [Danger]
6
+ types: [completed]
7
+
8
+ permissions:
9
+ actions: read # download artifacts
10
+ issues: write # list + create/update comments
11
+ pull-requests: write # PR comment access
12
+
13
+ jobs:
14
+ comment:
15
+ uses: danger/danger-pr-comment/.github/workflows/danger-comment.yml@v0.3.0
16
+ secrets: inherit
17
+ with:
18
+ comment-empty: false
@@ -1,22 +1,13 @@
1
- ---
2
- name: danger
1
+ name: Danger
2
+
3
3
  on:
4
4
  pull_request:
5
5
  types: [opened, reopened, edited, synchronize]
6
+
6
7
  jobs:
7
8
  danger:
8
- runs-on: ubuntu-20.04
9
- steps:
10
- - uses: actions/checkout@v3
11
- with:
12
- fetch-depth: 0
13
- - name: Set up Ruby
14
- uses: ruby/setup-ruby@v1
15
- with:
16
- ruby-version: 2.7
17
- bundler-cache: true
18
- - name: Run Danger
19
- run: |
20
- # the personal token is public, this is ok, base64 encode to avoid tripping Github
21
- TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
22
- DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
9
+ uses: danger/danger-pr-comment/.github/workflows/danger-run.yml@v0.3.0
10
+ secrets: inherit
11
+ with:
12
+ ruby-version: '4.0'
13
+ bundler-cache: true
@@ -1,16 +1,23 @@
1
1
  name: lint
2
- on: [push, pull_request]
2
+ on:
3
+ push:
4
+ branches: [master]
5
+ pull_request:
6
+
7
+ concurrency:
8
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
9
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
3
10
  jobs:
4
11
  rubocop:
5
12
  name: RuboCop
6
13
  runs-on: ubuntu-latest
7
14
  steps:
8
15
  - name: Checkout
9
- uses: actions/checkout@v3
16
+ uses: actions/checkout@v7
10
17
  - name: Set up Ruby
11
18
  uses: ruby/setup-ruby@v1
12
19
  with:
13
- ruby-version: '2.7'
20
+ ruby-version: '4.0'
14
21
  bundler-cache: true
15
22
  - run: bundle exec rubocop
16
23
 
@@ -0,0 +1,26 @@
1
+ name: Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: Optional release version overriding the checked-in version.
8
+ type: string
9
+ required: false
10
+ dry-run:
11
+ description: Check release prerequisites without releasing.
12
+ type: boolean
13
+ default: false
14
+
15
+ permissions:
16
+ contents: write
17
+ id-token: write
18
+
19
+ jobs:
20
+ release:
21
+ uses: dblock/ruby-gem-release/.github/workflows/release.yml@v0.9.0
22
+ with:
23
+ ruby-version: '4.0'
24
+ gemfile: gemfiles/release.gemfile
25
+ version: ${{ inputs.version }}
26
+ dry-run: ${{ inputs.dry-run }}
@@ -1,23 +1,39 @@
1
1
  ---
2
2
  name: test
3
- on: [push, pull_request]
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
4
11
  jobs:
5
12
  test:
6
- runs-on: ubuntu-latest
13
+ runs-on: ${{ matrix.entry.os || 'ubuntu-latest' }}
7
14
  strategy:
8
15
  fail-fast: false
9
16
  matrix:
10
17
  entry:
18
+ - { ruby: '4.0' }
19
+ - { ruby: '3.4' }
20
+ - { ruby: '3.2', json: '2' }
11
21
  - { ruby: '3.2' }
12
- - { ruby: '2.7' }
22
+ - { ruby: '2.7', json: '2', os: 'ubuntu-22.04' }
13
23
  - { ruby: 'ruby-head', allowed-failure: true }
14
24
  - { ruby: 'jruby-head', allowed-failure: true }
15
- name: test (${{ matrix.entry.ruby }})
25
+ name: test (Ruby ${{ matrix.entry.ruby }}, JSON ${{ matrix.entry.json || '3' }})
26
+ env:
27
+ JSON_VERSION: ${{ matrix.entry.json || '3' }}
28
+ # Speeds up JRuby startup, which dominates its bundle and test steps. CRuby ignores it.
29
+ JRUBY_OPTS: --dev
16
30
  steps:
17
- - uses: actions/checkout@v3
31
+ - uses: actions/checkout@v7
18
32
  - uses: ruby/setup-ruby@v1
19
33
  with:
20
34
  ruby-version: ${{ matrix.entry.ruby }}
21
35
  bundler-cache: true
36
+ # Gemfile.lock isn't committed, so keep JSON 2 and JSON 3 bundles from restoring each other's cache.
37
+ cache-version: json-${{ matrix.entry.json || '3' }}
22
38
  - run: bundle exec rake test spinach
23
39
  continue-on-error: ${{ matrix.entry.allowed-failure || false }}
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  *.gem
2
+ .DS_Store
2
3
  *.rbc
3
4
  .bundle
4
5
  .config
@@ -16,3 +17,5 @@ test/version_tmp
16
17
  tmp
17
18
  examples/william.rb
18
19
  Gemfile.lock
20
+ gemfiles/*.lock
21
+ vendor/bundle
data/.rubocop.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
- require:
3
+ plugins:
4
4
  - rubocop-rake
5
5
  - rubocop-minitest
6
6
 
data/.rubocop_todo.yml CHANGED
@@ -1,14 +1,13 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2024-02-01 15:28:54 UTC using RuboCop version 1.48.1.
3
+ # on 2025-09-10 13:55:47 UTC using RuboCop version 1.80.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 1
10
- # Configuration parameters: Severity, Include.
11
- # Include: **/*.gemspec
10
+ # Configuration parameters: Severity.
12
11
  Gemspec/RequiredRubyVersion:
13
12
  Exclude:
14
13
  - 'hyperclient.gemspec'
@@ -20,6 +19,7 @@ Lint/EmptyBlock:
20
19
  - 'test/hyperclient/entry_point_test.rb'
21
20
 
22
21
  # Offense count: 4
22
+ # Configuration parameters: AllowedParentClasses.
23
23
  Lint/MissingSuper:
24
24
  Exclude:
25
25
  - 'lib/hyperclient/attributes.rb'
@@ -29,16 +29,19 @@ Lint/MissingSuper:
29
29
 
30
30
  # Offense count: 1
31
31
  # This cop supports unsafe autocorrection (--autocorrect-all).
32
- # Configuration parameters: AllowedMethods.
32
+ # Configuration parameters: AllowedMethods, InferNonNilReceiver, AdditionalNilMethods.
33
33
  # AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?
34
+ # AdditionalNilMethods: present?, blank?, try, try!
34
35
  Lint/RedundantSafeNavigation:
35
36
  Exclude:
36
37
  - 'lib/hyperclient/link.rb'
37
38
 
38
39
  # Offense count: 3
39
40
  # This cop supports unsafe autocorrection (--autocorrect-all).
40
- # Configuration parameters: EnforcedStyle.
41
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForClasses, EnforcedStyleForModules.
41
42
  # SupportedStyles: nested, compact
43
+ # SupportedStylesForClasses: ~, nested, compact
44
+ # SupportedStylesForModules: ~, nested, compact
42
45
  Style/ClassAndModuleChildren:
43
46
  Exclude:
44
47
  - 'features/steps/api_navigation.rb'
data/AGENTS.md ADDED
@@ -0,0 +1,26 @@
1
+ # Agent Guide
2
+
3
+ Hyperclient is a Ruby client for JSON HAL APIs, built on Faraday 2 and `faraday_hal_middleware`.
4
+
5
+ ## Layout
6
+
7
+ - `lib/hyperclient.rb`: client entry point and configuration.
8
+ - `lib/hyperclient/`: resources, links, collections, attributes, and CURIEs.
9
+ - `test/`: Minitest tests and fixtures.
10
+ - `features/`: Spinach acceptance tests and supporting code.
11
+ - `examples/`: runnable usage examples.
12
+
13
+ ## Commands
14
+
15
+ ```sh
16
+ bundle install
17
+ bundle exec rake # Minitest, Spinach, and RuboCop
18
+ bundle exec rake test # Minitest only
19
+ bundle exec rake spinach # Acceptance tests only
20
+ bundle exec rake rubocop # Lint
21
+ bundle exec ruby -Itest test/hyperclient_test.rb
22
+ ```
23
+
24
+ ## Changes
25
+
26
+ Follow existing Ruby conventions and preserve Ruby 2.7 compatibility. Add regression tests for behavior changes; use existing HTTP stubs rather than depending on external services. Update the README for public API changes and the changelog with the pull request number. See `CONTRIBUTING.md` for the full contribution workflow and `.github/workflows/` for the CI matrix.
data/CHANGELOG.md CHANGED
@@ -1,10 +1,31 @@
1
1
  ## Changelog
2
2
 
3
+ ### 2.2.0 (2026/11/22)
4
+
5
+ * [#333](https://github.com/codegram/hyperclient/pull/333): Updated danger-pr-comment to 0.2.0 and fixed the hash conversion assertion for Minitest 6.1 - [@dblock](https://github.com/dblock).
6
+ * [#334](https://github.com/codegram/hyperclient/pull/334): Added `Link#_query` to send query parameters that a link doesn't declare - [@dblock](https://github.com/dblock).
7
+ * [#336](https://github.com/codegram/hyperclient/pull/336): Fixed `SystemStackError` when iterating a link whose resource links back to itself under the same name, raising `Hyperclient::SelfReferencingLinkError` instead - [@dblock](https://github.com/dblock).
8
+ * [#337](https://github.com/codegram/hyperclient/pull/337): Updated danger-pr-comment to 0.3.0 and stopped posting empty Danger reports - [@dblock](https://github.com/dblock).
9
+ * [#338](https://github.com/codegram/hyperclient/pull/338): Documented link properties, including HAL `profile` via `Link#_profile` - [@dblock](https://github.com/dblock).
10
+ * [#339](https://github.com/codegram/hyperclient/pull/339): Sped up CI by running JRuby with `--dev`, separating JSON 2 and JSON 3 bundler caches, skipping duplicate branch builds, and updating `actions/checkout` to v7 - [@dblock](https://github.com/dblock).
11
+ * [#340](https://github.com/codegram/hyperclient/pull/340): Added `Link#_allow`, `Link#_allow?`, `Resource#_allow` and `Resource#_allow?` to read the `Allow` header, and an opt-in `enforce_allowed_methods` setting that raises `Hyperclient::MethodNotAllowedError` instead of sending a method the link's most recent response disallowed - [@dblock](https://github.com/dblock).
12
+ * [#341](https://github.com/codegram/hyperclient/pull/341): Added a Release workflow using [ruby-gem-release](https://github.com/dblock/ruby-gem-release) and RubyGems Trusted Publishing, and disabled the local `rake release` task - [@dblock](https://github.com/dblock).
13
+
14
+ ### 2.1.0 (2026/10/14)
15
+
16
+ * [#328](https://github.com/codegram/hyperclient/pull/328): Replaced the retired Splines demo with a local read-only Oxford HAL example using archived place facts - [@dblock](https://github.com/dblock).
17
+ * [#298](https://github.com/codegram/hyperclient/pull/300): Upgraded RuboCop to 1.80.2 - [@dblock](https://github.com/dblock).
18
+ * [#298](https://github.com/codegram/hyperclient/pull/298): Upgraded RuboCop to 1.63.5 - [@dblock](https://github.com/dblock).
19
+ * [#319](https://github.com/codegram/hyperclient/pull/319): Fixed `Resource#to_h` returning `nil` instead of the same result as `#to_hash` - [@dblock](https://github.com/dblock).
20
+ * [#320](https://github.com/codegram/hyperclient/pull/320): Documented how to handle non-`hal+json` responses via the Faraday response middleware's `content_type` matcher - [@dblock](https://github.com/dblock).
21
+ * [#321](https://github.com/codegram/hyperclient/pull/321): Added Ruby 4.0 to the CI test matrix - [@dblock](https://github.com/dblock).
22
+ * [#322](https://github.com/codegram/hyperclient/pull/322): Fixed `Link` caching a mutating request's (`_post`/`_put`/`_patch`/`_delete`) response as its resource, causing subsequent reads (e.g. `#each`, `method_missing`) to return stale data instead of a fresh `_get` - [@dblock](https://github.com/dblock).
23
+ * [#325](https://github.com/codegram/hyperclient/pull/325): Added JSON 2.x/3.x to the CI matrix and JSON response parsing regression tests, retaining Ruby 2.7 coverage with JSON 2.x; upgraded RuboCop to 1.91.0 to allow JSON 3.x - [@dblock](https://github.com/dblock).
3
24
  ### 2.0.0 (2024/02/01)
4
25
 
5
26
  * [#268](https://github.com/codegram/hyperclient/pull/268): Replace Travis-CI with GHA - [@dblock](https://github.com/dblock).
6
27
  * [#269](https://github.com/codegram/hyperclient/pull/269): Re-add code coverage - [@dblock](https://github.com/dblock).
7
- * [#270](https://github.com/codegram/hyperclient/pull/270): Upgrade Rubocop to 1.45 - [@dblock](https://github.com/dblock).
28
+ * [#270](https://github.com/codegram/hyperclient/pull/270): Upgrade RuboCop to 1.45 - [@dblock](https://github.com/dblock).
8
29
  * [#271](https://github.com/codegram/hyperclient/pull/271): Test against Ruby 3.2 - [@dblock](https://github.com/dblock).
9
30
  * [#285](https://github.com/codegram/hyperclient/pull/285): Support Faraday 2.x - [@dblock](https://github.com/dblock).
10
31
 
@@ -39,14 +60,14 @@
39
60
  ### 0.9.0 (2018/01/10)
40
61
 
41
62
  * [#133](https://github.com/codegram/hyperclient/pull/133): Removed futuroscope - [@dblock](https://github.com/dblock).
42
- * [#131](https://github.com/codegram/hyperclient/pull/131): Upgrade to Rubocop 0.50.0, fix Bundler's insecure git source warning - [@nebolsin](https://github.com/nebolsin).
63
+ * [#131](https://github.com/codegram/hyperclient/pull/131): Upgrade to RuboCop 0.50.0, fix Bundler's insecure git source warning - [@nebolsin](https://github.com/nebolsin).
43
64
  * [#132](https://github.com/codegram/hyperclient/pull/132): Swapped yard dependency for danger-toc - [@dblock](https://github.com/dblock).
44
65
 
45
66
  ### 0.8.6 (2017/08/27)
46
67
 
47
68
  * [#122](https://github.com/codegram/hyperclient/pull/122): Improve error message when server returns invalid data - [@ivoanjo](https://github.com/ivoanjo).
48
69
  * [#125](https://github.com/codegram/hyperclient/pull/125): Add table of contents to readme and add note asking users to add their projects to the wiki - [@ivoanjo](https://github.com/ivoanjo).
49
- * [#127](https://github.com/codegram/hyperclient/pull/127): Minor fixes: Fix warnings, and pry-byebug to dev Gemfile and tweak rubocop execution - [@ivoanjo](https://github.com/ivoanjo).
70
+ * [#127](https://github.com/codegram/hyperclient/pull/127): Minor fixes: Fix warnings, and pry-byebug to dev Gemfile and tweak RuboCop execution - [@ivoanjo](https://github.com/ivoanjo).
50
71
  * [#128](https://github.com/codegram/hyperclient/pull/128): Fix link delegation returning nil for field with value false - [@ivoanjo](https://github.com/ivoanjo).
51
72
 
52
73
  ### 0.8.5 (2017/07/05)
@@ -107,7 +128,7 @@
107
128
  * [#64](https://github.com/codegram/hyperclient/issues/64): Added support for curies - [@dblock](https://github.com/dblock).
108
129
  * [#58](https://github.com/codegram/hyperclient/issues/58): Automatically follow redirects - [@dblock](https://github.com/dblock).
109
130
  * [#63](https://github.com/codegram/hyperclient/pull/63): You can omit the navigational elements, `api.links.products` is now equivalent to `api.products` - [@dblock](https://github.com/dblock).
110
- * [#61](https://github.com/codegram/hyperclient/pull/61): Implemented Rubocop, Ruby-style linter - [@dblock](https://github.com/dblock).
131
+ * [#61](https://github.com/codegram/hyperclient/pull/61): Implemented RuboCop, Ruby-style linter - [@dblock](https://github.com/dblock).
111
132
 
112
133
  ### 0.4.0 (2014/05/05)
113
134
 
data/CONTRIBUTING.md CHANGED
@@ -32,6 +32,16 @@ bundle install
32
32
  bundle exec rake
33
33
  ```
34
34
 
35
+ CI runs the test suites with JSON 2.x on Ruby 2.7, both JSON 2.x and 3.x on Ruby 3.2, and JSON 3.x on Ruby 3.4, Ruby 4.0, and the head builds.
36
+ To select a JSON major version locally, resolve the bundle and run the tests with the same `JSON_VERSION`:
37
+
38
+ ```
39
+ JSON_VERSION=2 bundle update json
40
+ JSON_VERSION=2 bundle exec rake test spinach
41
+ JSON_VERSION=3 bundle update json
42
+ JSON_VERSION=3 bundle exec rake test spinach
43
+ ```
44
+
35
45
  #### Write Tests
36
46
 
37
47
  Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add to [test/hyperclient](test/hyperclient).
data/Dangerfile CHANGED
@@ -1,2 +1,4 @@
1
+ danger.import_dangerfile(gem: 'danger-pr-comment')
2
+
1
3
  changelog.check!
2
4
  toc.check!
data/Gemfile CHANGED
@@ -2,6 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
+ gem 'json', "~> #{ENV['JSON_VERSION']}.0" if ENV['JSON_VERSION']
6
+
5
7
  group :development do
6
8
  gem 'growl'
7
9
  gem 'guard'
@@ -13,19 +15,28 @@ end
13
15
 
14
16
  group :development, :test do
15
17
  gem 'rake'
16
- gem 'rubocop', '~> 1.48.0', require: false
18
+ gem 'rubocop', '~> 1.92.0', require: false
17
19
  gem 'rubocop-minitest', require: false
18
20
  gem 'rubocop-rake', require: false
19
21
  gem 'simplecov', require: false
20
22
  gem 'simplecov-lcov', require: false
23
+ gem 'webrick', '~> 1.8'
21
24
  end
22
25
 
23
26
  group :test do
24
- gem 'danger-changelog', '~> 0.6.0'
25
- gem 'danger-toc', '~> 0.2.0'
26
27
  gem 'minitest'
27
28
  gem 'mocha'
28
29
  gem 'rack-test'
29
30
  gem 'spinach'
30
31
  gem 'webmock'
31
32
  end
33
+
34
+ # Danger runs separately on Ruby 4.0; its plugins require Ruby 3.1+.
35
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1')
36
+ group :danger do
37
+ gem 'danger', '~> 9.5'
38
+ gem 'danger-changelog', '~> 0.10.0'
39
+ gem 'danger-pr-comment', '~> 0.3.0'
40
+ gem 'danger-toc', '~> 0.3.0'
41
+ end
42
+ end