smart_params 1.0.0 → 2.0.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
  SHA256:
3
- metadata.gz: 7ee27024729173b4bbeb45827db79738a4ed84b07da26c315b57ba0fcca313cc
4
- data.tar.gz: 0a65e6f80959a389e55d492735f0a6c8fcfa9c06397acaf9468c83a2e8db4670
3
+ metadata.gz: 74d26599001993daf7057d745a6685663aa5c0db71f82433281f6330407a335a
4
+ data.tar.gz: b4fa42b15413f3819ea57faa386b1b18e208248aaa8edfad3571ccf4fee7aa3f
5
5
  SHA512:
6
- metadata.gz: 4580e4078efacdf5b01d334b4f943b8a8426cc375a08180970715187de761595dce15c9b62599f259f769f31bd503f25781da895e1a8dbba0778d37d151ac414
7
- data.tar.gz: 9e78ae9f84d8541b5ddebde79346e54dcec97b1bc2b055c00f7fa7d34aae03175b05dbf7e32a96ccad047e8be7c6f340c004384a27437e7d17eb5d8e9f710088
6
+ metadata.gz: d57ddf5cad13bf409b67e677b7170a6410311b65563f2ed36c6e0c75c59bb245ea50872351b2adbd1f1bc6b4922b20c29fec245eb4fa4ef651f6b08ab409ed88
7
+ data.tar.gz: f14d97d11d7e45feba523c3804fa9a5f8754fb5de03286c6314be229de6f410cb04226fdb8c810e7313acf914d29172f8ca42818e464ef907e74cab8f7e30654
data/README.md CHANGED
@@ -17,18 +17,18 @@ class CreateAccountSchema
17
17
  include SmartParams
18
18
 
19
19
  schema type: Strict::Hash do
20
- need :data, type: Strict::Hash do
21
- allow :id, type: Coercible::String.optional
22
- need :type, type: Strict::String
23
- allow :attributes, type: Strict::Hash.optional do
24
- allow :email, type: Strict::String.optional
25
- allow :username, type: Strict::String.optional
26
- allow :name, type: Strict::String.optional
27
- allow :password, type: Strict::String.optional.default { SecureRandom.hex(32) }
20
+ field :data, type: Strict::Hash do
21
+ field :id, type: Coercible::String.optional
22
+ field :type, type: Strict::String
23
+ field :attributes, type: Strict::Hash.optional do
24
+ field :email, type: Strict::String.optional
25
+ field :username, type: Strict::String.optional
26
+ field :name, type: Strict::String.optional
27
+ field :password, type: Strict::String.optional.default { SecureRandom.hex(32) }
28
28
  end
29
29
  end
30
- allow :meta, type: Strict::Hash.optional
31
- allow :included, type: Strict::Array.optional
30
+ field :meta, type: Strict::Hash.optional
31
+ field :included, type: Strict::Array.optional
32
32
  end
33
33
  end
34
34
  ```
@@ -132,7 +132,7 @@ Your model is already complex enough and it doesn't need the added baggage of fi
132
132
 
133
133
  Add this line to your application's Gemfile:
134
134
 
135
- gem "smart_params", "1.0.0"
135
+ gem "smart_params", "2.0.0"
136
136
 
137
137
  And then execute:
138
138
 
@@ -17,11 +17,7 @@ module SmartParams
17
17
  end
18
18
  end
19
19
 
20
- def allow(key, type:, &subfield)
21
- @subfields << self.class.new(keychain: [*keychain, key], type: type, &subfield)
22
- end
23
-
24
- def need(key, type:, &subfield)
20
+ def field(key, type:, &subfield)
25
21
  @subfields << self.class.new(keychain: [*keychain, key], type: type, &subfield)
26
22
  end
27
23
 
@@ -1,3 +1,3 @@
1
1
  module SmartParams
2
- VERSION = "1.0.0"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_params
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurtis Rainbolt-Greene
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-21 00:00:00.000000000 Z
11
+ date: 2018-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler