rails-rfc6570 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/lib/rails/rfc6570.rb +4 -4
- data/lib/rails/rfc6570/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c3538df57e6f2e93bc183408aa687d64025ffa1
|
4
|
+
data.tar.gz: 51eaaa7663d213772123c3fe490ef837701a6097
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4290fede98b6b52ab1c62b089f379c10a172e4be05457f9f97e772c31240da86d500267d5cd2b6e2352f9de3d9ae6b8e7a712f2ac82baf3cf8a7539bf671d181
|
7
|
+
data.tar.gz: 6e11a3b2143ae63e138a49b119b7c8ba663f3f220945c4dccfdf90c4ff0f6662299828ba2c1c561e5ac4c25cadbd1a7051e4d5015738b31b80a1d94ec67396cb
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Rails::RFC6570
|
2
2
|
|
3
|
-
Pragmatical access to your Rails routes as RFC6570 URI templates.
|
3
|
+
Pragmatical access to your Rails (4.0) routes as RFC6570 URI templates.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -63,9 +63,9 @@ the root action will return something similar to the following JSON:
|
|
63
63
|
|
64
64
|
```json
|
65
65
|
{
|
66
|
-
users: "http://localhost:3000/users{?query,email,active}",
|
67
|
-
user: "http://localhost:3000/users/{id}",
|
68
|
-
root: "http://localhost:3000/"
|
66
|
+
"users": "http://localhost:3000/users{?query,email,active}",
|
67
|
+
"user": "http://localhost:3000/users/{id}",
|
68
|
+
"root": "http://localhost:3000/"
|
69
69
|
}
|
70
70
|
```
|
71
71
|
|
@@ -89,6 +89,8 @@ class UserDecorator < Draper::Decorator
|
|
89
89
|
end
|
90
90
|
```
|
91
91
|
|
92
|
+
This gem does not support every construct possible with route matchers especially nested groups cannot be expressed in URI templates. It also makes some assumptions when converting splat matchers like swallowing a multiple slashes.
|
93
|
+
|
92
94
|
You can also combine **Rails::RFC6570** with [rack-link_headers](https://jgraichen/rack-link_headers) and provide Hypermedia-linking everywhere!
|
93
95
|
|
94
96
|
```ruby
|
data/lib/rails/rfc6570.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'rails/
|
1
|
+
require 'rails/rfc6570/version'
|
2
2
|
|
3
3
|
module ActionDispatch
|
4
4
|
module Journey
|
@@ -27,7 +27,7 @@ module ActionDispatch
|
|
27
27
|
action = route.defaults[:action].to_s
|
28
28
|
|
29
29
|
if controller.present? && action.present?
|
30
|
-
params = Rails::
|
30
|
+
params = Rails::RFC6570.params_for(controller, action)
|
31
31
|
str += '{?' + params.join(',') + '}' if params && params.any?
|
32
32
|
end
|
33
33
|
end
|
@@ -101,8 +101,8 @@ module Rails
|
|
101
101
|
module RFC6570
|
102
102
|
if defined?(::Rails::Railtie)
|
103
103
|
class Railtie < Rails::Railtie # :nodoc:
|
104
|
-
initializer 'rails-
|
105
|
-
require 'rails/
|
104
|
+
initializer 'rails-rfc6570', :group => :all do |app|
|
105
|
+
require 'rails/rfc6570/patches'
|
106
106
|
|
107
107
|
ActiveSupport.on_load(:action_controller) do
|
108
108
|
include Rails::RFC6570::Helper
|