Module: IRFSDash
- Defined in:
- lib/irfsdash.rb,
lib/irfsdash/version.rb
Constant Summary collapse
- VERSION =
"0.0.4"
Class Method Summary collapse
-
.activity(opts = {}) ⇒ Object
Publish to the activity stream Minimum: :source, :content.
-
.amqp ⇒ Object
Returns an AMQP channel.
-
.project(opts = {}) ⇒ Object
Publish a project update Minimum: :source, :project, :happy.
-
.setup(opts = {}) ⇒ Object
Setup the library’s defaults.
-
.ticker(opts = {}) ⇒ Object
Publish to the ticker Minimum: :source, :content, :ticker_type.
-
.widget(opts = {}) ⇒ Object
Publish a widget Minimum: :source, (:content OR :url).
Class Method Details
.activity(opts = {}) ⇒ Object
Publish to the activity stream Minimum: :source, :content
15 16 17 18 19 20 21 |
# File 'lib/irfsdash.rb', line 15 def self.activity(opts={}) msg = opts.merge!(@defaults) raise ArgumentError, "No source specified" unless msg[:source] raise ArgumentError, "No content specified" unless msg[:content] raise ArgumentError, "No type specified" unless msg[:type] self.amqp.exchange("irfs-dashboard.activity", type: :fanout).publish(JSON.dump(msg)) end |
.amqp ⇒ Object
Returns an AMQP channel
6 7 8 |
# File 'lib/irfsdash.rb', line 6 def self.amqp @b ||= Bunny.new(host: 'localhost') end |
.project(opts = {}) ⇒ Object
Publish a project update Minimum: :source, :project, :happy
24 25 26 27 28 29 30 |
# File 'lib/irfsdash.rb', line 24 def self.project(opts={}) msg = opts.merge!(@defaults) raise ArgumentError, "No source specified" unless msg[:source] raise ArgumentError, "No project specified" unless msg[:project] raise ArgumentError, "No happy specified" unless msg[:happy] self.amqp.exchange("irfs-dashboard.projects", type: :fanout).publish(JSON.dump(msg)) end |
.setup(opts = {}) ⇒ Object
Setup the library’s defaults
10 11 12 |
# File 'lib/irfsdash.rb', line 10 def self.setup(opts={}) @defaults = opts end |
.ticker(opts = {}) ⇒ Object
Publish to the ticker Minimum: :source, :content, :ticker_type
33 34 35 36 37 38 39 |
# File 'lib/irfsdash.rb', line 33 def self.ticker(opts={}) msg = opts.merge!(@defaults) raise ArgumentError, "No source specified" unless msg[:source] raise ArgumentError, "No content specified" unless msg[:content] raise ArgumentError, "No ticker type specified" unless msg[:ticker_type] self.amqp.exchange("irfs-dashboard.tickers", type: :fanout).publish(JSON.dump(msg)) end |
.widget(opts = {}) ⇒ Object
Publish a widget Minimum: :source, (:content OR :url)
42 43 44 45 46 47 |
# File 'lib/irfsdash.rb', line 42 def self.(opts={}) msg = opts.merge!(@defaults) raise ArgumentError, "No source specified" unless msg[:source] raise ArgumentError, "No content or URL specified" unless msg[:url] or msg[:content] self.amqp.exchange("irfs-dashboard.widgets", type: :fanout).publish(JSON.dump(msg)) end |