active_event 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d91f56abebe4f2866575b3287883a391a8f68ed2
4
- data.tar.gz: abda8849cfc95059a4b9c67c34a91173d8cd24cc
3
+ metadata.gz: f3725bc30efd35e0e09cf22ba870dc945218221c
4
+ data.tar.gz: 1d51456ff0ebf35d94a4e64cd3175aa931abe9f3
5
5
  SHA512:
6
- metadata.gz: 50be3d3c1c7b26a1d4e7be8f861eb62bc9e2d12f838ecb9808ebc672c38da7048ae27212bcf53b10e8feb57e8e645d4b10f7c91f2e4d3d12dbf98fa6105b3508
7
- data.tar.gz: d27ce0a1282fe85c7829d51668fc5e267fa1ec698c6bb0e23a3a8ca78265e4983c8dd6e42f8d8371c2ce234befd9d0aa3d208b1fb0fc5e0af399b32e79c0d477
6
+ metadata.gz: e083f945c9abafe2a5b2e8513c4d23e213825bb01ee32c9709e34755a4dd3be322e42ce9e5161f7c40fac993b5b44752350ab3d252a4c0f92fd82590f70ce7f2
7
+ data.tar.gz: 334d9f8f056225f220e52e1cbdfafe61bbd8862b09ba75dae64ec93a97fabe98793a32cedf36e07bf7e48879ab60437ca1834c9d16ae1bece69df4aba87f4a5d
@@ -18,7 +18,7 @@ module ActiveEvent
18
18
  end
19
19
 
20
20
  def event_exchange
21
- @event_exchange ||= event_channel.fanout options[:event_exchange]
21
+ @event_exchange ||= event_channel.fanout "server_side_#{options[:event_exchange]}"
22
22
  end
23
23
 
24
24
  def default_options
@@ -56,10 +56,10 @@ module ActiveEvent
56
56
  false
57
57
  end
58
58
 
59
- def republish(e)
60
- type = e.event
61
- body = e.data.to_json
62
- resend_exchange.publish body, {type: type, headers: {store_id: e.id, replayed: true}}
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.dup
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
@@ -14,7 +14,7 @@ module ActiveEvent::Support
14
14
 
15
15
  # override to skip the freezing!
16
16
  def init_attributes(attributes)
17
- self.attributes = attributes
17
+ self.attributes = attributes.symbolize_keys
18
18
  end
19
19
 
20
20
  module ClassMethods
@@ -1,7 +1,7 @@
1
1
  module ActiveEvent
2
2
  # Returns the version of the currently loaded ActiveEvent as a Gem::Version
3
3
  def self.version
4
- Gem::Version.new '0.3.0'
4
+ Gem::Version.new '0.4.1'
5
5
  end
6
6
 
7
7
  module VERSION #:nodoc:
@@ -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 => {store_id: 0, replayed: true}})
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.3.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-10-15 00:00:00.000000000 Z
11
+ date: 2013-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord