rails-rfc6570 0.1.3 → 0.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
  SHA1:
3
- metadata.gz: 5b6068fada57d766e8526c9a724d3306ccb57bf1
4
- data.tar.gz: 8b7bca932a6fc983b60b623538a6c09979601d3e
3
+ metadata.gz: 1d70b813ed603b1df473712572c5bfe3512bcd1f
4
+ data.tar.gz: 9eb59b5a3799343dcb17bfac47d325eccf327754
5
5
  SHA512:
6
- metadata.gz: fee77bd4a74309efa9888ec205072ebc68f076d62f790df5490ed6213f02a7af7c450e7f52f5a703329047e5736b52d2775a35b42c6413522489ae82561cf11e
7
- data.tar.gz: 4cb2d32b9aeb24fc3ee9720002e6b290337c5364733a04acd4c6b2aed404994c0c9514dbe716e84cdd24915f14c053b45fe2892b632a15a6a38d2ff72270a1ac
6
+ metadata.gz: 1aa94aff55c1fb9567d708cf737915ff6bc2aae5cf0e49a3209f6e964f118f6c3216c19449358a00e35b7af9edc2ed55df827d2d76f2c267fef768187ab558d6
7
+ data.tar.gz: 6eed292ee1ba65ae51dc2782f5aac594f319457a9aa6ab7321ef5d26011ef2af2a187797b501cf3788c5b26d54eda6e840fe7eeac36fec583150344ce8c98c5f
@@ -176,10 +176,16 @@ module Rails
176
176
  end
177
177
 
178
178
  def method_missing(mth, *args, &block)
179
- if mth =~ /^(\w+)_rfc6570$/
180
- rfc6570_route $1
181
- else
182
- super
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
@@ -2,8 +2,8 @@ module Rails
2
2
  module RFC6570
3
3
  module VERSION
4
4
  MAJOR = 0
5
- MINOR = 1
6
- PATCH = 3
5
+ MINOR = 2
6
+ PATCH = 0
7
7
  STAGE = nil
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.').freeze
@@ -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.1.3
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-06-05 00:00:00.000000000 Z
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: