rails_event_store_active_record 0.20.0 → 0.21.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: 870a6b6052a42cee07f40861b1a9ace1a173984f
4
- data.tar.gz: 8a4c447a0c33358373a5f8143b45f41f0f44949d
3
+ metadata.gz: 1d9b1b348afcdfb181fa21de7e02634bbefd6fb2
4
+ data.tar.gz: 1f1c9e835e50c9968b9decec17a23e55546c8813
5
5
  SHA512:
6
- metadata.gz: 308760f7dfc995d9b535541150f32c4797f581deb00e349fde26f19320110af803305835cf53814d614aed981fe6cbcc819573a296883a7cfb0c8d34df406762
7
- data.tar.gz: b9894d086f193ede1b9e46cd74344f8a8c6a921a4495c7c31e37e77d350dfc087d1c4088394a353b87a4b5de92655021f9e39389bce3e27af03dad1cb5ab2ec6
6
+ metadata.gz: 4e1ab1cdb157e94a52d66132526904bebfa9db5eddd5f0e12afc551794698f90dcd26e70b7902107b8b1c69094556401dc06ee813522c67bdd4ee2e9f8f83833
7
+ data.tar.gz: 8e39656125d3abf7e3c6e66c0bdb0ee19b3ce36fc00f0858c670b5fbc079ec181ea3b17ac47ddf24f4aa795dc9ef8325031f2a9aa803c17624f575cee77179bc
@@ -123,6 +123,25 @@ module RailsEventStoreActiveRecord
123
123
  .map(&method(:build_event_instance))
124
124
  end
125
125
 
126
+ def read_event(event_id)
127
+ event = Event.find(event_id)
128
+ serialized_record = RubyEventStore::SerializedRecord.new(
129
+ event_id: event.id,
130
+ metadata: event.metadata,
131
+ data: event.data,
132
+ event_type: event.event_type
133
+ )
134
+ mapper.serialized_record_to_event(serialized_record)
135
+ rescue ActiveRecord::RecordNotFound
136
+ raise RubyEventStore::EventNotFound
137
+ end
138
+
139
+ def get_all_streams
140
+ (["all"] + EventInStream.pluck(:stream))
141
+ .uniq
142
+ .map { |name| RubyEventStore::Stream.new(name) }
143
+ end
144
+
126
145
  private
127
146
 
128
147
  attr_reader :mapper
@@ -112,6 +112,16 @@ instead:
112
112
  .map(&method(:build_event_entity))
113
113
  end
114
114
 
115
+ def read_event(event_id)
116
+ build_event_entity(LegacyEvent.find_by(event_id: event_id)) or raise RubyEventStore::EventNotFound
117
+ end
118
+
119
+ def get_all_streams
120
+ (["all"] + LegacyEvent.pluck(:stream))
121
+ .uniq
122
+ .map { |name| RubyEventStore::Stream.new(name) }
123
+ end
124
+
115
125
  private
116
126
 
117
127
  def normalize_to_array(events)
@@ -1,3 +1,3 @@
1
1
  module RailsEventStoreActiveRecord
2
- VERSION = "0.20.0"
2
+ VERSION = "0.21.0"
3
3
  end
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'fakefs', '~> 0.11.2'
31
31
  spec.add_development_dependency 'childprocess'
32
32
 
33
- spec.add_dependency 'ruby_event_store', '= 0.20.0'
33
+ spec.add_dependency 'ruby_event_store', '= 0.21.0'
34
34
  spec.add_dependency 'activesupport', '>= 3.0'
35
35
  spec.add_dependency 'activemodel', '>= 3.0'
36
36
  spec.add_dependency 'activerecord-import', '~> 0.21'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_event_store_active_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkency
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-24 00:00:00.000000000 Z
11
+ date: 2017-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - '='
158
158
  - !ruby/object:Gem::Version
159
- version: 0.20.0
159
+ version: 0.21.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - '='
165
165
  - !ruby/object:Gem::Version
166
- version: 0.20.0
166
+ version: 0.21.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: activesupport
169
169
  requirement: !ruby/object:Gem::Requirement