evt-entity_snapshot-event_store 0.1.1.1 → 0.1.2.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: f931e817dc971f2040188f59c542837a93e09f25
4
- data.tar.gz: dc1b4048b056910f4a4c1c1d222c1ab0f25f0bc4
3
+ metadata.gz: 2877039b507ae94a541b41487e052ae04e1c9474
4
+ data.tar.gz: 73d83c4fd6b1d028dea7d03713f353f981cbbf3e
5
5
  SHA512:
6
- metadata.gz: c57b767be2b97a05b29a80a748e93ab94ada7c7ebd7f3b589ce43c94f73e4769ba6a8217c64bf0d951a5c9a65b4c9bab8c95c47c1206bd0e78d4c018c7efd40e
7
- data.tar.gz: 29e0ee2c5d7ed038ca217e7c048050e39bc260d3bb4f7b3564eaa2f19dfd9b73de2ec3b49a7e586f1a85a57b1d696c47f62132ab1e2ac1fd66c56c216fed44bc
6
+ metadata.gz: 3150f2f2af63b474809c640760a7d55dc853e87e66c8170532d329b09a38c5c021dcaeb3abc3d32fc770c204381e3f62cf4f46c23ff90b13ab13a5dc2efcc4f7
7
+ data.tar.gz: 2c4851a7bfb7f88f4777806a465bf26ee276d4339608668ea3cbff8f02b113a4f8c8722060ac50f077cebe219881278df82e690770bcd16ef40f58c83841104a
@@ -7,6 +7,7 @@ require 'entity_snapshot/event_store/controls/version'
7
7
  require 'entity_snapshot/event_store/controls/message'
8
8
  require 'entity_snapshot/event_store/controls/batch'
9
9
  require 'entity_snapshot/event_store/controls/entity'
10
+ require 'entity_snapshot/event_store/controls/random_value'
10
11
  require 'entity_snapshot/event_store/controls/snapshot'
11
12
  require 'entity_snapshot/event_store/controls/write'
12
13
  require 'entity_snapshot/event_store/controls/entity_store'
@@ -3,29 +3,44 @@ module EntitySnapshot
3
3
  module Controls
4
4
  module Entity
5
5
  def self.example
6
- Example.build(Data.example)
6
+ attributes = {
7
+ :some_attribute => RandomValue.example,
8
+ :some_time => Time::Raw.example
9
+ }
10
+
11
+ Example.build(attributes)
7
12
  end
8
13
 
9
14
  class Example
10
15
  include Schema::DataStructure
11
16
 
12
- attribute :some_attribute
17
+ attribute :some_attribute, String
18
+ attribute :some_time, ::Time
13
19
 
14
20
  module Transformer
15
21
  def self.raw_data(instance)
16
- instance.to_h
22
+ {
23
+ :some_attribute => instance.some_attribute,
24
+ :some_time => Clock.iso8601(instance.some_time)
25
+ }
17
26
  end
18
27
 
19
28
  def self.instance(raw_data)
20
- Example.build(raw_data)
29
+ Example.build({
30
+ :some_attribute => raw_data[:some_attribute],
31
+ :some_time => Clock.parse(raw_data[:some_time])
32
+ })
21
33
  end
22
34
  end
23
35
  end
24
36
 
25
37
  module Data
26
- def self.example
38
+ def self.example(some_attribute=nil)
39
+ some_attribute ||= RandomValue.example
40
+
27
41
  {
28
- some_attribute: MessageStore::Controls::RandomValue.example
42
+ some_attribute: some_attribute,
43
+ some_time: Time::ISO8601.example
29
44
  }
30
45
  end
31
46
  end
@@ -0,0 +1,7 @@
1
+ module EntitySnapshot
2
+ class EventStore
3
+ module Controls
4
+ RandomValue = MessageStore::Controls::RandomValue
5
+ end
6
+ end
7
+ end
@@ -63,7 +63,10 @@ module EntitySnapshot
63
63
  return
64
64
  end
65
65
 
66
- entity = entity_class.build(event_data.data[:entity_data])
66
+ entity_data = event_data.data[:entity_data]
67
+
68
+ entity = Transform::Read.instance(entity_data, entity_class)
69
+
67
70
  version = event_data.data[:entity_version]
68
71
  time = event_data.time
69
72
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-entity_snapshot-event_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.1
4
+ version: 0.1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-17 00:00:00.000000000 Z
11
+ date: 2017-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-entity_store
@@ -65,6 +65,7 @@ files:
65
65
  - lib/entity_snapshot/event_store/controls/entity_store.rb
66
66
  - lib/entity_snapshot/event_store/controls/id.rb
67
67
  - lib/entity_snapshot/event_store/controls/message.rb
68
+ - lib/entity_snapshot/event_store/controls/random_value.rb
68
69
  - lib/entity_snapshot/event_store/controls/snapshot.rb
69
70
  - lib/entity_snapshot/event_store/controls/stream_name.rb
70
71
  - lib/entity_snapshot/event_store/controls/time.rb