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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b7d72f497ef91beb4d574c0486c9213374be5c6
4
- data.tar.gz: d4990d5d0c7018547ba7731844eea3786ef4e197
3
+ metadata.gz: eb002b201268d653613174cb4e1c384de620b432
4
+ data.tar.gz: b288bfe64861913b3d7104c31799428ecb7d0e14
5
5
  SHA512:
6
- metadata.gz: d607093618fc770638d186d1b488ba4c059de15b63edbe89c69adfd016718c42d1a592d87a4ba6ebc22bf6fcc6a1022a4e3d5d088560a8bcf6e120af8df9db52
7
- data.tar.gz: 4c00d8a89c07d4395136f50b551bf8c44dcca3289356273e7b312a684606f7e0c93b35f485d14c6e2d6d550c2c8eea011899cf00abb8d206e94b823131d5fa4a
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
- * dropped a support for `1.9` and `j**`
30
- * `CommandReturningHash` is a command, that is supposed to return… well, you guessed
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
- #### TBD:
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
- * `CommandReturningArrayOfHashes`
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
@@ -1,5 +1,5 @@
1
1
  module Mutations
2
2
  module ValidateOutcome
3
- VERSION = '0.7.220'.freeze
3
+ VERSION = '0.7.222'.freeze
4
4
  end
5
5
  end
@@ -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.220
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-05-27 00:00:00.000000000 Z
11
+ date: 2016-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler