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 CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'euston'
3
- s.version = '1.2.5'
4
- s.date = '2011-12-13'
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, dispatch_at = Time.now.to_f
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
 
@@ -12,10 +12,11 @@ module Euston
12
12
  end
13
13
 
14
14
  def to_hash
15
- Hash[@source_message_type, @source_message].merge :id => id,
16
- :type => type,
17
- :version => version,
18
- :timestamp => timestamp
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
@@ -1,3 +1,3 @@
1
1
  module Euston
2
- VERSION = "1.2.5"
2
+ VERSION = "1.2.7"
3
3
  end
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
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: 2011-12-13 00:00:00.000000000Z
13
+ date: 2012-02-02 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel