event_sourcery-rails 0.2.0 → 0.2.1
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 +4 -4
- data/README.md +8 -0
- data/lib/event_sourcery/rails/command.rb +2 -0
- data/lib/event_sourcery/rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df29861288e939b73e93d118e89afe06d1a064b1c2050d483e522101065eae0e
|
4
|
+
data.tar.gz: d91e57df90d9f6e413c925b7a1a14689c7522022dfab00e3d8c28b92c3121649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcdceef20c2967d332aa2804c72ce2c542bd38d486a396a77c05bf9a153e89e3e3e42fc61c26c82fb0d62896fb5fc41ca5eca666beb0be60271dcd27e289c56a
|
7
|
+
data.tar.gz: 06e22638e77979a354e3c0f77a789991b8a5e6809d3050d1236018d1a2538d0177a481ae8f111f9f0bb6f7035375ac1e6897c918cb7aa2f1ade566028be4bd9d
|
data/README.md
CHANGED
@@ -9,9 +9,13 @@ EventSourcery::Rails adds an optional base class for commands to enforce
|
|
9
9
|
instantiating commands with an `aggregate_id` and required parameters as keyword
|
10
10
|
arguments. Defined attributes are available with an `attr_reader`.
|
11
11
|
|
12
|
+
Includes [`ActiveModel::Validations`][active_model_validations] for validating
|
13
|
+
attributes.
|
14
|
+
|
12
15
|
```ruby
|
13
16
|
class AddUser < EventSourcery::Rails::Command
|
14
17
|
attributes :name, :email
|
18
|
+
validates_presence_of :name, :email
|
15
19
|
end
|
16
20
|
|
17
21
|
AddUser.new # => raises ArgumentError.new("missing keywords: aggregate_id, name, email")
|
@@ -22,6 +26,8 @@ command = AddUser.new(aggregate_id: 'aggregate-id',
|
|
22
26
|
command.aggregate_id # => "aggregate-id"
|
23
27
|
command.name # => "name"
|
24
28
|
command.email # => "email"
|
29
|
+
|
30
|
+
command.valid? # => true
|
25
31
|
```
|
26
32
|
|
27
33
|
### Command Handlers
|
@@ -101,3 +107,5 @@ Please submit issues and pull requests for bugs, features or ideas.
|
|
101
107
|
|
102
108
|
## License
|
103
109
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
110
|
+
|
111
|
+
[active_model_validations]: https://api.rubyonrails.org/classes/ActiveModel/Validations.html#module-ActiveModel::Validations-label-Active+Model+Validations
|