event_sourcery-rails 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: f691f46a44b4d5909efb60f1d87c2d463382c75dfed89877a26d1771162a7458
4
- data.tar.gz: 1fca779982165b17b3aad6be86bff5e49123f5c9ec1e3d41bb4345e28bb95ded
3
+ metadata.gz: df29861288e939b73e93d118e89afe06d1a064b1c2050d483e522101065eae0e
4
+ data.tar.gz: d91e57df90d9f6e413c925b7a1a14689c7522022dfab00e3d8c28b92c3121649
5
5
  SHA512:
6
- metadata.gz: 5fa9870de94fb1d99733c1b7bb5c69b7a566454eb28279328ea7cc4eb7d9c326682008eb55ec843aff75d4075880be6ecb6de86e23554e74e7022468bac419c8
7
- data.tar.gz: 43c35bc1f3efda9b5be3ea4aa1f5ad944f1c09aa4a0dfc383e5c485698332f9ee0f641bc9f8cbe96e8e743f292ae5dce6cbf375901c72b272e6951f4e3373a3a
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
@@ -1,6 +1,8 @@
1
1
  module EventSourcery
2
2
  module Rails
3
3
  class Command
4
+ include ActiveModel::Validations
5
+
4
6
  attr_reader :aggregate_id
5
7
 
6
8
  def initialize(aggregate_id:)
@@ -1,5 +1,5 @@
1
1
  module EventSourcery
2
2
  module Rails
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_sourcery-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Baylor Rae'