publisher_renote_dac 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/services/publisher_renote_dac/publisher.rb +27 -0
- data/lib/generators/publisher_renote_dac/install_generator.rb +12 -0
- data/lib/generators/publisher_renote_dac/templates/initializer.rb +17 -0
- data/lib/publisher_renote_dac/version.rb +1 -1
- metadata +4 -2
- data/app/services/publishe_renote_dac/publisher.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66230106e86425b5dd5b5846ce9b903d71b636c4a8e3d2b5a66da558d4aed264
|
4
|
+
data.tar.gz: defb25c15170057b09f669a7cdeb0a47bab8cad878ac3062fd0c99e8e5fee9eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a918032e3d0da1b650dba35093c799653f90dc6b0cc233b3155dad72a7d6a6e20dc8b355923509d1052ef612b58022295a586162bd73220ffb0616676f497c30
|
7
|
+
data.tar.gz: b570a7e157d0578402dc571f47a755f532adc29f1986270204ffb514ad43cb9398511b6ad0b1bfbb64b3fdd65d3afae49765fd26a41ec21dd4a55e9c2cabd643
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module PublisherRenoteDac
|
2
|
+
|
3
|
+
class Publisher
|
4
|
+
def self.publish(exchange, message = {})
|
5
|
+
x = channel.fanout("email.#{exchange}")
|
6
|
+
x.publish(message.to_json)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.channel
|
10
|
+
@channel ||= connection.create_channel
|
11
|
+
end
|
12
|
+
|
13
|
+
# We are using default settings here
|
14
|
+
# The `Bunny.new(...)` is a place to
|
15
|
+
# put any specific RabbitMQ settings
|
16
|
+
# like host or port
|
17
|
+
def self.connection
|
18
|
+
@connection ||= Bunny.new(
|
19
|
+
:vhost => PublisherRenoteDac.configuration.vhost,
|
20
|
+
:user => PublisherRenoteDac.configuration.username,
|
21
|
+
:password => PublisherRenoteDac.configuration.password
|
22
|
+
).tap do |c|
|
23
|
+
c.start
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module PublisherRenoteDac
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../templates", __FILE__)
|
5
|
+
|
6
|
+
desc "This generator creates a publisher_renote_dac.rb initializer file at config/initializers"
|
7
|
+
def create_initializer_file
|
8
|
+
template "initializer.rb", "config/initializers/publisher_renote_dac.rb"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
PublisherRenoteDac.configure do |c|
|
2
|
+
c.username = '1234567890'
|
3
|
+
c.password = '3456789012'
|
4
|
+
c.heartbeat = 2
|
5
|
+
c.exchange = 'sneakers'
|
6
|
+
c.exchange_type = :direct
|
7
|
+
c.vhost = '/'
|
8
|
+
c.rabbitmq_queue = 'queue.name.here'
|
9
|
+
c.prod_base_url = 'http://localhost:3000'
|
10
|
+
c.dev_base_url = 'http://localhost:3000'
|
11
|
+
c.from_address = 'Your App Name <app@name.com>'
|
12
|
+
|
13
|
+
# sets PublisherRenoteDac to inherit directly from parent app ApplicationController. use '::' to get to the root controller
|
14
|
+
# defaults to '::ApplicationController'
|
15
|
+
c.base_controller = '::ApplicationController'
|
16
|
+
end
|
17
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: publisher_renote_dac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sidney Leatherwood
|
@@ -64,8 +64,10 @@ files:
|
|
64
64
|
- Rakefile
|
65
65
|
- app/controllers/publisher_renote_dac/application_controller.rb
|
66
66
|
- app/models/publisher_renote_dac/application_record.rb
|
67
|
-
- app/services/
|
67
|
+
- app/services/publisher_renote_dac/publisher.rb
|
68
68
|
- config/routes.rb
|
69
|
+
- lib/generators/publisher_renote_dac/install_generator.rb
|
70
|
+
- lib/generators/publisher_renote_dac/templates/initializer.rb
|
69
71
|
- lib/publisher_renote_dac.rb
|
70
72
|
- lib/publisher_renote_dac/configuration.rb
|
71
73
|
- lib/publisher_renote_dac/engine.rb
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module PublisherRenoteDac
|
2
|
-
|
3
|
-
class Publisher
|
4
|
-
def self.publish(exchange, message = {})
|
5
|
-
x = channel.fanout("email.#{exchange}")
|
6
|
-
x.publish(message.to_json)
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.channel
|
10
|
-
@channel ||= connection.create_channel
|
11
|
-
end
|
12
|
-
|
13
|
-
# We are using default settings here
|
14
|
-
# The `Bunny.new(...)` is a place to
|
15
|
-
# put any specific RabbitMQ settings
|
16
|
-
# like host or port
|
17
|
-
def self.connection
|
18
|
-
@connection ||= Bunny.new(
|
19
|
-
:vhost => PublisherRenoteDac.configuration.vhost,
|
20
|
-
:user => PublisherRenoteDac.configuration.username,
|
21
|
-
:password => PublisherRenoteDac.configuration.password
|
22
|
-
).tap do |c|
|
23
|
-
c.start
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
end
|