dispatch-rider 1.3.6 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dispatch-rider/publisher.rb +15 -0
- data/lib/dispatch-rider/publisher/base.rb +0 -19
- data/lib/dispatch-rider/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7515c83c76326bef152d103f113bc44469a4bfed
|
4
|
+
data.tar.gz: 2c47da3f04cceacfd72f39b4d90b423082a52706
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66b625e6cc5c36b69542df68fda697348718f39e913226abc2a951a55af498cfc733fb58650d5cf37e2f09c8ec74c6227c78c33f47506caeef6b1f97f66c8e46
|
7
|
+
data.tar.gz: 80e307a4094cd0e2ec5be5a844c18b4279c54ba484ea99d867ef96808a0b920fda1e9ffb589a7dd5afcd280f602189094aa43894352ef044ac8bc1074c2f3327
|
@@ -35,11 +35,26 @@ module DispatchRider
|
|
35
35
|
|
36
36
|
def publish(opts = {})
|
37
37
|
options = opts.dup
|
38
|
+
add_message_id(options[:message])
|
38
39
|
service_channel_mapper.map(options.delete(:destinations)).each do |(service, channels)|
|
39
40
|
notification_service_registrar.fetch(service).publish(options.merge(:to => channels))
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
44
|
+
private
|
45
|
+
|
46
|
+
def add_message_id(message)
|
47
|
+
message[:body][:guid] = generate_new_message_id
|
48
|
+
end
|
49
|
+
|
50
|
+
def generate_new_message_id
|
51
|
+
if DispatchRider.config.debug
|
52
|
+
DispatchRider::Debug::PUBLISHER_MESSAGE_GUID
|
53
|
+
else
|
54
|
+
SecureRandom.uuid
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
43
58
|
class ServiceChannelMapper
|
44
59
|
attr_reader :destination_registrar
|
45
60
|
|
@@ -21,16 +21,6 @@ module DispatchRider
|
|
21
21
|
raise NotImplementedError
|
22
22
|
end
|
23
23
|
|
24
|
-
private
|
25
|
-
|
26
|
-
def generate_new_message_id
|
27
|
-
if DispatchRider.config.debug
|
28
|
-
DispatchRider::Debug::PUBLISHER_MESSAGE_GUID
|
29
|
-
else
|
30
|
-
SecureRandom.uuid
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
24
|
end
|
35
25
|
|
36
26
|
def initialize(publisher = nil)
|
@@ -39,9 +29,6 @@ module DispatchRider
|
|
39
29
|
|
40
30
|
def publish(body)
|
41
31
|
raise ArgumentError, 'body should be a hash' unless body.kind_of?(Hash)
|
42
|
-
body = body.merge({
|
43
|
-
'guid' => generate_new_message_id,
|
44
|
-
})
|
45
32
|
publisher.publish(destinations: destinations, message: { subject: subject, body: body })
|
46
33
|
end
|
47
34
|
|
@@ -57,11 +44,5 @@ module DispatchRider
|
|
57
44
|
self.class.instance_variable_get(:@subject)
|
58
45
|
end
|
59
46
|
|
60
|
-
private
|
61
|
-
|
62
|
-
def generate_new_message_id
|
63
|
-
self.class.send(:generate_new_message_id)
|
64
|
-
end
|
65
|
-
|
66
47
|
end
|
67
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dispatch-rider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Suman Mukherjee
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2015-03-10 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|