rails-rfc6570 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails/rfc6570.rb +10 -4
- data/lib/rails/rfc6570/version.rb +2 -2
- data/spec/rfc6570_spec.rb +10 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d70b813ed603b1df473712572c5bfe3512bcd1f
|
4
|
+
data.tar.gz: 9eb59b5a3799343dcb17bfac47d325eccf327754
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aa94aff55c1fb9567d708cf737915ff6bc2aae5cf0e49a3209f6e964f118f6c3216c19449358a00e35b7af9edc2ed55df827d2d76f2c267fef768187ab558d6
|
7
|
+
data.tar.gz: 6eed292ee1ba65ae51dc2782f5aac594f319457a9aa6ab7321ef5d26011ef2af2a187797b501cf3788c5b26d54eda6e840fe7eeac36fec583150344ce8c98c5f
|
data/lib/rails/rfc6570.rb
CHANGED
@@ -176,10 +176,16 @@ module Rails
|
|
176
176
|
end
|
177
177
|
|
178
178
|
def method_missing(mth, *args, &block)
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
179
|
+
opts = args.first || {}
|
180
|
+
case mth
|
181
|
+
when /^(\w+)_path_rfc6570$/
|
182
|
+
rfc6570_route $1, opts.merge(path_only: true)
|
183
|
+
when /^(\w+)_url_rfc6570$/
|
184
|
+
rfc6570_route $1, opts.merge(path_only: false) # independent of whatever future defaults
|
185
|
+
when /^(\w+)_rfc6570$/
|
186
|
+
rfc6570_route $1, opts
|
187
|
+
else
|
188
|
+
super
|
183
189
|
end
|
184
190
|
end
|
185
191
|
end
|
data/spec/rfc6570_spec.rb
CHANGED
@@ -29,6 +29,8 @@ class APIController < ApplicationController
|
|
29
29
|
def action
|
30
30
|
render json: {
|
31
31
|
template: action_rfc6570,
|
32
|
+
template_url: action_url_rfc6570,
|
33
|
+
template_path: action_path_rfc6570,
|
32
34
|
partial: test6_rfc6570.partial_expand(title: 'TITLE'),
|
33
35
|
expand: test6_rfc6570.expand(capture: %w(a b), title: 'TITLE')
|
34
36
|
}
|
@@ -86,6 +88,14 @@ describe Rails::RFC6570, type: :request do
|
|
86
88
|
expect(json['template']).to eq "#{host}/action{?param1,param2}"
|
87
89
|
end
|
88
90
|
|
91
|
+
it 'should allow to return and render url templates' do
|
92
|
+
expect(json['template_url']).to eq "#{host}/action{?param1,param2}"
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'should allow to return and render path templates' do
|
96
|
+
expect(json['template_path']).to eq "/action{?param1,param2}"
|
97
|
+
end
|
98
|
+
|
89
99
|
it 'should allow to return and render partial expanded templates' do
|
90
100
|
expect(json['partial']).to eq "#{host}/path{/capture*}/TITLE"
|
91
101
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-rfc6570
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -158,3 +158,4 @@ test_files:
|
|
158
158
|
- spec/dummy/public/favicon.ico
|
159
159
|
- spec/rfc6570_spec.rb
|
160
160
|
- spec/spec_helper.rb
|
161
|
+
has_rdoc:
|