magicbroker 0.2.0

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/Manifest ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ Rakefile
3
+ lib/broker.rb
4
+ lib/client/client.rb
5
+ Manifest
data/README.rdoc ADDED
@@ -0,0 +1 @@
1
+ Ruby gem for subscribing, unsubscribing and sending events to the Magic Broker 2
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('magicbroker', '0.2.0') do |p|
6
+ p.description = "The MAGIC-Broker-2 gem"
7
+ p.url = "https://github.com/magic-liam/broker-gem-0.2.0.git"
8
+ p.author = "Roberto Calderon"
9
+ p.email = "roberto@robertocalderon.ca"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
data/lib/broker.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Broker
2
+ autoload :Client, 'client/client'
3
+ end
@@ -0,0 +1,35 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+
4
+ module Broker
5
+
6
+ class Client
7
+
8
+ attr_accessor :server
9
+
10
+ def initialize (server, clientID, topic)
11
+ @server = server
12
+ @clientID = clientID
13
+ @topic = topic
14
+ end
15
+
16
+ def subscribe ()
17
+ servlet = 'http://'+@server+'/subscribe?clientID='+@clientID+'&topic='+@topic
18
+ Net::HTTP.get URI.parse(servlet)
19
+ end
20
+
21
+ def unsubscribe ()
22
+ servlet = 'http://'+@server+'/unsubscribe?clientID='+@clientID+'&topic='+@topic
23
+ Net::HTTP.get URI.parse(servlet)
24
+ end
25
+
26
+ def send_events(hash)
27
+ print
28
+ servlet = 'http://'+@server+'/event?clientID='+@clientID+'&topic='+@topic+'&_method=POST&'+hash.to_query
29
+ Net::HTTP.get_print URI.parse(servlet)
30
+ print servlet
31
+ end
32
+
33
+ end
34
+
35
+ end
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "magicbroker"
5
+ s.version = "0.2.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Roberto Calderon"]
9
+ s.date = "2012-08-11"
10
+ s.description = "The MAGIC-Broker-2 gem"
11
+ s.email = "roberto@robertocalderon.ca"
12
+ s.extra_rdoc_files = ["README.rdoc", "lib/broker.rb", "lib/client/client.rb"]
13
+ s.files = ["README.rdoc", "Rakefile", "lib/broker.rb", "lib/client/client.rb", "Manifest", "magicbroker.gemspec"]
14
+ s.homepage = "https://github.com/magic-liam/broker-gem-0.2.0.git"
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Magicbroker", "--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = "magicbroker"
18
+ s.rubygems_version = "1.8.24"
19
+ s.summary = "The MAGIC-Broker-2 gem"
20
+
21
+ if s.respond_to? :specification_version then
22
+ s.specification_version = 3
23
+
24
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
25
+ else
26
+ end
27
+ else
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: magicbroker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Roberto Calderon
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-11 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: The MAGIC-Broker-2 gem
15
+ email: roberto@robertocalderon.ca
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files:
19
+ - README.rdoc
20
+ - lib/broker.rb
21
+ - lib/client/client.rb
22
+ files:
23
+ - README.rdoc
24
+ - Rakefile
25
+ - lib/broker.rb
26
+ - lib/client/client.rb
27
+ - Manifest
28
+ - magicbroker.gemspec
29
+ homepage: https://github.com/magic-liam/broker-gem-0.2.0.git
30
+ licenses: []
31
+ post_install_message:
32
+ rdoc_options:
33
+ - --line-numbers
34
+ - --inline-source
35
+ - --title
36
+ - Magicbroker
37
+ - --main
38
+ - README.rdoc
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '1.2'
53
+ requirements: []
54
+ rubyforge_project: magicbroker
55
+ rubygems_version: 1.8.24
56
+ signing_key:
57
+ specification_version: 3
58
+ summary: The MAGIC-Broker-2 gem
59
+ test_files: []