ruby_event_store 0.10.1 → 0.11.0

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
  SHA1:
3
- metadata.gz: e5d5a1105e3ed5905fe587217042bd588bbac81c
4
- data.tar.gz: a55182ec68362fe4f24bf8c994fea6eeb35910c2
3
+ metadata.gz: 6e16dc456d4da3dc64c6396563e49a5a4c7525ed
4
+ data.tar.gz: 29722b541d8657bdf2dcd7c7d95b1f8f7b451250
5
5
  SHA512:
6
- metadata.gz: 0a693f7053f4a752571b40b49bdcacc1bcb6340fdd7d54062806cfa001019f3019b5b725c53c73947c75cb034a25cc24abe86f10d0680af5f5fcf5678ec4d876
7
- data.tar.gz: ee61129d92405084c4fb6dca0f4044f8f2876dc171bfeb60e389398781e147ba70ae835da6ba776aca2705b4b85a6f8ea403887cac3265a94d379de7415bd06c
6
+ metadata.gz: dcf33f2a9432815aa5eca5e6a18353ce19168cdba5089ea9819b6ed905623ebf23436bbafbfb68065607da7b0dc3853eb4109f07977160a9562d8560ae8b8c36
7
+ data.tar.gz: b846a9480cb3a4c8ae84bba551a000bc1e51617ab47a3bde0d30fb5bf14a33bf62c927af9200cc5d8d80e81c62c35de66d97861ce2e30512b002082802c11ba9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 0.11.0 (12.07.2016)
2
+
3
+ * Change: Call instead of handle_event, handle_event marked as deprecated in PR #18 is now removed PR #25
4
+ * Change: Rename RubyEventStore::Facade to RubyEventStore::Client PR #26
5
+
1
6
  ### 0.10.1 (12.07.2016)
2
7
 
3
8
  * Added few new tests for repositories
@@ -3,6 +3,6 @@ require 'ruby_event_store/in_memory_repository'
3
3
  require 'ruby_event_store/projection'
4
4
  require 'ruby_event_store/errors'
5
5
  require 'ruby_event_store/constants'
6
- require 'ruby_event_store/facade'
6
+ require 'ruby_event_store/client'
7
7
  require 'ruby_event_store/event'
8
8
  require 'ruby_event_store/version'
@@ -1,5 +1,5 @@
1
1
  module RubyEventStore
2
- class Facade
2
+ class Client
3
3
  def initialize(repository,
4
4
  event_broker: PubSub::Broker.new,
5
5
  metadata_proc: nil)
@@ -4,23 +4,18 @@ module RubyEventStore
4
4
  class Dispatcher
5
5
  def call(subscriber, event)
6
6
  ensure_method_defined(subscriber)
7
- if subscriber.respond_to?(:call)
8
- subscriber.call(event)
9
- else
10
- warn "[DEPRECATION] `handle_event` is deprecated. Please use `call` instead."
11
- subscriber.handle_event(event)
12
- end
7
+ subscriber.call(event)
13
8
  end
14
9
 
15
10
  private
16
11
  def ensure_method_defined(subscriber)
17
- unless subscriber.respond_to?(:call) || subscriber.respond_to?(:handle_event)
12
+ unless subscriber.respond_to?(:call)
18
13
  raise MethodNotDefined.new(method_not_defined_message(subscriber))
19
14
  end
20
15
  end
21
16
 
22
17
  def method_not_defined_message(subscriber)
23
- "Neither #call nor #handle_event method found in #{subscriber.class} subscriber. Are you sure it is a valid subscriber?"
18
+ "#call method not found in #{subscriber.class} subscriber. Are you sure it is a valid subscriber?"
24
19
  end
25
20
  end
26
21
  private_constant :Dispatcher
@@ -5,17 +5,6 @@ RSpec.shared_examples :event_broker do |broker_class|
5
5
 
6
6
  class InvalidTestHandler
7
7
  end
8
- class DeprectatedTestHandler
9
- def initialize
10
- @events = []
11
- end
12
-
13
- def handle_event(event)
14
- @events << event
15
- end
16
-
17
- attr_reader :events
18
- end
19
8
  class TestHandler
20
9
  def initialize
21
10
  @events = []
@@ -68,30 +57,8 @@ RSpec.shared_examples :event_broker do |broker_class|
68
57
  expect(global_handler.events).to eq([event1,event2,event3])
69
58
  end
70
59
 
71
- it 'notify subscribed deprecated handlers' do
72
- handler = DeprectatedTestHandler.new
73
- another_handler = DeprectatedTestHandler.new
74
- global_handler = DeprectatedTestHandler.new
75
-
76
- broker.add_subscriber(handler, [Test1DomainEvent, Test3DomainEvent])
77
- broker.add_subscriber(another_handler, [Test2DomainEvent])
78
- broker.add_global_subscriber(global_handler)
79
-
80
- event1 = Test1DomainEvent.new
81
- event2 = Test2DomainEvent.new
82
- event3 = Test3DomainEvent.new
83
-
84
- [event1, event2, event3].each do |ev|
85
- broker.notify_subscribers(ev)
86
- end
87
-
88
- expect(handler.events).to eq([event1,event3])
89
- expect(another_handler.events).to eq([event2])
90
- expect(global_handler.events).to eq([event1,event2,event3])
91
- end
92
-
93
60
  it 'raises error when no valid method on handler' do
94
- message = "Neither #call nor #handle_event method found " +
61
+ message = "#call method not found " +
95
62
  "in InvalidTestHandler subscriber." +
96
63
  " Are you sure it is a valid subscriber?"
97
64
  subscriber = InvalidTestHandler.new
@@ -100,7 +67,7 @@ RSpec.shared_examples :event_broker do |broker_class|
100
67
  end
101
68
 
102
69
  it 'raises error when no valid method on global handler' do
103
- message = "Neither #call nor #handle_event method found " +
70
+ message = "#call method not found " +
104
71
  "in InvalidTestHandler subscriber." +
105
72
  " Are you sure it is a valid subscriber?"
106
73
  subscriber = InvalidTestHandler.new
@@ -155,12 +122,4 @@ RSpec.shared_examples :event_broker do |broker_class|
155
122
  broker_with_custom_dispatcher.notify_subscribers(event1)
156
123
  expect(dispatcher.dispatched).to eq([{subscriber: handler, event: event1}])
157
124
  end
158
-
159
- it 'deprecation message when no call method in handler' do
160
- subscriber = DeprectatedTestHandler.new
161
- broker.add_global_subscriber(subscriber)
162
- expect { broker.notify_subscribers(Test1DomainEvent.new) }.to output(
163
- "[DEPRECATION] `handle_event` is deprecated. Please use `call` instead.\n").to_stderr
164
- end
165
-
166
125
  end
@@ -1,3 +1,3 @@
1
1
  module RubyEventStore
2
- VERSION = '0.10.1'
2
+ VERSION = '0.11.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_event_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkency
@@ -111,10 +111,10 @@ files:
111
111
  - README.md
112
112
  - Rakefile
113
113
  - lib/ruby_event_store.rb
114
+ - lib/ruby_event_store/client.rb
114
115
  - lib/ruby_event_store/constants.rb
115
116
  - lib/ruby_event_store/errors.rb
116
117
  - lib/ruby_event_store/event.rb
117
- - lib/ruby_event_store/facade.rb
118
118
  - lib/ruby_event_store/in_memory_repository.rb
119
119
  - lib/ruby_event_store/projection.rb
120
120
  - lib/ruby_event_store/pub_sub/broker.rb