active_event 0.3.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_event/event_source_server.rb +1 -1
- data/lib/active_event/replay_server.rb +4 -4
- data/lib/active_event/support/attr_initializer.rb +2 -2
- data/lib/active_event/support/attr_setter.rb +1 -1
- data/lib/active_event/version.rb +1 -1
- data/spec/lib/replay_server_spec.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3725bc30efd35e0e09cf22ba870dc945218221c
|
4
|
+
data.tar.gz: 1d51456ff0ebf35d94a4e64cd3175aa931abe9f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e083f945c9abafe2a5b2e8513c4d23e213825bb01ee32c9709e34755a4dd3be322e42ce9e5161f7c40fac993b5b44752350ab3d252a4c0f92fd82590f70ce7f2
|
7
|
+
data.tar.gz: 334d9f8f056225f220e52e1cbdfafe61bbd8862b09ba75dae64ec93a97fabe98793a32cedf36e07bf7e48879ab60437ca1834c9d16ae1bece69df4aba87f4a5d
|
@@ -56,10 +56,10 @@ module ActiveEvent
|
|
56
56
|
false
|
57
57
|
end
|
58
58
|
|
59
|
-
def republish(
|
60
|
-
type =
|
61
|
-
body =
|
62
|
-
resend_exchange.publish body, {type: type, headers: {
|
59
|
+
def republish(event)
|
60
|
+
type = event.event
|
61
|
+
body = event.data.to_json
|
62
|
+
resend_exchange.publish body, {type: type, headers: {id: event.id, created_at: event.created_at, replayed: true}}
|
63
63
|
puts "Republished #{type} with #{body}"
|
64
64
|
end
|
65
65
|
|
@@ -55,7 +55,7 @@ module ActiveEvent::Support
|
|
55
55
|
attr_accessor :attributes
|
56
56
|
|
57
57
|
def init_attributes(attributes)
|
58
|
-
self.attributes = attributes.
|
58
|
+
self.attributes = attributes.symbolize_keys
|
59
59
|
freeze
|
60
60
|
end
|
61
61
|
|
@@ -66,7 +66,7 @@ module ActiveEvent::Support
|
|
66
66
|
if attributes.respond_to?(:permitted?) and not attributes.permitted?
|
67
67
|
raise ActiveEvent::Support::ForbiddenAttributesError
|
68
68
|
end
|
69
|
-
(attributes.keys - self.class.attribute_keys).each do |k|
|
69
|
+
(attributes.keys.map(&:to_sym) - self.class.attribute_keys).each do |k|
|
70
70
|
raise ActiveEvent::Support::UnknownAttributeError, "unknown attribute: #{k}"
|
71
71
|
end
|
72
72
|
end
|
data/lib/active_event/version.rb
CHANGED
@@ -8,11 +8,13 @@ describe ActiveEvent::ReplayServer do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'republishes an event' do
|
11
|
+
date = DateTime.now.utc
|
11
12
|
allow(@server).to receive(:resend_exchange).and_return(Object)
|
12
|
-
expect(@server.resend_exchange).to receive(:publish).with("{\"bla\":\"Test2\"}", {:type => "TestEvent", :headers => {
|
13
|
+
expect(@server.resend_exchange).to receive(:publish).with("{\"bla\":\"Test2\"}", {:type => "TestEvent", :headers => {id: 0, created_at: date.to_s, replayed: true}})
|
13
14
|
expect(@event).to receive(:event).and_return(@event.class.name)
|
14
15
|
expect(@event).to receive(:data).and_return(bla: 'Test2')
|
15
16
|
expect(@event).to receive(:id).and_return(0)
|
17
|
+
expect(@event).to receive(:created_at).and_return(date.to_s)
|
16
18
|
@server.republish(@event)
|
17
19
|
end
|
18
20
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Reischuck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|