souls 0.40.1 → 0.40.2

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: e777d40acc58d576ed2f737e9524903c29e2cfe6a5242cbfa90ffa76292df395
4
- data.tar.gz: e793146caaf8286f1240441e0b9bfdc789f0aa3bc64bd231482d2da49586a905
3
+ metadata.gz: 830e9f1e9796eb865775399585c85ff3185a4896e43d815507db9b0a5774ab08
4
+ data.tar.gz: 41296eeb3bab8cb8e300625cf881f270cd526cbaf4f169eb74316e623910d8fd
5
5
  SHA512:
6
- metadata.gz: b9873772fe08923d77ba44a5c7a773689914f625060f30f6c16ec907cac2e07606ab0f0702973e7ff8d115fcb6bc2f6d3ec1567d67c66553ae8a75e9957f7247
7
- data.tar.gz: a1fb4a32637d210e27a42ee6d3755eb0089054a6841e00553d6705a08bad77279efeb4abf1fc0c0a9ff4746e94e979b19ece86b98b7df71491a5afe66260c431
6
+ metadata.gz: 998fdb38f2a8aa35557ab76a28992098e279ae8a2b8662348fe1b536389b7013302e544d583fdf75fd5d158c403c73e57b737d368806d8ece693e04855fe3d31
7
+ data.tar.gz: c646f6a1f8b6c558b4717ee1da213f9d613e5396523b56247bd545ff3d2510dc3620d71a6997523653c0fb3b6c3c364626db92ad27138999ab1d70df1d233617
@@ -23,7 +23,10 @@ module Souls
23
23
  end
24
24
 
25
25
  workers.each do |key, value|
26
- create_topic(topic_id: key) if value == 1
26
+ if value == 1
27
+ create_topic(topic_id: key)
28
+ create_push_subscription(topic_id: key)
29
+ end
27
30
  delete_topic(topic_id: key) if value == -1
28
31
  end
29
32
  workers
@@ -42,6 +45,24 @@ module Souls
42
45
  puts("Topic #{topic_id} deleted.")
43
46
  end
44
47
 
48
+ def create_push_subscription(topic_id: "mailer")
49
+ require("#{Souls.get_mother_path}/config/souls")
50
+ worker_name = topic_id.split("_")[0]
51
+
52
+ subscription_id = "#{topic_id}-sub"
53
+ endpoint = ""
54
+ worker_paths = Souls.configuration.workers
55
+ worker_paths.each do |worker|
56
+ endpoint = worker[:endpoint] if worker[:name] == worker_name
57
+ end
58
+
59
+ pubsub = Google::Cloud::Pubsub.new
60
+
61
+ topic = pubsub.topic(topic_id)
62
+ topic.subscribe(subscription_id, endpoint: endpoint)
63
+ puts("Push subscription #{subscription_id} created.")
64
+ end
65
+
45
66
  def get_workers
46
67
  require("#{Souls.get_mother_path}/config/souls")
47
68
  worker_paths = Souls.configuration.workers.map { |n| n[:name] }
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.40.1".freeze
2
+ VERSION = "0.40.2".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.19.1
1
+ 0.19.2
@@ -1 +1 @@
1
- 0.19.1
1
+ 0.19.2
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.40.1
4
+ version: 0.40.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI