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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62e3e21a10c5894532a4f809f7d8017362b3aae5
4
- data.tar.gz: 105b86c817f47e20213f96848527a3f35fdf5eae
3
+ metadata.gz: 7515c83c76326bef152d103f113bc44469a4bfed
4
+ data.tar.gz: 2c47da3f04cceacfd72f39b4d90b423082a52706
5
5
  SHA512:
6
- metadata.gz: bc611a292fccf31c6c9f6a4ba13d02555f7ffbe60595c3f392f4b097a30daa6a85848b265e8c07e5c00eccc2b206b58aa709408bf559cded6bd46a917e3e75d6
7
- data.tar.gz: 03b612de23ff6898378f844fdccb7d9d0776d5631ff8ef7c49eace37323fd41f454b75f1e69c307ecd4fd58764137831174e631d5b3aeab74a808bbc6178fe84
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
@@ -1,4 +1,4 @@
1
1
  # This file specifies the current version of the gem.
2
2
  module DispatchRider
3
- VERSION = "1.3.6"
3
+ VERSION = "1.4.0"
4
4
  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.3.6
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: 2014-11-15 00:00:00.000000000 Z
14
+ date: 2015-03-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport