osbourne 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/osbourne/test/mock_pubsub.rb +9 -1
- data/lib/osbourne/topic.rb +10 -2
- data/lib/osbourne/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09d9c82e18577ae64d95aec4a5b96d5dfee791ae61e913149388a683677f9133'
|
4
|
+
data.tar.gz: e7f178533fc85a6b912fd7755e42b930121b8b093e777edf24e9603e265d9a36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d8edb471d4cd35492270d3c90e2868f35b3b1c6703c6d50c3e3f55d9fe9c8e5f4cd2e6ed8dca36d15affd522e7157dd17fdcdcebaa82dd3ece036e6b8cb7a7b
|
7
|
+
data.tar.gz: c655b974afae2dc261b9e27a22ce7a34d2ee6fe309127502065e6ce896c4273a4723227140511235f5c0c6b4664129d098c04ed07ac1b24bd76fa3948d2744d9
|
@@ -6,11 +6,19 @@ module Osbourne
|
|
6
6
|
class MockPubsub
|
7
7
|
class << self
|
8
8
|
def mock_publish(topic, message)
|
9
|
+
parsed_message = parse(message)
|
9
10
|
Osbourne::WorkerBase.descendants.each do |worker|
|
10
|
-
msg = Osbourne::Test::Message.new(topic: topic, body:
|
11
|
+
msg = Osbourne::Test::Message.new(topic: topic, body: parsed_message)
|
11
12
|
worker.new.process(msg) if worker.config[:topic_names].include? topic
|
12
13
|
end
|
13
14
|
end
|
15
|
+
|
16
|
+
def parse(message)
|
17
|
+
return message if message.is_a?(String)
|
18
|
+
return message.to_json if message.respond_to?(:to_json)
|
19
|
+
|
20
|
+
raise ArgumentError, "Message must either be a string or respond to #to_json"
|
21
|
+
end
|
14
22
|
end
|
15
23
|
end
|
16
24
|
end
|
data/lib/osbourne/topic.rb
CHANGED
@@ -14,10 +14,11 @@ module Osbourne
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def publish(message)
|
17
|
+
parsed_message = parse(message)
|
17
18
|
return if Osbourne.test_mode?
|
18
19
|
|
19
|
-
Osbourne.logger.info "[PUB] TOPIC: `#{name}` MESSAGE: `#{
|
20
|
-
sns.publish(topic_arn: arn, message:
|
20
|
+
Osbourne.logger.info "[PUB] TOPIC: `#{name}` MESSAGE: `#{parsed_message}`"
|
21
|
+
sns.publish(topic_arn: arn, message: parsed_message)
|
21
22
|
end
|
22
23
|
|
23
24
|
private
|
@@ -34,5 +35,12 @@ module Osbourne
|
|
34
35
|
def subscriptions_cache_key
|
35
36
|
"existing_sqs_subscriptions_for_#{name}"
|
36
37
|
end
|
38
|
+
|
39
|
+
def parse(message)
|
40
|
+
return message if message.is_a?(String)
|
41
|
+
return message.to_json if message.respond_to?(:to_json)
|
42
|
+
|
43
|
+
raise ArgumentError, "Message must either be a string or respond to #to_json"
|
44
|
+
end
|
37
45
|
end
|
38
46
|
end
|
data/lib/osbourne/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osbourne
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Allen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|