irfsdash 0.0.2 → 0.0.3

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.
data/irfsdash.gemspec CHANGED
@@ -16,6 +16,6 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
- gem.add_dependency('amqp', '>= 0.9.8')
19
+ gem.add_dependency('bunny', '>= 0.8.0')
20
20
  gem.add_dependency('json', '>= 1.7.5')
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module IRFSDash
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/irfsdash.rb CHANGED
@@ -1,17 +1,11 @@
1
1
  require "irfsdash/version"
2
- require "amqp"
2
+ require "bunny"
3
3
  require "json"
4
4
  module IRFSDash
5
5
  # Returns an AMQP channel
6
- def self.amqp_channel
7
- @amqp_connection ||= AMQP.connect(:host => '127.0.0.1')
8
- @amqp_channel ||= AMQP::Channel.new(@amqp_connection)
9
- return @amqp_channel
10
- end
11
- def self.amqp_exchange(name, opts={})
12
- @amqp_exchanges ||= {}
13
- @amqp_exchanges[name] ||= AMQP::Exchange.new(name, opts)
14
- return @amqp_exchanges[name]
6
+ def self.amqp
7
+ @b ||= Bunny.new
8
+ @q ||= b.queue("")
15
9
  end
16
10
  # Setup the library's defaults
17
11
  def self.setup(opts={})
@@ -24,7 +18,7 @@ module IRFSDash
24
18
  raise ArgumentError, "No source specified" unless msg[:source]
25
19
  raise ArgumentError, "No content specified" unless msg[:content]
26
20
  raise ArgumentError, "No type specified" unless msg[:type]
27
- self.amqp_channel.fanout("irfs-dashboard.activity").publish(JSON.dump(msg))
21
+ self.amqp.exchange("irfs-dashboard.activity", type: :fanout).publish(JSON.dump(msg))
28
22
  end
29
23
  # Publish a project update
30
24
  # Minimum: :source, :project, :happy
@@ -33,7 +27,7 @@ module IRFSDash
33
27
  raise ArgumentError, "No source specified" unless msg[:source]
34
28
  raise ArgumentError, "No project specified" unless msg[:project]
35
29
  raise ArgumentError, "No happy specified" unless msg[:happy]
36
- self.amqp_channel.fanout("irfs-dashboard.projects").publish(JSON.dump(msg))
30
+ self.amqp.exchange("irfs-dashboard.projects", type: :fanout).publish(JSON.dump(msg))
37
31
  end
38
32
  # Publish to the ticker
39
33
  # Minimum: :source, :content, :ticker_type
@@ -42,15 +36,15 @@ module IRFSDash
42
36
  raise ArgumentError, "No source specified" unless msg[:source]
43
37
  raise ArgumentError, "No content specified" unless msg[:content]
44
38
  raise ArgumentError, "No ticker type specified" unless msg[:ticker_type]
45
- self.amqp_channel.fanout("irfs-dashboard.tickers").publish(JSON.dump(msg))
39
+ self.amqp.exchange("irfs-dashboard.tickers", type: :fanout).publish(JSON.dump(msg))
46
40
  end
47
41
  # Publish a widget
48
42
  # Minimum: :source, (:content OR :url)
49
- def self.project(opts={})
43
+ def self.widget(opts={})
50
44
  msg = opts.merge!(@defaults)
51
45
  raise ArgumentError, "No source specified" unless msg[:source]
52
46
  raise ArgumentError, "No content or URL specified" unless msg[:url] or msg[:content]
53
- self.amqp_channel.fanout("irfs-dashboard.widgets").publish(JSON.dump(msg))
47
+ self.amqp.exchange("irfs-dashboard.widgets", type: :fanout).publish(JSON.dump(msg))
54
48
  end
55
49
 
56
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: irfsdash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,13 +12,13 @@ cert_chain: []
12
12
  date: 2012-10-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: amqp
15
+ name: bunny
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.9.8
21
+ version: 0.8.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.9.8
29
+ version: 0.8.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: json
32
32
  requirement: !ruby/object:Gem::Requirement