parametric 0.0.2 → 0.0.3
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 +7 -7
- data/README.md +74 -12
- data/lib/parametric/hash.rb +34 -32
- data/lib/parametric/params.rb +17 -11
- data/lib/parametric/policies.rb +10 -2
- data/lib/parametric/version.rb +1 -1
- data/spec/nested_params_spec.rb +90 -0
- data/spec/parametric_spec.rb +35 -31
- metadata +53 -62
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ea2ea42f0944e44e3fa09a487428f6b8cd6ef61f
|
4
|
+
data.tar.gz: 5e058214303cc07ac28f93924529efe8b88875fc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e418038925d9b0e9c302cfd616b8148dd855377aaf1fa3d69ec7cb9f821add9c6e649bb096bb539fb581b4c2fcb6ca2b51ea23fc953530930daa71cdb754d184
|
7
|
+
data.tar.gz: 6efb123579da71f5195f3a36f5a02a0747193c55a60217c2061afc3186367cfe28bf5798c09ba11da82335b05a9e2cd83b2434964457685e9c3e905df621d45a
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[](https://travis-ci.org/ismasan/parametric)
|
3
3
|
[](http://badge.fury.io/rb/parametric)
|
4
4
|
|
5
|
-
DSL for declaring allowed parameters with options, regexp
|
5
|
+
DSL for declaring allowed parameters with options, regexp pattern and default values.
|
6
6
|
|
7
7
|
Useful for building self-documeting APIs, search or form objects.
|
8
8
|
|
@@ -138,24 +138,25 @@ order_search.available_params # => {page: 2, per_page: 50}
|
|
138
138
|
`#schema` returns a data structure including meta-data on each parameter, such as "label" and "options". Useful for building forms or self-documented Hypermedia APIs (or maybe [json-schema](http://json-schema.org/example2.html) endpoints).
|
139
139
|
|
140
140
|
```ruby
|
141
|
-
order_search.schema # =>
|
141
|
+
order_search.schema[:q].label # => 'Full text search query'
|
142
|
+
order_search.schema[:q].value # => ''
|
142
143
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
144
|
+
order_search.schema[:page].label # => 'Page number'
|
145
|
+
order_search.schema[:page].value # => 1
|
146
|
+
|
147
|
+
order_search.schema[:status].label # => 'Order status'
|
148
|
+
order_search.schema[:status].value # => ['pending']
|
149
|
+
order_search.schema[:status].options # => ['checkout', 'pending', 'closed', 'shipped']
|
150
|
+
order_search.schema[:status].multiple # => true
|
151
|
+
order_search.schema[:status].default # => 'closed'
|
150
152
|
```
|
151
153
|
|
152
154
|
## Parametric::Hash
|
153
155
|
|
154
|
-
The alternative `Parametric::Hash`
|
156
|
+
The alternative `Parametric::Hash` class makes your objects quack like a hash, instead of exposing the `#params` object directly.
|
155
157
|
|
156
158
|
```ruby
|
157
|
-
class OrdersParams
|
158
|
-
include Parametric::Hash
|
159
|
+
class OrdersParams < Parametric::Hash
|
159
160
|
param :q, 'Full text search query'
|
160
161
|
param :page, 'Page number', default: 1
|
161
162
|
param :per_page, 'Items per page', default: 30
|
@@ -170,10 +171,48 @@ order_params[:per_page] # => 30
|
|
170
171
|
order_params.each{|key, value| ... }
|
171
172
|
```
|
172
173
|
|
174
|
+
## Nested structures
|
175
|
+
|
176
|
+
You can also nest parameter definitions. This is useful if you need to model POST payloads, for example.
|
177
|
+
|
178
|
+
```ruby
|
179
|
+
class AccountPayload
|
180
|
+
include Parametric::Params
|
181
|
+
param :status, 'Account status', default: 'pending', options: ['pending', 'active', 'cancelled']
|
182
|
+
param :users, 'Users in this account', multiple: true do
|
183
|
+
param :name, 'User name'
|
184
|
+
param :title, 'Job title', default: 'Employee'
|
185
|
+
param :email, 'User email', match: /\w+@\w+\.\w+/
|
186
|
+
end
|
187
|
+
param :owner, 'Owner user' do
|
188
|
+
param :name, 'User name'
|
189
|
+
param :email, 'User email', match: /\w+@\w+\.\w+/
|
190
|
+
end
|
191
|
+
end
|
192
|
+
```
|
193
|
+
|
194
|
+
The example above expects a data structure like the following:
|
195
|
+
|
196
|
+
```ruby
|
197
|
+
{
|
198
|
+
status: 'active',
|
199
|
+
users: [
|
200
|
+
{name: 'Joe Bloggs', email: 'joe@bloggs.com'},
|
201
|
+
{name: 'jane Bloggs', email: 'jane@bloggs.com', title: 'CEO'}
|
202
|
+
],
|
203
|
+
owner: {
|
204
|
+
name: 'Olivia Owner',
|
205
|
+
email: 'olivia@owner.com'
|
206
|
+
}
|
207
|
+
}
|
208
|
+
```
|
209
|
+
|
173
210
|
## Use cases
|
174
211
|
|
175
212
|
### In Rails
|
176
213
|
|
214
|
+
You can use one-level param definitions in GET actions
|
215
|
+
|
177
216
|
```ruby
|
178
217
|
def index
|
179
218
|
@search = OrdersSearch.new(params)
|
@@ -190,6 +229,29 @@ def index
|
|
190
229
|
end
|
191
230
|
```
|
192
231
|
|
232
|
+
You can use nested definitions on POST/PUT actions, for example as part of your own strategy objects.
|
233
|
+
|
234
|
+
```ruby
|
235
|
+
def create
|
236
|
+
@payload = AccountPayload.new(params)
|
237
|
+
if @payload.save
|
238
|
+
render json: AccountSerializer.new(@payload.order)
|
239
|
+
else
|
240
|
+
render json: ErrorSerializer.new(@payload.errors), status: 422
|
241
|
+
end
|
242
|
+
end
|
243
|
+
```
|
244
|
+
|
245
|
+
You can also use the `#schema` metadata to build Hypermedia "actions" or forms.
|
246
|
+
|
247
|
+
```ruby
|
248
|
+
# /accounts/new.json
|
249
|
+
def new
|
250
|
+
@payload = AccountPayload.new
|
251
|
+
render json: JsonSchemaSerializer.new(@payload.schema)
|
252
|
+
end
|
253
|
+
```
|
254
|
+
|
193
255
|
## Installation
|
194
256
|
|
195
257
|
Add this line to your application's Gemfile:
|
data/lib/parametric/hash.rb
CHANGED
@@ -1,36 +1,38 @@
|
|
1
|
+
require 'forwardable'
|
1
2
|
module Parametric
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
3
|
+
class Hash
|
4
|
+
include Params
|
5
|
+
include Enumerable
|
6
|
+
extend ::Forwardable
|
7
|
+
def_delegators(:params,
|
8
|
+
:[],
|
9
|
+
:[]=,
|
10
|
+
:each,
|
11
|
+
:each_value,
|
12
|
+
:each_key,
|
13
|
+
:each_pair,
|
14
|
+
:keys,
|
15
|
+
:values,
|
16
|
+
:values_at,
|
17
|
+
:fetch,
|
18
|
+
:size,
|
19
|
+
:to_hash,
|
20
|
+
:merge,
|
21
|
+
:merge!,
|
22
|
+
:replace,
|
23
|
+
:update,
|
24
|
+
:has_key?,
|
25
|
+
:key?,
|
26
|
+
:key,
|
27
|
+
:select,
|
28
|
+
:select!,
|
29
|
+
:delete,
|
30
|
+
:store,
|
31
|
+
:inspect,
|
32
|
+
:stringify_keys,
|
33
|
+
:symbolize_keys
|
34
|
+
)
|
34
35
|
|
35
36
|
end
|
37
|
+
|
36
38
|
end
|
data/lib/parametric/params.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'ostruct'
|
1
2
|
module Parametric
|
2
3
|
|
3
4
|
class ParamsHash < Hash
|
@@ -21,19 +22,19 @@ module Parametric
|
|
21
22
|
|
22
23
|
def available_params
|
23
24
|
@available_params ||= params.each_with_object(ParamsHash.new) do |(k,v),memo|
|
24
|
-
|
25
|
+
if Utils.present?(v)
|
26
|
+
memo[k] = v.respond_to?(:available_params) ? v.available_params : v
|
27
|
+
end
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
28
31
|
def schema
|
29
32
|
@schema ||= params.each_with_object({}) do |(k,v),memo|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
memo[k][:match] = self.class._allowed_params[k][:match].to_s if self.class._allowed_params[k].has_key?(:match)
|
36
|
-
memo[k][:options] = self.class._allowed_params[k][:options] if self.class._allowed_params[k].has_key?(:options)
|
33
|
+
is_nested = v.kind_of?(Parametric::Hash)
|
34
|
+
attrs = self.class._allowed_params[k].dup
|
35
|
+
attrs[:value] = is_nested ? v : Utils.value(v)
|
36
|
+
attrs[:schema] = v.schema if is_nested
|
37
|
+
memo[k] = OpenStruct.new(attrs)
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
@@ -41,13 +42,13 @@ module Parametric
|
|
41
42
|
|
42
43
|
def _reduce(raw_params)
|
43
44
|
self.class._allowed_params.each_with_object(ParamsHash.new) do |(key,options),memo|
|
44
|
-
policy = Policies::Policy.new(raw_params[key], options)
|
45
|
+
policy = Policies::Policy.new((raw_params.has_key?(key) ? raw_params[key] : []), options)
|
46
|
+
policy = policy.wrap(Policies::NestedPolicy) if options[:nested]
|
45
47
|
policy = policy.wrap(Policies::MultiplePolicy) if options[:multiple]
|
46
48
|
policy = policy.wrap(Policies::OptionsPolicy) if options[:options]
|
47
49
|
policy = policy.wrap(Policies::MatchPolicy) if options[:match]
|
48
50
|
policy = policy.wrap(Policies::DefaultPolicy) if options.has_key?(:default)
|
49
51
|
policy = policy.wrap(Policies::SinglePolicy) unless options[:multiple]
|
50
|
-
|
51
52
|
memo[key] = policy.value
|
52
53
|
end
|
53
54
|
end
|
@@ -57,8 +58,13 @@ module Parametric
|
|
57
58
|
@allowed_params ||= {}
|
58
59
|
end
|
59
60
|
|
60
|
-
def param(field_name, label = '', opts = {})
|
61
|
+
def param(field_name, label = '', opts = {}, &block)
|
61
62
|
opts[:label] = label
|
63
|
+
if block_given?
|
64
|
+
nested = Class.new(Parametric::Hash)
|
65
|
+
nested.instance_eval &block
|
66
|
+
opts[:nested] = nested
|
67
|
+
end
|
62
68
|
_allowed_params[field_name] = opts
|
63
69
|
end
|
64
70
|
end
|
data/lib/parametric/policies.rb
CHANGED
@@ -12,7 +12,7 @@ module Parametric
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def value
|
15
|
-
|
15
|
+
[@value].flatten
|
16
16
|
end
|
17
17
|
|
18
18
|
protected
|
@@ -22,7 +22,7 @@ module Parametric
|
|
22
22
|
class DefaultPolicy < Policy
|
23
23
|
def value
|
24
24
|
v = decorated.value
|
25
|
-
v.
|
25
|
+
v.size > 0 ? v : Array(options[:default])
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -36,6 +36,14 @@ module Parametric
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
class NestedPolicy < Policy
|
40
|
+
def value
|
41
|
+
decorated.value.map do |v|
|
42
|
+
options[:nested].new(v)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
39
47
|
class SinglePolicy < Policy
|
40
48
|
def value
|
41
49
|
decorated.value.first
|
data/lib/parametric/version.rb
CHANGED
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Parametric do
|
4
|
+
|
5
|
+
describe Parametric::Params do
|
6
|
+
|
7
|
+
let(:klass) do
|
8
|
+
Class.new do
|
9
|
+
include Parametric::Params
|
10
|
+
param :name, 'User name'
|
11
|
+
param :tags, 'Tags', multiple: true, default: 'defaulttag'
|
12
|
+
param :lala, 'Lala' do
|
13
|
+
param :foo, 'foo'
|
14
|
+
end
|
15
|
+
param :account, 'Account' do
|
16
|
+
param :name, 'Account name'
|
17
|
+
param :admin, 'Admin user' do
|
18
|
+
param :name, 'User name'
|
19
|
+
end
|
20
|
+
param :shop, 'Shop' do
|
21
|
+
param :url, 'Shop url', default: 'http://google.com'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
param :variants, 'Product variants', multiple: true do
|
25
|
+
param :name, 'variant name', default: 'default'
|
26
|
+
param :price
|
27
|
+
param :tags, 'Variant tags', multiple: true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
let(:subject) do
|
33
|
+
klass.new({
|
34
|
+
foo: 'bar',
|
35
|
+
name: 'user1',
|
36
|
+
account: {
|
37
|
+
name: 'account1',
|
38
|
+
lala: 1,
|
39
|
+
admin: {
|
40
|
+
name: 'Joe Bloggs'
|
41
|
+
}
|
42
|
+
},
|
43
|
+
variants: [
|
44
|
+
{name: 'red', price: 10},
|
45
|
+
{price: 11, tags: 'foo,bar'}
|
46
|
+
]
|
47
|
+
})
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '#params' do
|
51
|
+
it 'filters nested objects' do
|
52
|
+
expect(subject.params.has_key?(:foo)).to be_false
|
53
|
+
expect(subject.params[:name]).to eql('user1')
|
54
|
+
expect(subject.params[:account][:name]).to eql('account1')
|
55
|
+
expect(subject.params[:account].has_key?(:lala)).to be_false
|
56
|
+
expect(subject.params[:account][:admin][:name]).to eql('Joe Bloggs')
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'nullifies nested objects that were not passed' do
|
60
|
+
expect(subject.params[:account].has_key?(:shop)).to be_true
|
61
|
+
expect(subject.params[:account][:shop]).to be_nil
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'filters nested :multiple into arrays of objects' do
|
65
|
+
expect(subject.params[:variants].size).to eql(2)
|
66
|
+
expect(subject.params[:variants][0][:name]).to eql('red')
|
67
|
+
expect(subject.params[:variants][0][:price]).to eql(10)
|
68
|
+
expect(subject.params[:variants][0][:tags]).to match_array([])
|
69
|
+
expect(subject.params[:variants][1][:name]).to eql('default')
|
70
|
+
expect(subject.params[:variants][1][:price]).to eql(11)
|
71
|
+
expect(subject.params[:variants][1][:tags]).to match_array(['foo', 'bar'])
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#available_params' do
|
76
|
+
it 'does not include key for nested objects that were not passed' do
|
77
|
+
expect(subject.available_params.has_key?(:lala)).to be_false
|
78
|
+
expect(subject.available_params[:account].has_key?(:shop)).to be_false
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe '#schema' do
|
83
|
+
it 'includes nested param schemas' do
|
84
|
+
expect(subject.schema[:account].schema[:name].value).to eql('account1')
|
85
|
+
expect(subject.schema[:account].schema[:name].label).to eql('Account name')
|
86
|
+
expect(subject.schema[:account].schema[:admin].schema[:name].value).to eql('Joe Bloggs')
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/spec/parametric_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Parametric do
|
|
5
5
|
Parametric::VERSION.should_not be_nil
|
6
6
|
end
|
7
7
|
|
8
|
-
describe Parametric do
|
8
|
+
describe Parametric::Params do
|
9
9
|
|
10
10
|
let(:klass) do
|
11
11
|
Class.new do
|
@@ -18,6 +18,7 @@ describe Parametric do
|
|
18
18
|
param :country, 'country', options: ['UK', 'CL', 'JPN']
|
19
19
|
param :email, 'email', match: /\w+@\w+\.\w+/
|
20
20
|
param :emails, 'emails', match: /\w+@\w+\.\w+/, multiple: true, default: 'default@email.com'
|
21
|
+
param :available, 'available', default: true
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
@@ -44,8 +45,12 @@ describe Parametric do
|
|
44
45
|
klass.new(email: 'my@email').params[:email].should be_nil
|
45
46
|
end
|
46
47
|
|
48
|
+
it 'defaults work for false values' do
|
49
|
+
klass.new(email: 'my@email').params[:email].should be_nil
|
50
|
+
end
|
51
|
+
|
47
52
|
it 'does set value if it does :match' do
|
48
|
-
klass.new(
|
53
|
+
klass.new(available: false).params[:available].should be_false
|
49
54
|
end
|
50
55
|
|
51
56
|
it 'only sets value for :multiple values that :match' do
|
@@ -101,7 +106,7 @@ describe Parametric do
|
|
101
106
|
let(:subject) { klass.new(foo: 'bar', name: 'lala', per_page: 20, status: 'four', emails: 'one@email.com,two@email.com') }
|
102
107
|
|
103
108
|
it 'only includes declared params with values or defaults' do
|
104
|
-
subject.available_params.keys.sort.should == [:emails, :name, :page, :per_page]
|
109
|
+
subject.available_params.keys.sort.should == [:available, :emails, :name, :page, :per_page]
|
105
110
|
subject.available_params[:emails].should == ['one@email.com', 'two@email.com']
|
106
111
|
subject.available_params[:name].should == 'lala'
|
107
112
|
subject.available_params[:per_page].should == 20
|
@@ -119,46 +124,45 @@ describe Parametric do
|
|
119
124
|
let(:subject) { klass.new(foo: 'bar', name: 'lala', per_page: 20, status: 'four') }
|
120
125
|
|
121
126
|
it 'returns full param definitions with populated value' do
|
122
|
-
regexp = /\w+@\w+\.\w
|
127
|
+
regexp = /\w+@\w+\.\w+/
|
123
128
|
|
124
|
-
subject.schema[:name]
|
125
|
-
subject.schema[:name]
|
129
|
+
subject.schema[:name].label.should == 'User name'
|
130
|
+
subject.schema[:name].value.should == 'lala'
|
126
131
|
|
127
|
-
subject.schema[:page]
|
128
|
-
subject.schema[:page]
|
132
|
+
subject.schema[:page].label.should == 'page number'
|
133
|
+
subject.schema[:page].value.should == 1
|
129
134
|
|
130
|
-
subject.schema[:per_page]
|
131
|
-
subject.schema[:per_page]
|
135
|
+
subject.schema[:per_page].label.should == 'items per page'
|
136
|
+
subject.schema[:per_page].value.should == 20
|
132
137
|
|
133
|
-
subject.schema[:status]
|
134
|
-
subject.schema[:status]
|
135
|
-
subject.schema[:status]
|
136
|
-
subject.schema[:status]
|
138
|
+
subject.schema[:status].label.should == 'status'
|
139
|
+
subject.schema[:status].value.should == ''
|
140
|
+
subject.schema[:status].options.should == ['one', 'two', 'three']
|
141
|
+
subject.schema[:status].multiple.should be_true
|
137
142
|
|
138
|
-
subject.schema[:piped_status]
|
139
|
-
subject.schema[:piped_status]
|
140
|
-
subject.schema[:piped_status]
|
143
|
+
subject.schema[:piped_status].label.should == 'status with pipes'
|
144
|
+
subject.schema[:piped_status].value.should == ''
|
145
|
+
subject.schema[:piped_status].multiple.should be_true
|
141
146
|
|
142
|
-
subject.schema[:country]
|
143
|
-
subject.schema[:country]
|
144
|
-
subject.schema[:country]
|
147
|
+
subject.schema[:country].label.should == 'country'
|
148
|
+
subject.schema[:country].value.should == ''
|
149
|
+
subject.schema[:country].options.should == ['UK', 'CL', 'JPN']
|
145
150
|
|
146
|
-
subject.schema[:email]
|
147
|
-
subject.schema[:email]
|
148
|
-
subject.schema[:email]
|
151
|
+
subject.schema[:email].label.should == 'email'
|
152
|
+
subject.schema[:email].value.should == ''
|
153
|
+
subject.schema[:email].match.should == regexp
|
149
154
|
|
150
|
-
subject.schema[:emails]
|
151
|
-
subject.schema[:emails]
|
152
|
-
subject.schema[:emails]
|
153
|
-
subject.schema[:emails]
|
155
|
+
subject.schema[:emails].label.should == 'emails'
|
156
|
+
subject.schema[:emails].value.should == 'default@email.com'
|
157
|
+
subject.schema[:emails].multiple.should be_true
|
158
|
+
subject.schema[:emails].match.should == regexp
|
154
159
|
end
|
155
160
|
end
|
156
161
|
end
|
157
162
|
|
158
163
|
describe Parametric::Hash do
|
159
164
|
let(:klass) do
|
160
|
-
Class.new do
|
161
|
-
include Parametric::Hash
|
165
|
+
Class.new(Parametric::Hash) do
|
162
166
|
param :name, 'User name'
|
163
167
|
param :page, 'page number', default: 1
|
164
168
|
param :per_page, 'items per page', default: 50
|
@@ -185,8 +189,8 @@ describe Parametric do
|
|
185
189
|
end
|
186
190
|
|
187
191
|
it 'has #schema' do
|
188
|
-
subject.schema[:name]
|
189
|
-
subject.schema[:name]
|
192
|
+
subject.schema[:name].label.should == 'User name'
|
193
|
+
subject.schema[:name].value.should == 'Ismael'
|
190
194
|
end
|
191
195
|
end
|
192
196
|
end
|
metadata
CHANGED
@@ -1,65 +1,55 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: parametric
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Ismael Celis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
|
12
|
+
date: 2014-04-03 00:00:00 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.5'
|
20
|
-
type: :development
|
21
16
|
prerelease: false
|
22
|
-
|
23
|
-
requirements:
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
24
19
|
- - ~>
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - '>='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: "1.5"
|
34
22
|
type: :development
|
23
|
+
version_requirements: *id001
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: rake
|
35
26
|
prerelease: false
|
36
|
-
|
37
|
-
requirements:
|
38
|
-
-
|
39
|
-
-
|
40
|
-
|
41
|
-
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
27
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- &id003
|
30
|
+
- ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: "0"
|
48
33
|
type: :development
|
34
|
+
version_requirements: *id002
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rspec
|
49
37
|
prerelease: false
|
50
|
-
|
51
|
-
requirements:
|
52
|
-
-
|
53
|
-
|
54
|
-
|
55
|
-
description: Useful for modelling search or form objects, white-listed query parameters
|
56
|
-
|
57
|
-
email:
|
38
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- *id003
|
41
|
+
type: :development
|
42
|
+
version_requirements: *id004
|
43
|
+
description: Useful for modelling search or form objects, white-listed query parameters and safe parameter defaults.
|
44
|
+
email:
|
58
45
|
- ismaelct@gmail.com
|
59
46
|
executables: []
|
47
|
+
|
60
48
|
extensions: []
|
49
|
+
|
61
50
|
extra_rdoc_files: []
|
62
|
-
|
51
|
+
|
52
|
+
files:
|
63
53
|
- .gitignore
|
64
54
|
- .rspec
|
65
55
|
- .travis.yml
|
@@ -74,33 +64,34 @@ files:
|
|
74
64
|
- lib/parametric/utils.rb
|
75
65
|
- lib/parametric/version.rb
|
76
66
|
- parametric.gemspec
|
67
|
+
- spec/nested_params_spec.rb
|
77
68
|
- spec/parametric_spec.rb
|
78
69
|
- spec/spec_helper.rb
|
79
|
-
homepage:
|
80
|
-
licenses:
|
70
|
+
homepage: ""
|
71
|
+
licenses:
|
81
72
|
- MIT
|
82
73
|
metadata: {}
|
74
|
+
|
83
75
|
post_install_message:
|
84
76
|
rdoc_options: []
|
85
|
-
|
77
|
+
|
78
|
+
require_paths:
|
86
79
|
- lib
|
87
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
-
requirements:
|
89
|
-
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
requirements:
|
94
|
-
- - '>='
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- *id003
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- *id003
|
97
86
|
requirements: []
|
87
|
+
|
98
88
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.0.
|
89
|
+
rubygems_version: 2.0.5
|
100
90
|
signing_key:
|
101
91
|
specification_version: 4
|
102
|
-
summary: DSL for declaring allowed parameters with options, regexp patern and default
|
103
|
-
|
104
|
-
|
92
|
+
summary: DSL for declaring allowed parameters with options, regexp patern and default values.
|
93
|
+
test_files:
|
94
|
+
- spec/nested_params_spec.rb
|
105
95
|
- spec/parametric_spec.rb
|
106
96
|
- spec/spec_helper.rb
|
97
|
+
has_rdoc:
|