rails-rfc6570 3.5.0 → 3.5.1

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: 591b65ab2b36b6be29b602386b19553c4a7718390ebc01eaaf328e8efa0059ee
4
- data.tar.gz: 015d4b67acce29b894225cfba3d4964630e7f2c407d1dfc552cb08ce33b43748
3
+ metadata.gz: a3b9e7af3153e5a26e9f9a61c0c31968d2f830abacb236e1827bcac8e506f484
4
+ data.tar.gz: 1e8c62d9e35f2e68e7b79d6fbef0932be6b762d87095e6f43b686441d50fc052
5
5
  SHA512:
6
- metadata.gz: 825329ae62f18baebc5475d3a213404efb6fa00827c933f21698996bbff457908d590926b75987cddbcb8f466fb5408bdd9447d32b19c27dac153473affdc7bd
7
- data.tar.gz: 314f22c74f95539e4e6d1c933d31276069c0fe84852b58a6976aa7d40edfee50291de23e5c2b90c9fb37cb5f5f594c32a3703653f5493c20bdfce74796bad4ef
6
+ metadata.gz: 85e72c2a7b91d1e076a8bf03c6edb115fa77a2e1e84893c896b80af5ac81c4baf6ac8d843c23a9cb017b659888d19e93ca0efb5d36835827102f5e68a43fc3b5
7
+ data.tar.gz: dc660af0bf6f1c901998fa1cc62ecf5e2d4ab41265beaa063f1354577bf555502bc436a0464e123e6f6532fd087f53459f91f04b732ac36e2372969324bbc64c
data/CHANGELOG.md CHANGED
@@ -15,6 +15,14 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a Ch
15
15
 
16
16
  ### Breaks
17
17
 
18
+ ## 3.5.1 - (2025-09-28)
19
+
20
+ ---
21
+
22
+ ### Fixes
23
+
24
+ - Fix up `rfc6570` path helpers to accept hash argument required when calling template from Rails Engine in the main app.
25
+
18
26
  ## 3.5.0 - (2025-09-26)
19
27
 
20
28
  ---
data/README.md CHANGED
@@ -5,14 +5,14 @@
5
5
 
6
6
  Pragmatic access to your Rails routes as RFC6570 URI templates.
7
7
 
8
- Tested with Rails 6.1, 7.0, 7.1, 7.2 and Ruby 2.7, 3.0, 3.1, 3.2, 3.3, and 3.4.
8
+ Tested with Rails 6.1, 7.0, 7.1, 7.2, 8.0 and Ruby 2.7, 3.0, 3.1, 3.2, 3.3, and 3.4.
9
9
 
10
10
  ## Installation
11
11
 
12
12
  Add this line to your application's Gemfile:
13
13
 
14
14
  ```ruby
15
- gem 'rails-rfc6570', '~> 3.0'
15
+ gem 'rails-rfc6570', '~> 3.5'
16
16
  ```
17
17
 
18
18
  ## Usage
@@ -92,7 +92,7 @@ end
92
92
 
93
93
  This gem does not support every construct possible with route matchers especially nested groups cannot be expressed in URI templates. They are expanded into separate groups. It also makes some assumptions when converting splat matchers like swallowing a multiple slashes. An error is raised when routes with OR-clauses are tried to be converted.
94
94
 
95
- You can also combine **Rails::RFC6570** with [rack-link_headers](https://github.com/jgraichen/rack-link_headers) and provide hypermedia linking everywhere!
95
+ You can also combine **Rails::RFC6570** with [`rack-link_headers`](https://github.com/jgraichen/rack-link_headers) and provide hypermedia linking everywhere!
96
96
 
97
97
  ```ruby
98
98
  class UserController < ApplicationController
@@ -5,7 +5,7 @@ module Rails
5
5
  module VERSION
6
6
  MAJOR = 3
7
7
  MINOR = 5
8
- PATCH = 0
8
+ PATCH = 1
9
9
  STAGE = nil
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH, STAGE].compact.join('.').freeze
data/lib/rails/rfc6570.rb CHANGED
@@ -52,15 +52,15 @@ module Rails
52
52
  end
53
53
 
54
54
  mod.module_eval do
55
- define_method(rfc6570_name) do |**opts|
55
+ define_method(rfc6570_name) do |opts = {}|
56
56
  route.to_rfc6570(**opts, ctx: self)
57
57
  end
58
58
 
59
- define_method(rfc6570_url_name) do |**opts|
59
+ define_method(rfc6570_url_name) do |opts = {}|
60
60
  route.to_rfc6570(**opts, ctx: self, path_only: false)
61
61
  end
62
62
 
63
- define_method(rfc6570_path_name) do |**opts|
63
+ define_method(rfc6570_path_name) do |opts = {}|
64
64
  route.to_rfc6570(**opts, ctx: self, path_only: true)
65
65
  end
66
66
  end
@@ -61,6 +61,9 @@ class APIController < ApplicationController
61
61
  partial: test6_rfc6570.partial_expand(title: 'TITLE'),
62
62
  ignore: test6_rfc6570(ignore: %w[title]),
63
63
  expand: test6_rfc6570.expand(capture: %w[a b], title: 'TITLE'),
64
+ engine_template: dummy_engine.action_rfc6570,
65
+ engine_template_url: dummy_engine.action_url_rfc6570,
66
+ engine_template_path: dummy_engine.action_path_rfc6570,
64
67
  }
65
68
  end
66
69
 
@@ -149,6 +152,18 @@ describe Rails::RFC6570, type: :request do
149
152
  expect(json['expand']).to eq "#{host}/path/a/b/TITLE"
150
153
  end
151
154
 
155
+ it 'allows to return and render a rails engines templates' do
156
+ expect(json['engine_template']).to eq "#{host}/dummy_engine/action{?param3}"
157
+ end
158
+
159
+ it 'allows to return and render a rails engines url templates' do
160
+ expect(json['engine_template_url']).to eq "#{host}/dummy_engine/action{?param3}"
161
+ end
162
+
163
+ it 'allows to return and render a rails engines path templates' do
164
+ expect(json['engine_template_path']).to eq '/dummy_engine/action{?param3}'
165
+ end
166
+
152
167
  context 'with origin_script_name' do
153
168
  let(:headers) { {'__OSN' => '/fuubar'} }
154
169
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-rfc6570
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0
4
+ version: 3.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen