pubnub 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pubnub might be problematic. Click here for more details.

Files changed (3) hide show
  1. data/examples/publish_example.rb +2 -1
  2. data/lib/pubnub.rb +52 -2
  3. metadata +7 -14
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  ## -----------------------------------
2
3
  ## PubNub Ruby API Publish Example
3
4
  ## -----------------------------------
@@ -10,7 +11,7 @@ require 'pubnub'
10
11
  publish_key = 'demo'
11
12
  subscribe_key = 'demo'
12
13
  secret_key = 'demo'
13
- cipher_key = 'demo'
14
+ cipher_key = ''
14
15
  ssl_on = false
15
16
  channel = 'hello_world'
16
17
 
@@ -29,7 +29,7 @@ class Pubnub
29
29
  MAX_RETRIES = 3
30
30
  retries=0
31
31
  #**
32
- #* Pubnub
32
+ #* Pubnub 3.1 with Cipher Key
33
33
  #*
34
34
  #* Init the Pubnub Client API
35
35
  #*
@@ -54,6 +54,54 @@ class Pubnub
54
54
  end
55
55
  end
56
56
 
57
+ #**
58
+ #* Pubnub 3.0 Compatibility
59
+ #*
60
+ #* Init the Pubnub Client API
61
+ #*
62
+ #* @param string publish_key required key to send messages.
63
+ #* @param string subscribe_key required key to receive messages.
64
+ #* @param string secret_key required key to sign messages.
65
+ #* @param boolean ssl required for 2048 bit encrypted messages.
66
+ #*
67
+ def initialize( publish_key, subscribe_key, secret_key, ssl_on )
68
+ @publish_key = publish_key
69
+ @subscribe_key = subscribe_key
70
+ @secret_key = secret_key
71
+ @cipher_key = ''
72
+ @ssl = ssl_on
73
+ @origin = 'pubsub.pubnub.com'
74
+
75
+ if @ssl
76
+ @origin = 'https://' + @origin
77
+ else
78
+ @origin = 'http://' + @origin
79
+ end
80
+ end
81
+
82
+ #**
83
+ #* Pubnub 2.0 Compatibility
84
+ #*
85
+ #* Init the Pubnub Client API
86
+ #*
87
+ #* @param string publish_key required key to send messages.
88
+ #* @param string subscribe_key required key to receive messages.
89
+ #*
90
+ def initialize( publish_key, subscribe_key )
91
+ @publish_key = publish_key
92
+ @subscribe_key = subscribe_key
93
+ @secret_key = ''
94
+ @cipher_key = ''
95
+ @ssl = false
96
+ @origin = 'pubsub.pubnub.com'
97
+
98
+ if @ssl
99
+ @origin = 'https://' + @origin
100
+ else
101
+ @origin = 'http://' + @origin
102
+ end
103
+ end
104
+
57
105
  #**
58
106
  #* Publish
59
107
  #*
@@ -269,7 +317,9 @@ class Pubnub
269
317
  EventMachine.stop
270
318
  }.resume
271
319
  end
272
- JSON.parse(http_response)
320
+ if(http_response != '')
321
+ JSON.parse(http_response)
322
+ end
273
323
  end
274
324
 
275
325
  ## Non-blocking IO using EventMachine
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubnub
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 1
9
- - 9
10
- version: 0.1.9
8
+ - 10
9
+ version: 0.1.10
11
10
  platform: ruby
12
11
  authors:
13
12
  - Luke Carpenter / PubNub.com
@@ -15,17 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2012-06-07 00:00:00 Z
17
+ date: 2012-06-20 00:00:00 -07:00
18
+ default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: em-http-request
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
24
  requirements:
26
25
  - - ">="
27
26
  - !ruby/object:Gem::Version
28
- hash: 19
29
27
  segments:
30
28
  - 1
31
29
  - 0
@@ -37,11 +35,9 @@ dependencies:
37
35
  name: json
38
36
  prerelease: false
39
37
  requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
38
  requirements:
42
39
  - - ">="
43
40
  - !ruby/object:Gem::Version
44
- hash: 3
45
41
  segments:
46
42
  - 0
47
43
  version: "0"
@@ -64,6 +60,7 @@ files:
64
60
  - lib/pubnub_crypto.rb
65
61
  - tests/unit_test.rb
66
62
  - README
63
+ has_rdoc: true
67
64
  homepage: http://github.com/pubnub/pubnub-api
68
65
  licenses:
69
66
  - MIT
@@ -73,27 +70,23 @@ rdoc_options: []
73
70
  require_paths:
74
71
  - lib
75
72
  required_ruby_version: !ruby/object:Gem::Requirement
76
- none: false
77
73
  requirements:
78
74
  - - ">="
79
75
  - !ruby/object:Gem::Version
80
- hash: 3
81
76
  segments:
82
77
  - 0
83
78
  version: "0"
84
79
  required_rubygems_version: !ruby/object:Gem::Requirement
85
- none: false
86
80
  requirements:
87
81
  - - ">="
88
82
  - !ruby/object:Gem::Version
89
- hash: 3
90
83
  segments:
91
84
  - 0
92
85
  version: "0"
93
86
  requirements: []
94
87
 
95
88
  rubyforge_project:
96
- rubygems_version: 1.8.5
89
+ rubygems_version: 1.3.6
97
90
  signing_key:
98
91
  specification_version: 3
99
92
  summary: PubNub Official GEM