pubnub 3.3.0.7 → 3.4
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.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.yardoc/checksums +13 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/LICENSE +27 -0
- data/README.md +259 -0
- data/Rakefile +7 -0
- data/VERSION +1 -0
- data/examples/demo_console.rb +198 -0
- data/examples/error_server.rb +28 -0
- data/examples/pubnub_livestream/.gitignore +16 -0
- data/examples/pubnub_livestream/Gemfile +51 -0
- data/examples/pubnub_livestream/Gemfile.lock +191 -0
- data/examples/pubnub_livestream/README.rdoc +28 -0
- data/examples/pubnub_livestream/Rakefile +6 -0
- data/examples/pubnub_livestream/app/assets/images/.keep +0 -0
- data/examples/pubnub_livestream/app/assets/javascripts/application.js +16 -0
- data/examples/pubnub_livestream/app/assets/javascripts/streamer.js.coffee +42 -0
- data/examples/pubnub_livestream/app/assets/stylesheets/application.css.sass +22 -0
- data/examples/pubnub_livestream/app/assets/stylesheets/streamer.css.scss +3 -0
- data/examples/pubnub_livestream/app/controllers/application_controller.rb +5 -0
- data/examples/pubnub_livestream/app/controllers/concerns/.keep +0 -0
- data/examples/pubnub_livestream/app/controllers/streamer_controller.rb +38 -0
- data/examples/pubnub_livestream/app/helpers/application_helper.rb +2 -0
- data/examples/pubnub_livestream/app/helpers/streamer_helper.rb +2 -0
- data/examples/pubnub_livestream/app/mailers/.keep +0 -0
- data/examples/pubnub_livestream/app/models/.keep +0 -0
- data/examples/pubnub_livestream/app/models/concerns/.keep +0 -0
- data/examples/pubnub_livestream/app/models/message.rb +11 -0
- data/examples/pubnub_livestream/app/views/layouts/application.html.erb +14 -0
- data/examples/pubnub_livestream/app/views/streamer/index.haml +22 -0
- data/examples/pubnub_livestream/bin/bundle +3 -0
- data/examples/pubnub_livestream/bin/rails +4 -0
- data/examples/pubnub_livestream/bin/rake +4 -0
- data/examples/pubnub_livestream/config.ru +4 -0
- data/examples/pubnub_livestream/config/application.rb +23 -0
- data/examples/pubnub_livestream/config/boot.rb +4 -0
- data/examples/pubnub_livestream/config/database.yml +25 -0
- data/examples/pubnub_livestream/config/environment.rb +5 -0
- data/examples/pubnub_livestream/config/environments/development.rb +29 -0
- data/examples/pubnub_livestream/config/environments/production.rb +80 -0
- data/examples/pubnub_livestream/config/environments/test.rb +36 -0
- data/examples/pubnub_livestream/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/pubnub_livestream/config/initializers/filter_parameter_logging.rb +4 -0
- data/examples/pubnub_livestream/config/initializers/inflections.rb +16 -0
- data/examples/pubnub_livestream/config/initializers/mime_types.rb +5 -0
- data/examples/pubnub_livestream/config/initializers/pubnub.rb +12 -0
- data/examples/pubnub_livestream/config/initializers/secret_token.rb +12 -0
- data/examples/pubnub_livestream/config/initializers/session_store.rb +3 -0
- data/examples/pubnub_livestream/config/initializers/wrap_parameters.rb +14 -0
- data/examples/pubnub_livestream/config/locales/en.yml +23 -0
- data/examples/pubnub_livestream/config/routes.rb +62 -0
- data/examples/pubnub_livestream/db/migrate/20130826110322_create_messages.rb +11 -0
- data/examples/pubnub_livestream/db/schema.rb +24 -0
- data/examples/pubnub_livestream/db/seeds.rb +7 -0
- data/examples/pubnub_livestream/lib/assets/.keep +0 -0
- data/examples/pubnub_livestream/lib/tasks/.keep +0 -0
- data/examples/pubnub_livestream/log/.keep +0 -0
- data/examples/pubnub_livestream/public/404.html +58 -0
- data/examples/pubnub_livestream/public/422.html +58 -0
- data/examples/pubnub_livestream/public/500.html +57 -0
- data/examples/pubnub_livestream/public/assets/application-22a604196dfb65fd0d602eb1eb65f9b7.js +4 -0
- data/examples/pubnub_livestream/public/assets/application-22a604196dfb65fd0d602eb1eb65f9b7.js.gz +0 -0
- data/examples/pubnub_livestream/public/assets/application-3fac0c014bbdf9ee7b3986ff615d5da0.css +5019 -0
- data/examples/pubnub_livestream/public/assets/application-3fac0c014bbdf9ee7b3986ff615d5da0.css.gz +0 -0
- data/examples/pubnub_livestream/public/assets/application-f06834e402639ad43230e3859b9bdd78.css +1 -0
- data/examples/pubnub_livestream/public/assets/application-f06834e402639ad43230e3859b9bdd78.css.gz +0 -0
- data/examples/pubnub_livestream/public/assets/application-f91b87f490140d86003c46b4d06b6c70.js +10682 -0
- data/examples/pubnub_livestream/public/assets/application-f91b87f490140d86003c46b4d06b6c70.js.gz +0 -0
- data/examples/pubnub_livestream/public/assets/manifest-c129e1f5ec52d8b661ebfa902554a2e2.json +1 -0
- data/examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-0bc0341283e3bb8ec518375794cc7c28.eot +0 -0
- data/examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-24dfb40c91db789b8b8faba6886ac1ef.svg +228 -0
- data/examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-4b2130768da98222338d1519f9179528.ttf +0 -0
- data/examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-7a07f26f72466361ac9671de2d33fd1c.woff +0 -0
- data/examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-9f75212cf9fca594cee7e0e3587db9d1.svg +228 -0
- data/examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-ab2f6984951c07fd89e6afdefabd93c7.eot +0 -0
- data/examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-c21928f7d46b397b0af6b9ee4a7bd0dd.ttf +0 -0
- data/examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-fa1d7f79d80d03f8a598822bd9df79bf.woff +0 -0
- data/examples/pubnub_livestream/public/favicon.ico +0 -0
- data/examples/pubnub_livestream/public/robots.txt +5 -0
- data/examples/pubnub_livestream/test/controllers/.keep +0 -0
- data/examples/pubnub_livestream/test/controllers/streamer_controller_test.rb +7 -0
- data/examples/pubnub_livestream/test/fixtures/.keep +0 -0
- data/examples/pubnub_livestream/test/fixtures/messages.yml +9 -0
- data/examples/pubnub_livestream/test/helpers/.keep +0 -0
- data/examples/pubnub_livestream/test/helpers/streamer_helper_test.rb +4 -0
- data/examples/pubnub_livestream/test/integration/.keep +0 -0
- data/examples/pubnub_livestream/test/mailers/.keep +0 -0
- data/examples/pubnub_livestream/test/models/.keep +0 -0
- data/examples/pubnub_livestream/test/models/message_test.rb +7 -0
- data/examples/pubnub_livestream/test/test_helper.rb +15 -0
- data/examples/pubnub_livestream/vendor/assets/javascripts/.keep +0 -0
- data/examples/pubnub_livestream/vendor/assets/stylesheets/.keep +0 -0
- data/examples/serial_publish.rb +46 -0
- data/examples/sinatra/.sass-cache/65d837cc121fc62381bb76d93e5bd081356aa3f9/application.sassc +0 -0
- data/examples/sinatra/.sass-cache/d1525a8542f6e7fb2ecd3275251283768779b344/main.rbc +0 -0
- data/examples/sinatra/.sass-cache/d35765d68c1df11fa3368aa802b3d38109cba214/application.sassc +0 -0
- data/examples/sinatra/main.rb +54 -0
- data/examples/sinatra/public/bootstrap-responsive.min.css +9 -0
- data/examples/sinatra/public/bootstrap.css +5909 -0
- data/examples/sinatra/public/bootstrap.min.css +845 -0
- data/examples/sinatra/public/jquery-1.10.2.min.js +5 -0
- data/examples/sinatra/views/application.sass +6 -0
- data/examples/sinatra/views/index.slim +16 -0
- data/examples/sinatra/views/layout.slim +12 -0
- data/examples/sinatra/views/streamer.coffee +41 -0
- data/examples/sub_and_unsub_1.rb +56 -0
- data/examples/translator.rb +129 -0
- data/lib/pubnub.rb +31 -375
- data/lib/pubnub/client.rb +527 -0
- data/lib/pubnub/configuration.rb +25 -0
- data/lib/pubnub/crypto.rb +53 -0
- data/lib/pubnub/error.rb +23 -0
- data/lib/pubnub/request.rb +288 -0
- data/lib/pubnub/response.rb +126 -0
- data/lib/pubnub/subscription.rb +24 -0
- data/lib/tasks/examples.rake +39 -0
- data/lib/version.rb +1 -0
- data/pubnub.gemspec +26 -0
- data/spec/lib/client_spec.rb +346 -0
- data/spec/lib/crypto_spec.rb +89 -0
- data/spec/lib/history_integration_spec.rb +0 -0
- data/spec/lib/presence_integration_spec.rb +16 -0
- data/spec/lib/publish_integration_spec.rb +994 -0
- data/spec/lib/pubnub_spec.rb +12 -0
- data/spec/lib/request_spec.rb +151 -0
- data/spec/lib/subscribe_integration_spec.rb +944 -0
- data/spec/lib/time_integration_spec.rb +0 -0
- data/spec/spec_helper.rb +15 -0
- metadata +158 -45
- data/lib/pubnub_crypto.rb +0 -53
- data/lib/pubnub_request.rb +0 -310
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'pubnub'
|
3
|
+
require 'pry'
|
4
|
+
require 'rr'
|
5
|
+
require 'stringio'
|
6
|
+
require 'webmock/rspec'
|
7
|
+
|
8
|
+
WebMock.disable_net_connect!
|
9
|
+
|
10
|
+
$log = Logger.new('pubnub.log', 0, 100 * 1024 * 1024)
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.color_enabled = true
|
14
|
+
config.tty = true
|
15
|
+
end
|
metadata
CHANGED
@@ -1,110 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubnub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
5
|
-
prerelease:
|
4
|
+
version: '3.4'
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- PubNub
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-10-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: eventmachine
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
28
|
+
name: httparty
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
42
|
+
name: persistent_httparty
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
56
|
+
name: em-http-request
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
61
|
+
version: '0'
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
68
|
+
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
70
|
+
name: uuid
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
75
|
+
version: 2.3.5
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
82
|
+
version: 2.3.5
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: json
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :runtime
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
description: Ruby anywhere in the world in 250ms with PubNub!
|
@@ -113,32 +100,158 @@ executables: []
|
|
113
100
|
extensions: []
|
114
101
|
extra_rdoc_files: []
|
115
102
|
files:
|
103
|
+
- .gitignore
|
104
|
+
- .yardoc/checksums
|
105
|
+
- .yardoc/object_types
|
106
|
+
- .yardoc/objects/root.dat
|
107
|
+
- .yardoc/proxy_types
|
108
|
+
- LICENSE
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- VERSION
|
112
|
+
- examples/demo_console.rb
|
113
|
+
- examples/error_server.rb
|
114
|
+
- examples/pubnub_livestream/.gitignore
|
115
|
+
- examples/pubnub_livestream/Gemfile
|
116
|
+
- examples/pubnub_livestream/Gemfile.lock
|
117
|
+
- examples/pubnub_livestream/README.rdoc
|
118
|
+
- examples/pubnub_livestream/Rakefile
|
119
|
+
- examples/pubnub_livestream/app/assets/images/.keep
|
120
|
+
- examples/pubnub_livestream/app/assets/javascripts/application.js
|
121
|
+
- examples/pubnub_livestream/app/assets/javascripts/streamer.js.coffee
|
122
|
+
- examples/pubnub_livestream/app/assets/stylesheets/application.css.sass
|
123
|
+
- examples/pubnub_livestream/app/assets/stylesheets/streamer.css.scss
|
124
|
+
- examples/pubnub_livestream/app/controllers/application_controller.rb
|
125
|
+
- examples/pubnub_livestream/app/controllers/concerns/.keep
|
126
|
+
- examples/pubnub_livestream/app/controllers/streamer_controller.rb
|
127
|
+
- examples/pubnub_livestream/app/helpers/application_helper.rb
|
128
|
+
- examples/pubnub_livestream/app/helpers/streamer_helper.rb
|
129
|
+
- examples/pubnub_livestream/app/mailers/.keep
|
130
|
+
- examples/pubnub_livestream/app/models/.keep
|
131
|
+
- examples/pubnub_livestream/app/models/concerns/.keep
|
132
|
+
- examples/pubnub_livestream/app/models/message.rb
|
133
|
+
- examples/pubnub_livestream/app/views/layouts/application.html.erb
|
134
|
+
- examples/pubnub_livestream/app/views/streamer/index.haml
|
135
|
+
- examples/pubnub_livestream/bin/bundle
|
136
|
+
- examples/pubnub_livestream/bin/rails
|
137
|
+
- examples/pubnub_livestream/bin/rake
|
138
|
+
- examples/pubnub_livestream/config.ru
|
139
|
+
- examples/pubnub_livestream/config/application.rb
|
140
|
+
- examples/pubnub_livestream/config/boot.rb
|
141
|
+
- examples/pubnub_livestream/config/database.yml
|
142
|
+
- examples/pubnub_livestream/config/environment.rb
|
143
|
+
- examples/pubnub_livestream/config/environments/development.rb
|
144
|
+
- examples/pubnub_livestream/config/environments/production.rb
|
145
|
+
- examples/pubnub_livestream/config/environments/test.rb
|
146
|
+
- examples/pubnub_livestream/config/initializers/backtrace_silencers.rb
|
147
|
+
- examples/pubnub_livestream/config/initializers/filter_parameter_logging.rb
|
148
|
+
- examples/pubnub_livestream/config/initializers/inflections.rb
|
149
|
+
- examples/pubnub_livestream/config/initializers/mime_types.rb
|
150
|
+
- examples/pubnub_livestream/config/initializers/pubnub.rb
|
151
|
+
- examples/pubnub_livestream/config/initializers/secret_token.rb
|
152
|
+
- examples/pubnub_livestream/config/initializers/session_store.rb
|
153
|
+
- examples/pubnub_livestream/config/initializers/wrap_parameters.rb
|
154
|
+
- examples/pubnub_livestream/config/locales/en.yml
|
155
|
+
- examples/pubnub_livestream/config/routes.rb
|
156
|
+
- examples/pubnub_livestream/db/migrate/20130826110322_create_messages.rb
|
157
|
+
- examples/pubnub_livestream/db/schema.rb
|
158
|
+
- examples/pubnub_livestream/db/seeds.rb
|
159
|
+
- examples/pubnub_livestream/lib/assets/.keep
|
160
|
+
- examples/pubnub_livestream/lib/tasks/.keep
|
161
|
+
- examples/pubnub_livestream/log/.keep
|
162
|
+
- examples/pubnub_livestream/public/404.html
|
163
|
+
- examples/pubnub_livestream/public/422.html
|
164
|
+
- examples/pubnub_livestream/public/500.html
|
165
|
+
- examples/pubnub_livestream/public/assets/application-22a604196dfb65fd0d602eb1eb65f9b7.js
|
166
|
+
- examples/pubnub_livestream/public/assets/application-22a604196dfb65fd0d602eb1eb65f9b7.js.gz
|
167
|
+
- examples/pubnub_livestream/public/assets/application-3fac0c014bbdf9ee7b3986ff615d5da0.css
|
168
|
+
- examples/pubnub_livestream/public/assets/application-3fac0c014bbdf9ee7b3986ff615d5da0.css.gz
|
169
|
+
- examples/pubnub_livestream/public/assets/application-f06834e402639ad43230e3859b9bdd78.css
|
170
|
+
- examples/pubnub_livestream/public/assets/application-f06834e402639ad43230e3859b9bdd78.css.gz
|
171
|
+
- examples/pubnub_livestream/public/assets/application-f91b87f490140d86003c46b4d06b6c70.js
|
172
|
+
- examples/pubnub_livestream/public/assets/application-f91b87f490140d86003c46b4d06b6c70.js.gz
|
173
|
+
- examples/pubnub_livestream/public/assets/manifest-c129e1f5ec52d8b661ebfa902554a2e2.json
|
174
|
+
- examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-0bc0341283e3bb8ec518375794cc7c28.eot
|
175
|
+
- examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-24dfb40c91db789b8b8faba6886ac1ef.svg
|
176
|
+
- examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-4b2130768da98222338d1519f9179528.ttf
|
177
|
+
- examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-7a07f26f72466361ac9671de2d33fd1c.woff
|
178
|
+
- examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-9f75212cf9fca594cee7e0e3587db9d1.svg
|
179
|
+
- examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-ab2f6984951c07fd89e6afdefabd93c7.eot
|
180
|
+
- examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-c21928f7d46b397b0af6b9ee4a7bd0dd.ttf
|
181
|
+
- examples/pubnub_livestream/public/assets/twitter/glyphicons-halflings-regular-fa1d7f79d80d03f8a598822bd9df79bf.woff
|
182
|
+
- examples/pubnub_livestream/public/favicon.ico
|
183
|
+
- examples/pubnub_livestream/public/robots.txt
|
184
|
+
- examples/pubnub_livestream/test/controllers/.keep
|
185
|
+
- examples/pubnub_livestream/test/controllers/streamer_controller_test.rb
|
186
|
+
- examples/pubnub_livestream/test/fixtures/.keep
|
187
|
+
- examples/pubnub_livestream/test/fixtures/messages.yml
|
188
|
+
- examples/pubnub_livestream/test/helpers/.keep
|
189
|
+
- examples/pubnub_livestream/test/helpers/streamer_helper_test.rb
|
190
|
+
- examples/pubnub_livestream/test/integration/.keep
|
191
|
+
- examples/pubnub_livestream/test/mailers/.keep
|
192
|
+
- examples/pubnub_livestream/test/models/.keep
|
193
|
+
- examples/pubnub_livestream/test/models/message_test.rb
|
194
|
+
- examples/pubnub_livestream/test/test_helper.rb
|
195
|
+
- examples/pubnub_livestream/vendor/assets/javascripts/.keep
|
196
|
+
- examples/pubnub_livestream/vendor/assets/stylesheets/.keep
|
197
|
+
- examples/serial_publish.rb
|
198
|
+
- examples/sinatra/.sass-cache/65d837cc121fc62381bb76d93e5bd081356aa3f9/application.sassc
|
199
|
+
- examples/sinatra/.sass-cache/d1525a8542f6e7fb2ecd3275251283768779b344/main.rbc
|
200
|
+
- examples/sinatra/.sass-cache/d35765d68c1df11fa3368aa802b3d38109cba214/application.sassc
|
201
|
+
- examples/sinatra/main.rb
|
202
|
+
- examples/sinatra/public/bootstrap-responsive.min.css
|
203
|
+
- examples/sinatra/public/bootstrap.css
|
204
|
+
- examples/sinatra/public/bootstrap.min.css
|
205
|
+
- examples/sinatra/public/jquery-1.10.2.min.js
|
206
|
+
- examples/sinatra/views/application.sass
|
207
|
+
- examples/sinatra/views/index.slim
|
208
|
+
- examples/sinatra/views/layout.slim
|
209
|
+
- examples/sinatra/views/streamer.coffee
|
210
|
+
- examples/sub_and_unsub_1.rb
|
211
|
+
- examples/translator.rb
|
116
212
|
- lib/pubnub.rb
|
117
|
-
- lib/
|
118
|
-
- lib/
|
119
|
-
|
213
|
+
- lib/pubnub/client.rb
|
214
|
+
- lib/pubnub/configuration.rb
|
215
|
+
- lib/pubnub/crypto.rb
|
216
|
+
- lib/pubnub/error.rb
|
217
|
+
- lib/pubnub/request.rb
|
218
|
+
- lib/pubnub/response.rb
|
219
|
+
- lib/pubnub/subscription.rb
|
220
|
+
- lib/tasks/examples.rake
|
221
|
+
- lib/version.rb
|
222
|
+
- pubnub.gemspec
|
223
|
+
- spec/lib/client_spec.rb
|
224
|
+
- spec/lib/crypto_spec.rb
|
225
|
+
- spec/lib/history_integration_spec.rb
|
226
|
+
- spec/lib/presence_integration_spec.rb
|
227
|
+
- spec/lib/publish_integration_spec.rb
|
228
|
+
- spec/lib/pubnub_spec.rb
|
229
|
+
- spec/lib/request_spec.rb
|
230
|
+
- spec/lib/subscribe_integration_spec.rb
|
231
|
+
- spec/lib/time_integration_spec.rb
|
232
|
+
- spec/spec_helper.rb
|
233
|
+
homepage: http://github.com/pubnub/ruby
|
120
234
|
licenses:
|
121
235
|
- MIT
|
236
|
+
metadata: {}
|
122
237
|
post_install_message:
|
123
238
|
rdoc_options: []
|
124
239
|
require_paths:
|
125
240
|
- lib
|
126
241
|
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
-
none: false
|
128
242
|
requirements:
|
129
|
-
- -
|
243
|
+
- - '>='
|
130
244
|
- !ruby/object:Gem::Version
|
131
245
|
version: '0'
|
132
246
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
-
none: false
|
134
247
|
requirements:
|
135
|
-
- -
|
248
|
+
- - '>='
|
136
249
|
- !ruby/object:Gem::Version
|
137
250
|
version: '0'
|
138
251
|
requirements: []
|
139
252
|
rubyforge_project:
|
140
|
-
rubygems_version:
|
253
|
+
rubygems_version: 2.0.3
|
141
254
|
signing_key:
|
142
|
-
specification_version:
|
255
|
+
specification_version: 4
|
143
256
|
summary: PubNub Official Ruby gem
|
144
257
|
test_files: []
|
data/lib/pubnub_crypto.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
class PubnubCrypto
|
2
|
-
require 'yajl'
|
3
|
-
|
4
|
-
def initialize(cipher_key)
|
5
|
-
@alg = "AES-256-CBC"
|
6
|
-
sha256_key = Digest::SHA256.hexdigest(cipher_key)
|
7
|
-
@key = sha256_key.slice(0,32)
|
8
|
-
|
9
|
-
#puts("\nraw sha cipher_key is: #{cipher_key}")
|
10
|
-
#puts("raw sha cipher_key is: #{sha256_key}")
|
11
|
-
#puts("padded cipher_key is: #{@key}\n")
|
12
|
-
|
13
|
-
@iv = '0123456789012345'
|
14
|
-
end
|
15
|
-
|
16
|
-
|
17
|
-
def encrypt(message)
|
18
|
-
|
19
|
-
aes = OpenSSL::Cipher::Cipher.new(@alg)
|
20
|
-
aes.encrypt
|
21
|
-
aes.key = @key
|
22
|
-
aes.iv = @iv
|
23
|
-
|
24
|
-
json_message = Yajl.dump(message)
|
25
|
-
cipher = aes.update(json_message)
|
26
|
-
cipher << aes.final
|
27
|
-
|
28
|
-
Base64.strict_encode64(cipher)
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
def decrypt(cipher_text)
|
34
|
-
decode_cipher = OpenSSL::Cipher::Cipher.new(@alg)
|
35
|
-
decode_cipher.decrypt
|
36
|
-
decode_cipher.key = @key
|
37
|
-
decode_cipher.iv = @iv
|
38
|
-
|
39
|
-
plain_text = ""
|
40
|
-
|
41
|
-
begin
|
42
|
-
undecoded_text = Base64.decode64(cipher_text)
|
43
|
-
plain_text = decode_cipher.update(undecoded_text)
|
44
|
-
plain_text << decode_cipher.final
|
45
|
-
rescue => e
|
46
|
-
|
47
|
-
return "DECRYPTION_ERROR"
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
return Yajl.load(plain_text)
|
52
|
-
end
|
53
|
-
end
|
data/lib/pubnub_request.rb
DELETED
@@ -1,310 +0,0 @@
|
|
1
|
-
class PubnubRequest
|
2
|
-
attr_accessor :cipher_key, :host, :query, :response, :timetoken, :url, :operation, :callback, :publish_key, :subscribe_key, :secret_key, :channel, :jsonp, :message, :ssl, :port
|
3
|
-
attr_accessor :history_limit, :history_count, :history_start, :history_end, :history_reverse, :session_uuid, :last_timetoken, :origin, :error
|
4
|
-
|
5
|
-
class RequestError < RuntimeError;
|
6
|
-
end
|
7
|
-
|
8
|
-
def initialize(args = {})
|
9
|
-
args = HashWithIndifferentAccess.new(args)
|
10
|
-
|
11
|
-
@operation = args[:operation].to_s
|
12
|
-
@callback = args[:callback]
|
13
|
-
@cipher_key = args[:cipher_key]
|
14
|
-
@session_uuid = args[:session_uuid]
|
15
|
-
@publish_key = args[:publish_key]
|
16
|
-
@subscribe_key = args[:subscribe_key]
|
17
|
-
@channel = args[:channel]
|
18
|
-
@jsonp = args[:jsonp].present? ? "1" : "0"
|
19
|
-
@message = args[:message]
|
20
|
-
@secret_key = args[:secret_key] || "0"
|
21
|
-
@timetoken = args[:timetoken] || "0"
|
22
|
-
@ssl = args[:ssl]
|
23
|
-
|
24
|
-
@port = args[:port]
|
25
|
-
@url = args[:url]
|
26
|
-
@host = args[:host]
|
27
|
-
@query = args[:query]
|
28
|
-
end
|
29
|
-
|
30
|
-
def op_exception
|
31
|
-
if @operation.present?
|
32
|
-
("Pubnub::" + @operation.to_s.capitalize + "Error").constantize
|
33
|
-
else
|
34
|
-
PubnubRequest::RequestError
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def ==(another)
|
39
|
-
self.operation == another.operation && self.callback == another.callback &&
|
40
|
-
self.channel == another.channel && self.message == another.message
|
41
|
-
end
|
42
|
-
|
43
|
-
def set_error(options)
|
44
|
-
options = HashWithIndifferentAccess.new(options)
|
45
|
-
|
46
|
-
if options[:error].present?
|
47
|
-
self.error = true
|
48
|
-
end
|
49
|
-
self
|
50
|
-
end
|
51
|
-
|
52
|
-
def set_origin(options)
|
53
|
-
options = HashWithIndifferentAccess.new(options)
|
54
|
-
|
55
|
-
if options[:origin].present?
|
56
|
-
self.origin = options[:origin].to_s
|
57
|
-
self
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def set_channel(options)
|
62
|
-
options = HashWithIndifferentAccess.new(options)
|
63
|
-
|
64
|
-
if options[:channel].blank?
|
65
|
-
raise(op_exception, "channel is a required parameter.")
|
66
|
-
else
|
67
|
-
self.channel = options[:channel].to_s
|
68
|
-
self
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def set_callback(options)
|
73
|
-
options = HashWithIndifferentAccess.new(options)
|
74
|
-
|
75
|
-
if options[:callback].blank?
|
76
|
-
raise(op_exception, "callback is a required parameter.")
|
77
|
-
elsif !options[:callback].try(:respond_to?, "call")
|
78
|
-
raise(op_exception, "callback is invalid.")
|
79
|
-
else
|
80
|
-
self.callback = options[:callback]
|
81
|
-
self
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
|
86
|
-
def set_cipher_key(options, self_cipher_key)
|
87
|
-
options = HashWithIndifferentAccess.new(options)
|
88
|
-
|
89
|
-
if self_cipher_key.present? && options['cipher_key'].present?
|
90
|
-
raise(op_exception, "existing cipher_key #{self_cipher_key} cannot be overridden at publish-time.")
|
91
|
-
|
92
|
-
elsif (self_cipher_key.present? && options[:cipher_key].blank?) || (self_cipher_key.blank? && options[:cipher_key].present?)
|
93
|
-
|
94
|
-
this_cipher_key = self_cipher_key || options[:cipher_key]
|
95
|
-
raise(Pubnub::PublishError, "secret key must be a string.") if this_cipher_key.class != String
|
96
|
-
self.cipher_key = this_cipher_key
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def set_secret_key(options, self_secret_key)
|
101
|
-
options = HashWithIndifferentAccess.new(options)
|
102
|
-
|
103
|
-
if self_secret_key.present? && options['secret_key'].present?
|
104
|
-
raise(Pubnub::PublishError, "existing secret_key #{self_secret_key} cannot be overridden at publish-time.")
|
105
|
-
|
106
|
-
elsif (self_secret_key.present? && options[:secret_key].blank?) || (self_secret_key.blank? && options[:secret_key].present?)
|
107
|
-
|
108
|
-
my_secret_key = self_secret_key || options[:secret_key]
|
109
|
-
raise(Pubnub::PublishError, "secret key must be a string.") if my_secret_key.class != String
|
110
|
-
|
111
|
-
signature = "{ @publish_key, @subscribe_key, @secret_key, channel, message}"
|
112
|
-
digest = OpenSSL::Digest.new("sha256")
|
113
|
-
key = [my_secret_key]
|
114
|
-
hmac = OpenSSL::HMAC.hexdigest(digest, key.pack("H*"), signature)
|
115
|
-
self.secret_key = hmac
|
116
|
-
else
|
117
|
-
self.secret_key = "0"
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
def set_message(options, self_cipher_key)
|
122
|
-
options = HashWithIndifferentAccess.new(options)
|
123
|
-
|
124
|
-
if options[:message].blank? && options[:message] != ""
|
125
|
-
raise(op_exception, "message is a required parameter.")
|
126
|
-
else
|
127
|
-
my_cipher_key = options[:cipher_key] || self_cipher_key
|
128
|
-
|
129
|
-
if my_cipher_key.present?
|
130
|
-
self.message = Yajl.dump(aes_encrypt(my_cipher_key, options, self))
|
131
|
-
else
|
132
|
-
self.message = Yajl.dump(options[:message])
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
def set_publish_key(options, self_publish_key)
|
138
|
-
options = HashWithIndifferentAccess.new(options)
|
139
|
-
|
140
|
-
if options[:publish_key].blank? && self_publish_key.blank?
|
141
|
-
raise(Pubnub::PublishError, "publish_key is a required parameter.")
|
142
|
-
elsif self_publish_key.present? && options['publish_key'].present?
|
143
|
-
raise(Pubnub::PublishError, "existing publish_key #{self_publish_key} cannot be overridden at publish-time.")
|
144
|
-
else
|
145
|
-
self.publish_key = (self_publish_key || options[:publish_key]).to_s
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
def set_subscribe_key(options, self_subscribe_key)
|
150
|
-
options = HashWithIndifferentAccess.new(options)
|
151
|
-
|
152
|
-
if options[:subscribe_key].blank? && self_subscribe_key.blank?
|
153
|
-
raise(op_exception, "subscribe_key is a required parameter.")
|
154
|
-
elsif self_subscribe_key.present? && options['subscribe_key'].present?
|
155
|
-
raise(op_exception, "existing subscribe_key #{self_subscribe_key} cannot be overridden at subscribe-time.")
|
156
|
-
else
|
157
|
-
self.subscribe_key = (self_subscribe_key || options[:subscribe_key]).to_s
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
def package_response!(response_data)
|
162
|
-
self.response = response_data.respond_to?(:content) ? Yajl.load(response_data.content) : Yajl.load(response_data)
|
163
|
-
self.last_timetoken = self.timetoken
|
164
|
-
self.timetoken = self.response[1] unless self.operation == "time"
|
165
|
-
|
166
|
-
if self.cipher_key.present? && %w(subscribe history detailed_history).include?(self.operation)
|
167
|
-
|
168
|
-
myarr = Array.new
|
169
|
-
pc = PubnubCrypto.new(@cipher_key)
|
170
|
-
|
171
|
-
case @operation
|
172
|
-
when "publish"
|
173
|
-
iterate = self.response.first
|
174
|
-
when "subscribe"
|
175
|
-
iterate = self.response.first
|
176
|
-
when "history"
|
177
|
-
iterate = self.response
|
178
|
-
when "detailed_history"
|
179
|
-
iterate = self.response.first
|
180
|
-
|
181
|
-
else
|
182
|
-
raise(RequestError, "Don't know how to iterate on this operation.")
|
183
|
-
end
|
184
|
-
|
185
|
-
iterate.each do |message|
|
186
|
-
message = pc.decrypt(message)
|
187
|
-
myarr.push(message)
|
188
|
-
end
|
189
|
-
|
190
|
-
if %w(publish subscribe).include?(@operation)
|
191
|
-
self.response[0] = myarr
|
192
|
-
elsif @operation == "detailed_history"
|
193
|
-
json_response_data = Yajl.load(response_data)
|
194
|
-
self.response = [myarr, json_response_data[1], json_response_data[2]]
|
195
|
-
else
|
196
|
-
self.response = myarr
|
197
|
-
end
|
198
|
-
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
def format_url!(override_timetoken = nil)
|
203
|
-
|
204
|
-
raise(Pubnub::PublishError, "Missing .operation in PubnubRequest object") if self.operation.blank?
|
205
|
-
|
206
|
-
if @ssl.present?
|
207
|
-
origin = 'https://' + (self.origin.present? ? self.origin : Pubnub::ORIGIN_HOST)
|
208
|
-
@port = 443
|
209
|
-
else
|
210
|
-
origin = 'http://' + (self.origin.present? ? self.origin : Pubnub::ORIGIN_HOST)
|
211
|
-
@port = 80
|
212
|
-
end
|
213
|
-
|
214
|
-
if override_timetoken.present?
|
215
|
-
self.timetoken = override_timetoken.to_s
|
216
|
-
end
|
217
|
-
|
218
|
-
case self.operation.to_s
|
219
|
-
when "publish"
|
220
|
-
url_array = [self.operation.to_s, self.publish_key.to_s, self.subscribe_key.to_s,
|
221
|
-
self.secret_key.to_s, self.channel.to_s, "0", self.message]
|
222
|
-
|
223
|
-
when "subscribe"
|
224
|
-
url_array = [self.operation.to_s, self.subscribe_key.to_s, self.channel.to_s, "0", @timetoken]
|
225
|
-
|
226
|
-
when "presence"
|
227
|
-
url_array = ["subscribe", self.subscribe_key.to_s, ((self.channel.to_s) + "-pnpres"), "0", @timetoken]
|
228
|
-
|
229
|
-
when "time"
|
230
|
-
url_array = [self.operation.to_s, "0"]
|
231
|
-
|
232
|
-
when "history"
|
233
|
-
url_array = [self.operation.to_s, self.subscribe_key.to_s, self.channel.to_s, "0", self.history_limit.to_s]
|
234
|
-
|
235
|
-
when "detailed_history"
|
236
|
-
url_array = ["v2", "history", "sub-key", self.subscribe_key.to_s, "channel", self.channel.to_s]
|
237
|
-
|
238
|
-
when "here_now"
|
239
|
-
url_array = ["v2", "presence", "sub-key", self.subscribe_key.to_s, "channel", self.channel.to_s]
|
240
|
-
|
241
|
-
else
|
242
|
-
|
243
|
-
raise(PubnubRequest::RequestError, "I can't create that URL for you due to unknown operation type.")
|
244
|
-
end
|
245
|
-
|
246
|
-
self.url = origin + encode_URL(url_array)
|
247
|
-
|
248
|
-
uri = URI.parse(self.url)
|
249
|
-
|
250
|
-
self.host = uri.host
|
251
|
-
url_params = ""
|
252
|
-
|
253
|
-
if %w(subscribe presence).include?(@operation)
|
254
|
-
uri.query = uri.query.blank? ? "uuid=#{@session_uuid}" : (uri.query + "uuid=#{@session_uuid}")
|
255
|
-
|
256
|
-
elsif @operation == "detailed_history"
|
257
|
-
url_sep = "?"
|
258
|
-
|
259
|
-
if @history_count || @history_start || @history_end || @history_reverse
|
260
|
-
|
261
|
-
if @history_count
|
262
|
-
url_params += url_sep + "count=" + @history_count.to_s
|
263
|
-
url_sep = "&"
|
264
|
-
end
|
265
|
-
|
266
|
-
if @history_start
|
267
|
-
url_params += url_sep + "start=" + @history_start.to_s
|
268
|
-
url_sep = "&"
|
269
|
-
end
|
270
|
-
|
271
|
-
if @history_end
|
272
|
-
url_params += url_sep + "end=" + @history_end.to_s
|
273
|
-
url_sep = "&"
|
274
|
-
end
|
275
|
-
|
276
|
-
if @history_reverse
|
277
|
-
url_params += url_sep + "reverse=true"
|
278
|
-
url_sep = "&"
|
279
|
-
end
|
280
|
-
end
|
281
|
-
end
|
282
|
-
|
283
|
-
self.query = uri.path + (uri.query.present? ? ("?" + uri.query) : "") + url_params
|
284
|
-
self.url += url_params
|
285
|
-
self
|
286
|
-
|
287
|
-
end
|
288
|
-
|
289
|
-
def aes_encrypt(cipher_key, options, publish_request)
|
290
|
-
options = HashWithIndifferentAccess.new(options)
|
291
|
-
|
292
|
-
pc = PubnubCrypto.new(cipher_key)
|
293
|
-
publish_request.message = pc.encrypt(options[:message])
|
294
|
-
|
295
|
-
end
|
296
|
-
|
297
|
-
def encode_URL(request)
|
298
|
-
## Construct Request URL
|
299
|
-
url = '/' + request.map { |bit| bit.split('').map { |ch|
|
300
|
-
' ~`!@#$%^&*()+=[]\\{}|;\':",./<>?'.index(ch) ?
|
301
|
-
'%' + ch.unpack('H2')[0].to_s.upcase : URI.encode(ch)
|
302
|
-
}.join('') }.join('/')
|
303
|
-
return url
|
304
|
-
end
|
305
|
-
|
306
|
-
def first_request?
|
307
|
-
@last_timetoken == "0"
|
308
|
-
end
|
309
|
-
|
310
|
-
end
|