simplepubsub 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d5310190ab3254685434ea4d3d7d0176ad46be96
4
+ data.tar.gz: 8b36f6d13d96c9b2c7a8e45930e5d71c0330919b
5
+ SHA512:
6
+ metadata.gz: e2047c43831ac9f8893fa6935c1be6020bc34f3cf21cd6f8d9e7004ccb15186dc2676facb95ffff9254517a4a4a34fe8b696fad1b362f389c77dec657ee5653f
7
+ data.tar.gz: 8c387ce506f36672b9a05b8112305e162357fac0a951daecaaf3473c7f2d1322758a29388e24f35e24c9615d97625347358348019a1837b168ebc137e9e1ba9e
checksums.yaml.gz.sig ADDED
Binary file
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: simplepubsub.rb
4
+
5
+ require 'open-uri'
6
+ require 'drb'
7
+
8
+
9
+ USER_AGENT = 'SimplePubSub client 0.1'
10
+
11
+ module SimplePubSub
12
+
13
+ class Client
14
+ class PubSub
15
+
16
+ class Echo
17
+
18
+ def initialize(&get_proc)
19
+ @get_proc = get_proc
20
+ end
21
+
22
+ def message(topic, message)
23
+ @get_proc.call topic, message
24
+ end
25
+ end
26
+
27
+ def initialize(base_url)
28
+ @base_url = base_url
29
+ end
30
+
31
+ def get(topic, &get_proc)
32
+
33
+ DRb.start_service nil, Echo.new(&get_proc)
34
+ r = open("http://#{@base_url}/do/simplepubsub/" + \
35
+ "subscribe?topic=#{topic}&uri=" + \
36
+ DRb.uri, 'UserAgent' => USER_AGENT){|x| x.read}
37
+ DRb.thread.join
38
+
39
+ end
40
+
41
+ def publish(topic, message)
42
+
43
+ params = "/do/simplepubsub/publish?topic=%s&message=%s" % \
44
+ [URI.escape(topic),URI.escape(message)]
45
+ open('http://' + @base_url + params, 'UserAgent' => USER_AGENT)\
46
+ {|x| x.read}
47
+ end
48
+ end
49
+
50
+ def self.connect(base_url)
51
+ yield(PubSub.new base_url)
52
+ end
53
+ end
54
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simplepubsub
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTEzMDYxMzE4MzEwNloXDTE0MDYxMzE4MzEwNlowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBANfWZSPkb3SO0BM5jfTmO5ylGI/cVztwY36r6zhkivdPyHxn9zLsYF2mMSvO
19
+ dUnG+JJGPJhpy/qycqRfsikS1CORLI4BGffqinFGd9cCLmiJrOXsiSKY+lDVAm4G
20
+ uo0U3uckoDRmJbz6rjqPjan7ihC0MAyi5MFjgKRfxzKsFfRrZuPy8lnnFCYdEIQc
21
+ F8LxsUP5ZeBLVn8ecMkirAXfpbUgGp4aGWCazkoygiQesZZ55IUIl8fKrgmQ7i1I
22
+ 4A7W6ZwSe6ZY2y+plWGnf/ds5KcUjuGP29P4e0f2EsFXuHESIRJAvdKpDYuz4vNJ
23
+ mFT8r6Umq9LyIBES3JY1J6dxTzECAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUcFsisZOwRgK+ET71eec8rD0GWTwwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAH6WfaknF
27
+ rPo7zRx6dyMaBGKDxqGvmrsUHFsiN/Ck762qvx+BUOfZFAit4ItTv1byqagU1mA1
28
+ 4jeX+nozK5F4Q8D+vTX1gzmWTL66Y1mYQ94iqIufRjl6MyHrsI0SBEvkj8k7vQvk
29
+ Y/ZGjKI1onZm3qotZlmW+YM4p9iHCASDDladI1hR/wpQ953+7Tr/SxkcgaYJDsyK
30
+ ItQZ+BbGa0bgmBUDnLC7vJQ+Y8nXTpE9HlGSmVecUkIl7vpkJR/E28GwLZd2MOEL
31
+ i0PBE6fLwlIMk8jNNUcX3J1csSMgLNTwE8CwrlSZE8sueHj0pQzICM7lF0gGREO6
32
+ hQHD0LljU3MusQ==
33
+ -----END CERTIFICATE-----
34
+ date: 2013-06-13 00:00:00.000000000 Z
35
+ dependencies: []
36
+ description:
37
+ email:
38
+ executables: []
39
+ extensions: []
40
+ extra_rdoc_files: []
41
+ files:
42
+ - lib/simplepubsub.rb
43
+ homepage:
44
+ licenses: []
45
+ metadata: {}
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 2.0.0.rc.2
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: simplepubsub
66
+ test_files: []
metadata.gz.sig ADDED
Binary file