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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +3 -3
- data/lib/rails/rfc6570/version.rb +1 -1
- data/lib/rails/rfc6570.rb +3 -3
- data/spec/rails/rfc6570_spec.rb +15 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3b9e7af3153e5a26e9f9a61c0c31968d2f830abacb236e1827bcac8e506f484
|
4
|
+
data.tar.gz: 1e8c62d9e35f2e68e7b79d6fbef0932be6b762d87095e6f43b686441d50fc052
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
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
|
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
|
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
|
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
|
data/spec/rails/rfc6570_spec.rb
CHANGED
@@ -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
|
|