puzzly_api_plugin 0.1.0 → 0.1.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dbb4a5e4c4efd90af879a50727d45c3c7c9ed6174bc11152cbf13f979db8953
|
4
|
+
data.tar.gz: fd1904c359e51831545a41b7768a5c4e004999bb886eb86a742ebff3c6171ff2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ee4e350f7a42bbd2df0eac23fcdbe8dd0cb7ed74cba745ce0ad20b821603a52682047b8951674822739e7f16e76854812bc6c1ec82c9a6a5611bdd15f5024f7
|
7
|
+
data.tar.gz: a40a151aa4ba31de1ad34b2aa2a2aea61f968ef1aec93736df01ea163e2852189a5e9bfadcad748676a7ae6c4ba24cad705a432589366438c3584d7529975d0a
|
@@ -12,5 +12,13 @@ module PuzzlyApiPlugin
|
|
12
12
|
def get_by_context(context)
|
13
13
|
select { |_id, mod| mod.context_id <=> context.id }
|
14
14
|
end
|
15
|
+
|
16
|
+
def get_consumers(topic)
|
17
|
+
select { |_id, mod| mod.consumesTopics.include? topic.id }
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_producers(topic)
|
21
|
+
select { |_id, mod| mod.producesTopics.include? topic.id }
|
22
|
+
end
|
15
23
|
end
|
16
24
|
end
|
@@ -26,7 +26,10 @@ module PuzzlyApiPlugin
|
|
26
26
|
NUMBER_OF_CONTEXTS = 'numberOfContexts'
|
27
27
|
|
28
28
|
CONSUMES_TOPICS = 'consumesTopics'
|
29
|
+
CONSUMED_BY = 'consumedBy'
|
30
|
+
|
29
31
|
PRODUCES_TOPICS = 'producesTopics'
|
32
|
+
PRODUCED_BY = 'producedBy'
|
30
33
|
|
31
34
|
MODULES = 'modules'
|
32
35
|
NUMBER_OF_MODULES = 'numberOfModules'
|
@@ -3,20 +3,24 @@
|
|
3
3
|
module PuzzlyApiPlugin
|
4
4
|
class TopicView < Renderable
|
5
5
|
def self.create(topic)
|
6
|
-
|
6
|
+
consumers = ModulesCollection.instance.get_consumers topic
|
7
|
+
producers = ModulesCollection.instance.get_producers topic
|
8
|
+
|
7
9
|
schema = SchemasCollection.instance.get_by_id topic.schema_id
|
8
10
|
|
9
|
-
TopicView.new(
|
10
|
-
|
11
|
-
|
11
|
+
TopicView.new(topic,
|
12
|
+
producers.map{|_id, producer| producer.to_identity},
|
13
|
+
consumers.map{|_id, consumer| consumer.to_identity},
|
14
|
+
schema.to_identity)
|
12
15
|
end
|
13
16
|
|
14
|
-
def initialize(
|
17
|
+
def initialize(topic, producers, consumers, schema)
|
15
18
|
topic.copy_to_hash self
|
16
19
|
self.delete MetadataFields::MODULE_ID
|
17
20
|
self.delete MetadataFields::SCHEMA_ID
|
18
21
|
|
19
|
-
self[MetadataFields::
|
22
|
+
self[MetadataFields::PRODUCED_BY] = producers
|
23
|
+
self[MetadataFields::CONSUMED_BY] = consumers
|
20
24
|
self[MetadataFields::SCHEMA] = schema
|
21
25
|
end
|
22
26
|
end
|