evt-messaging 0.12.1.1 → 0.12.2.0

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: effcc3ded138daa8b517eb5e80197ad31cf4c7e8
4
- data.tar.gz: b437208e3d5ab3f8168a9a90cf55b86d2a9f6dd6
3
+ metadata.gz: edf04d6af1c5401988e9b9dc1e04c512335da2bd
4
+ data.tar.gz: c013a31f9aba194605b14edbf70d496f048e4188
5
5
  SHA512:
6
- metadata.gz: 308180eda251763d51fad503f66b85dc5faff75063157bf9bc32b98e311c46fad15c4c238557a85f77e93d755fcf3a485b0e0354efd78064c30807e29e76d2fb
7
- data.tar.gz: 58381e524f1e9cfa439bb887b6059e963166a4b866578a51762f2acce6cbc22d94f070a8b24df6b916c3a7a83b12a878797897ca9aeaea5d87f206cfd77ee7df
6
+ metadata.gz: e21bcafb52a0ce7ad263e5a97fe5c581687ba816380c32fdcf227e408de399ba896fd1d3b16116e4cf2aa0a0863973240c978ae3f28bf6a43de70d116cf2e87e
7
+ data.tar.gz: faec568868e826fd213934360148743694df41859b271357b92ef436f4a72304f5d294908553f279d3580013e5c8d42a1c98aa92175dbef33fc57aae9eee390f
@@ -29,13 +29,27 @@ module Messaging
29
29
  end
30
30
  end
31
31
 
32
- def written?(&blk)
32
+ def written?(message=nil, &blk)
33
+ if message.nil?
34
+ if blk.nil?
35
+ return sink.recorded_written?
36
+ end
37
+
38
+ return sink.recorded_written? do |record|
39
+ blk.call(record.data.message, record.data.stream_name, record.data.expected_version, record.data.reply_stream_name)
40
+ end
41
+ end
42
+
43
+ written = sink.recorded_written? do |record|
44
+ record.data.message == message
45
+ end
46
+
33
47
  if blk.nil?
34
- return sink.recorded_written?
48
+ return written
35
49
  end
36
50
 
37
51
  sink.recorded_written? do |record|
38
- blk.call(record.data.message, record.data.stream_name, record.data.expected_version, record.data.reply_stream_name)
52
+ blk.call(record.data.stream_name, record.data.expected_version, record.data.reply_stream_name)
39
53
  end
40
54
  end
41
55
 
@@ -49,15 +63,59 @@ module Messaging
49
63
  end
50
64
  end
51
65
 
52
- def replied?(&blk)
66
+ def replied?(message=nil, &blk)
67
+ # if blk.nil?
68
+ # return sink.recorded_replied?
69
+ # end
70
+
71
+ # sink.recorded_replied? do |record|
72
+ # blk.call(record.data.message, record.data.stream_name)
73
+ # end
74
+
75
+ if message.nil?
76
+ if blk.nil?
77
+ return sink.recorded_replied?
78
+ end
79
+
80
+ return sink.recorded_replied? do |record|
81
+ blk.call(record.data.message, record.data.stream_name)
82
+ end
83
+ end
84
+
85
+ written = sink.recorded_replied? do |record|
86
+ record.data.message == message
87
+ end
88
+
53
89
  if blk.nil?
54
- return sink.recorded_replied?
90
+ return written
55
91
  end
56
92
 
57
93
  sink.recorded_replied? do |record|
58
- blk.call(record.data.message, record.data.stream_name)
94
+ blk.call(record.data.stream_name)
59
95
  end
60
96
  end
97
+
98
+ def message_writes(&blk)
99
+ if blk.nil?
100
+ return sink.written_records.map { |record| record.data.message }
101
+ end
102
+
103
+ sink.written_records.select do |record|
104
+ blk.call(record.data.message, record.data.stream_name, record.data.expected_version, record.data.reply_stream_name)
105
+ end.map { |record| record.data.message }
106
+ end
107
+ alias :messages :message_writes
108
+
109
+ def message_replies(&blk)
110
+ if blk.nil?
111
+ return sink.replied_records.map { |record| record.data.message }
112
+ end
113
+
114
+ sink.replied_records.select do |record|
115
+ blk.call(record.data.message, record.data.stream_name)
116
+ end.map { |record| record.data.message }
117
+ end
118
+ alias :replies :message_replies
61
119
  end
62
120
  end
63
121
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-messaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1.1
4
+ version: 0.12.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-04-04 00:00:00.000000000 Z
11
+ date: 2017-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-event_source