euston 1.2.5-java → 1.2.7-java
Sign up to get free protection for your applications and to get access to all the features.
- data/euston.gemspec +2 -2
- data/lib/euston/aggregate_root.rb +3 -4
- data/lib/euston/event_headers.rb +5 -4
- data/lib/euston/version.rb +1 -1
- metadata +2 -2
data/euston.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'euston'
|
3
|
-
s.version = '1.2.
|
4
|
-
s.date = '
|
3
|
+
s.version = '1.2.7'
|
4
|
+
s.date = '2012-02-02'
|
5
5
|
s.platform = RUBY_PLATFORM.to_s == 'java' ? 'java' : Gem::Platform::RUBY
|
6
6
|
s.authors = ['Lee Henson', 'Guy Boertje']
|
7
7
|
s.email = ['lee.m.henson@gmail.com', 'guyboertje@gmail.com']
|
@@ -22,7 +22,7 @@ module Euston
|
|
22
22
|
end
|
23
23
|
|
24
24
|
attr_accessor :log
|
25
|
-
attr_reader :aggregate_id
|
25
|
+
attr_reader :aggregate_id, :stream
|
26
26
|
|
27
27
|
def initial_version
|
28
28
|
@initial_version ||= 0
|
@@ -111,6 +111,7 @@ module Euston
|
|
111
111
|
|
112
112
|
def apply_stream stream
|
113
113
|
@aggregate_id = stream.stream_id
|
114
|
+
@stream = stream
|
114
115
|
|
115
116
|
events = stream.committed_events
|
116
117
|
return if events.empty?
|
@@ -122,12 +123,10 @@ module Euston
|
|
122
123
|
end
|
123
124
|
end
|
124
125
|
|
125
|
-
def publish_command command
|
126
|
+
def publish_command command
|
126
127
|
raise ArgumentError, 'Commands must subclass Euston::Command' unless command.is_a? Euston::Command
|
127
128
|
raise Euston::Errors::InvalidCommandError, "An attempt was made to publish an invalid command from an aggregate root.\n\nAggregate id: #{@aggregate_id}\nAggregate type: #{self.class.name}\nCommand: #{command.to_hash}\nErrors: #{command.errors}" unless command.valid?
|
128
129
|
|
129
|
-
command.headers[:dispatch_at] = dispatch_at
|
130
|
-
|
131
130
|
uncommitted_commands << command
|
132
131
|
end
|
133
132
|
|
data/lib/euston/event_headers.rb
CHANGED
@@ -12,10 +12,11 @@ module Euston
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def to_hash
|
15
|
-
Hash[@source_message_type, @source_message]
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
((@source_message_type && @source_message) ? Hash[@source_message_type, @source_message] : {})
|
16
|
+
.merge :id => id,
|
17
|
+
:type => type,
|
18
|
+
:version => version,
|
19
|
+
:timestamp => timestamp
|
19
20
|
end
|
20
21
|
|
21
22
|
def self.from_hash hash
|
data/lib/euston/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: euston
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.2.
|
5
|
+
version: 1.2.7
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Lee Henson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2012-02-02 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|