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: 8c966005ba0e6f9546fb783f7fe9b937a7cd81f81c548327eaeff46cbe75d89d
4
- data.tar.gz: 451f4dd532c5a2eb697259865b932ad7702f319148f332e9966b094937c8cedf
3
+ metadata.gz: 9dbb4a5e4c4efd90af879a50727d45c3c7c9ed6174bc11152cbf13f979db8953
4
+ data.tar.gz: fd1904c359e51831545a41b7768a5c4e004999bb886eb86a742ebff3c6171ff2
5
5
  SHA512:
6
- metadata.gz: 5d6f2967605412d36eb20656c89a838f30e3daa876cd0cd55431a7f97a86f9160d1da8e7902b128f5b9f07b93411f446ffb2058a877441eeb22bc6b899d323d9
7
- data.tar.gz: 8979409e44faff9cdee69ed7df66838308eb1201c9b5e608796fbf02fa330fe7cd2b311020b5fcf12c26eef67c6ad0506c830a7ef8f5b2d5fd501dfa991bffeb
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'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PuzzlyApiPlugin
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -3,20 +3,24 @@
3
3
  module PuzzlyApiPlugin
4
4
  class TopicView < Renderable
5
5
  def self.create(topic)
6
- mod = ModulesCollection.instance.get_by_id topic.module_id
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(mod.to_identity,
10
- schema.to_identity,
11
- topic)
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(mod, schema, topic)
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::MODULE] = mod
22
+ self[MetadataFields::PRODUCED_BY] = producers
23
+ self[MetadataFields::CONSUMED_BY] = consumers
20
24
  self[MetadataFields::SCHEMA] = schema
21
25
  end
22
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puzzly_api_plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mr. Braz