mutations-validate-outcome 0.7.220 → 0.7.222
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -6
- data/lib/mutations/command_returning_hash.rb +2 -0
- data/lib/mutations/version.rb +1 -1
- data/lib/mutations_validate_outcome.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb002b201268d653613174cb4e1c384de620b432
|
4
|
+
data.tar.gz: b288bfe64861913b3d7104c31799428ecb7d0e14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 143e119a213a66631ddf3c50e9cd510ad603cb58497508240806678aa464b647419265a7ca4c3ef10f4c6bd2d398d478ffb354e534c7df3affc72189f724a90d
|
7
|
+
data.tar.gz: f0e87ba7aa0e7a6ff455bb99454e0506e0cdce6fb6276575122002ec4e90a33b64eaeabc10973d0c38a8beffab60c242a3d4b5138253a28492017e746c430d39
|
data/README.md
CHANGED
@@ -26,10 +26,11 @@ In your code:
|
|
26
26
|
|
27
27
|
## Differences against [`cypriss/mutations`](https://github.com/cypriss/mutations)
|
28
28
|
|
29
|
-
*
|
30
|
-
* `CommandReturningHash`
|
31
|
-
* `outcome_required` and `outcome_optional` filters are introduced for the new `CommandReturningHash`
|
32
|
-
* `CommandReturningHash#validate_outcome` method is a sibling of `validate` for additional outcome validation
|
29
|
+
* dropped a support for `1.9` and `j**`
|
30
|
+
* `CommandReturningHash`, `CommandReturningArray` are commands, that are supposed to return… well, you guessed
|
31
|
+
* `outcome_required` and `outcome_optional` filters are introduced for the new `CommandReturningHash` and `CommandReturningArray` classes
|
32
|
+
* `CommandReturningHash#validate_outcome` method is a sibling of `validate` for additional outcome validation on mutations, that are supposed to return a `Hash`
|
33
|
+
* `CommandReturningArray#validate_outcome` method is a sibling of `validate` for additional outcome validation on mutations, that are supposed to return an `Array` of similar `Hash`es; the checker for this command is the same as for `CommandReturningHash`, outcome consists of those elements passing validation, `errors` contains an additional field with failed items.
|
33
34
|
|
34
35
|
#### Example
|
35
36
|
|
@@ -70,10 +71,25 @@ class SimpleCommandReturningHash < Mutations::CommandReturningHash
|
|
70
71
|
end
|
71
72
|
```
|
72
73
|
|
73
|
-
|
74
|
+
```ruby
|
75
|
+
class SimpleCommandReturningArray < Mutations::CommandReturningArray
|
76
|
+
required do
|
77
|
+
string :name, max_length: 10
|
78
|
+
string :email
|
79
|
+
end
|
80
|
+
|
81
|
+
outcome_required do
|
82
|
+
string :name, max_length: 5
|
83
|
+
string :email
|
84
|
+
end
|
74
85
|
|
75
|
-
|
86
|
+
def execute
|
87
|
+
[inputs.dup, {name: 'Aleksei', email: 'a@gmail.com'}]
|
88
|
+
end
|
89
|
+
end
|
90
|
+
```
|
76
91
|
|
77
92
|
## License
|
78
93
|
|
94
|
+
The gem is produced by [Kantox LTD](https://kantox.com).
|
79
95
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -21,10 +21,12 @@ module Mutations
|
|
21
21
|
def outcome_required(&block)
|
22
22
|
create_outcome_attr_methods(:outcome_required, &block)
|
23
23
|
end
|
24
|
+
alias_method :required_output, :outcome_required
|
24
25
|
|
25
26
|
def outcome_optional(&block)
|
26
27
|
create_outcome_attr_methods(:outcome_optional, &block)
|
27
28
|
end
|
29
|
+
alias_method :optional_output, :outcome_optional
|
28
30
|
|
29
31
|
def outcome_filters
|
30
32
|
@outcome_filters ||= (CommandReturningHash == superclass) ? OutcomeHashFilter.new : superclass.outcome_filters.dup
|
data/lib/mutations/version.rb
CHANGED
@@ -88,6 +88,9 @@ module Mutations
|
|
88
88
|
# we’ll re-raise either if no block was given, or if the block returned truthy
|
89
89
|
raise yve if !block_given? || (yield yve)
|
90
90
|
end
|
91
|
+
|
92
|
+
alias_method :required_input, :required
|
93
|
+
alias_method :optional_input, :optional
|
91
94
|
end
|
92
95
|
end
|
93
96
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutations-validate-outcome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.222
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksei Matiushkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|