pubnub 3.5.14 → 3.6.7
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 +4 -4
- data/3.5_to_3.6_upgrade_notes.md +148 -0
- data/{CHANGELOG → CHANGELOG.txt} +15 -0
- data/Gemfile.lock +5 -4
- data/LICENSE.txt +28 -0
- data/README.md +164 -19
- data/Rakefile +1 -6
- data/examples/demo_console.rb +370 -329
- data/fixtures/vcr_cassettes/grant-multiple-channels-presence-multi-1.yml +44 -0
- data/fixtures/vcr_cassettes/grant-multiple-channels-presence-multi-2.yml +44 -0
- data/fixtures/vcr_cassettes/grant-multiple-channels-presence-multi-3.yml +44 -0
- data/fixtures/vcr_cassettes/grant-multiple-channels-presence-multi-4.yml +44 -0
- data/fixtures/vcr_cassettes/grant-multiple-channels-presence.yml +44 -0
- data/fixtures/vcr_cassettes/heartbeated-subscribe.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-nonssl-block-valid-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-nonssl-block-valid-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-nonssl-block-valid-non-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-nonssl-block-valid-non-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-nonssl-parameter-valid-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-nonssl-parameter-valid-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-nonssl-parameter-valid-non-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-nonssl-parameter-valid-non-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-ssl-block-valid-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-ssl-block-valid-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-ssl-block-valid-non-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-ssl-block-valid-non-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-ssl-parameter-valid-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-ssl-parameter-valid-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-ssl-parameter-valid-non-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/here_now-ssl-parameter-valid-non-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/leave-nonssl-block-valid-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/leave-nonssl-block-valid-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/leave-nonssl-block-valid-non-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/leave-nonssl-block-valid-non-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/leave-nonssl-parameter-valid-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/leave-nonssl-parameter-valid-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/leave-nonssl-parameter-valid-non-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/leave-nonssl-parameter-valid-non-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/leave-ssl-block-valid-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/leave-ssl-block-valid-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/leave-ssl-block-valid-non-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/leave-ssl-block-valid-non-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/leave-ssl-parameter-valid-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/leave-ssl-parameter-valid-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/leave-ssl-parameter-valid-non-200-async.yml +1 -1
- data/fixtures/vcr_cassettes/leave-ssl-parameter-valid-non-200-sync.yml +1 -1
- data/fixtures/vcr_cassettes/state-async-set-state-via-subbedclient-2.yml +140 -0
- data/fixtures/vcr_cassettes/state-async-set-state-via-subbedclient.yml +131 -0
- data/fixtures/vcr_cassettes/state-async-set-state-via-subscribe.yml +90 -0
- data/fixtures/vcr_cassettes/state-set-state-via-client-2.yml +140 -0
- data/fixtures/vcr_cassettes/state-set-state-via-client.yml +90 -0
- data/fixtures/vcr_cassettes/state-set-state-via-subscribe.yml +90 -0
- data/fixtures/vcr_cassettes/where_now-ssl-block-invalid-200-async.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-block-invalid-200-sync.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-block-invalid-non-200-async.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-block-invalid-non-200-sync.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-block-valid-200-async.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-block-valid-200-sync.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-block-valid-non-200-async.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-block-valid-non-200-sync.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-parameter-invalid-200-async.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-parameter-invalid-200-sync.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-parameter-invalid-non-200-async.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-parameter-invalid-non-200-sync.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-parameter-valid-200-async.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-parameter-valid-200-sync.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-parameter-valid-non-200-async.yml +49 -0
- data/fixtures/vcr_cassettes/where_now-ssl-parameter-valid-non-200-sync.yml +49 -0
- data/lib/pubnub.rb +1 -2
- data/lib/pubnub/client.rb +97 -21
- data/lib/pubnub/configuration.rb +1 -1
- data/lib/pubnub/envelope.rb +3 -2
- data/lib/pubnub/event.rb +9 -5
- data/lib/pubnub/events/audit.rb +1 -1
- data/lib/pubnub/events/grant.rb +1 -1
- data/lib/pubnub/events/heartbeat.rb +7 -3
- data/lib/pubnub/events/here_now.rb +7 -4
- data/lib/pubnub/events/history.rb +1 -1
- data/lib/pubnub/events/leave.rb +10 -4
- data/lib/pubnub/events/presence.rb +1 -1
- data/lib/pubnub/events/publish.rb +6 -2
- data/lib/pubnub/events/revoke.rb +1 -1
- data/lib/pubnub/events/set_state.rb +77 -0
- data/lib/pubnub/events/state.rb +63 -0
- data/lib/pubnub/events/subscribe.rb +7 -0
- data/lib/pubnub/events/where_now.rb +55 -0
- data/lib/pubnub/pam.rb +10 -16
- data/lib/pubnub/version.rb +2 -2
- data/pubnub.gemspec +21 -19
- data/spec/lib/channel_presence_concat_pam_spec.rb +94 -0
- data/spec/lib/client_spec.rb +3 -4
- data/spec/lib/heartbeat_spec.rb +16 -16
- data/spec/lib/integration/global_here_now_dpc_spec.rb +10 -10
- data/spec/lib/integration/global_here_now_spec.rb +8 -8
- data/spec/lib/integration/here_now_dpc_spec.rb +24 -24
- data/spec/lib/integration/here_now_spec.rb +24 -24
- data/spec/lib/integration/leave_dpc_spec.rb +24 -25
- data/spec/lib/integration/leave_spec.rb +24 -24
- data/spec/lib/integration/publish_spec.rb +5 -0
- data/spec/lib/integration/state_spec.rb +84 -0
- data/spec/lib/integration/where_now_spec.rb +312 -0
- metadata +108 -26
- data/LICENSE +0 -27
- data/VERSION +0 -1
- data/examples/demo_console_new.rb +0 -286
- data/fixtures/vcr_cassettes/heartbeat-non200.yml +0 -667
- data/spec/tools/pam-test-generator.rb +0 -367
- data/spec/tools/test-generator.rb +0 -310
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'state metadata in subscribe requests' do
|
4
|
+
before(:each) do
|
5
|
+
@response_output = StringIO.new
|
6
|
+
@message_output = StringIO.new
|
7
|
+
|
8
|
+
@callback = lambda { |envelope|
|
9
|
+
$logger.debug 'FIRING CALLBACK FROM TEST'
|
10
|
+
@response_output.write envelope.response
|
11
|
+
@message_output.write envelope.msg
|
12
|
+
@after_callback = true
|
13
|
+
}
|
14
|
+
|
15
|
+
@error_callback = lambda { |envelope|
|
16
|
+
$logger.debug 'FIRING ERROR CALLBACK FROM TEST'
|
17
|
+
@response_output.write envelope.response
|
18
|
+
@message_output.write envelope.msg
|
19
|
+
@after_error_callback = true
|
20
|
+
}
|
21
|
+
|
22
|
+
@pn = Pubnub.new(:max_retries => 0, :subscribe_key => 'sub-c-53c3d30a-4135-11e3-9970-02ee2ddab7fe', :publish_key => 'pub-c-15d6fd3c-05de-4abc-8eba-6595a441959d', :secret_key => 'sec-c-ZWYwMGJiZTYtMTQwMC00NDQ5LWI0NmEtMzZiM2M5NThlOTJh', :error_callback => @error_callback)
|
23
|
+
@pn.uuid = 'rubytestuuid'
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'sync' do
|
27
|
+
it 'sets/gets proper data via subscribe request' do
|
28
|
+
VCR.use_cassette("state-set-state-via-subscribe", :record => :none) do
|
29
|
+
@pn.subscribe(:channel => :whatever, :state => { :whatever => { :key => :value } }, :http_sync => true )
|
30
|
+
enve = @pn.state(:channel => :whatever, :uuid => :rubytestuuid, :http_sync => true)
|
31
|
+
|
32
|
+
enve.size.should eq 1
|
33
|
+
enve.first.response.should eq "{\"status\": 200, \"message\": \"OK\", \"payload\": {\"key\": \"value\"}, \"service\": \"Presence\"}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'sets/gets proper data via client method using symbol' do
|
38
|
+
VCR.use_cassette("state-set-state-via-client", :record => :none) do
|
39
|
+
@pn.set_state(:state => { :key => :value }, :channel => :whatever, :http_sync => true)
|
40
|
+
@pn.subscribe(:channel => :whatever, :http_sync => true )
|
41
|
+
|
42
|
+
enve = @pn.state(:channel => :whatever, :uuid => :rubytestuuid, :http_sync => true)
|
43
|
+
|
44
|
+
enve.size.should eq 1
|
45
|
+
enve.first.response.should eq "{\"status\": 200, \"message\": \"OK\", \"payload\": {\"key\": \"value\"}, \"service\": \"Presence\"}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'sets/gets proper data via client method using string' do
|
50
|
+
VCR.use_cassette("state-set-state-via-client-2", :record => :once) do
|
51
|
+
@pn.set_state(:state => { :key => :value }, :channel => :whatever, :http_sync => true)
|
52
|
+
@pn.subscribe(:channel => :whatever, :http_sync => true )
|
53
|
+
|
54
|
+
enve = @pn.state(:channel => 'whatever', :uuid => :rubytestuuid, :http_sync => true)
|
55
|
+
|
56
|
+
enve.size.should eq 1
|
57
|
+
enve.first.response.should eq "{\"status\": 200, \"uuid\": \"rubytestuuid\", \"service\": \"Presence\", \"message\": \"OK\", \"payload\": {\"key\": \"value\"}, \"channel\": \"whatever\"}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'async' do
|
63
|
+
it 'sets/gets proper data via subscribe request' do
|
64
|
+
VCR.use_cassette("state-async-set-state-via-subscribe", :record => :none) do
|
65
|
+
@pn.subscribe(:channel => :whatever, :state => { :whatever => { :key => :value } } ){|e|}
|
66
|
+
enve = @pn.state(:channel => :whatever, :uuid => :rubytestuuid, :http_sync => true)
|
67
|
+
|
68
|
+
enve.size.should eq 1
|
69
|
+
enve.first.response.should eq "{\"status\": 200, \"message\": \"OK\", \"payload\": {\"key\": \"value\"}, \"service\": \"Presence\"}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'sets/gets proper data via client' do
|
74
|
+
VCR.use_cassette("state-async-set-state-via-subbedclient-2", :record => :once) do
|
75
|
+
@pn.subscribe(:channel => :whatever){|e|}
|
76
|
+
@pn.set_state(:state => { :key => :value }, :channel => :whatever, :http_sync => true)
|
77
|
+
enve = @pn.state(:channel => :whatever, :uuid => :rubytestuuid, :http_sync => true)
|
78
|
+
|
79
|
+
enve.size.should eq 1
|
80
|
+
enve.first.response.should eq "{\"status\": 200, \"uuid\": \"rubytestuuid\", \"service\": \"Presence\", \"message\": \"OK\", \"payload\": {\"key\": \"value\"}, \"channel\": \"whatever\"}"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,312 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe '#where_now' do
|
4
|
+
before(:each) do
|
5
|
+
EM.stop if EM.reactor_running?
|
6
|
+
while EM.reactor_running? do end
|
7
|
+
sleep(0.1)
|
8
|
+
|
9
|
+
@response_output = StringIO.new
|
10
|
+
@message_output = StringIO.new
|
11
|
+
|
12
|
+
@callback = lambda { |envelope|
|
13
|
+
$logger.debug 'FIRING CALLBACK FROM TEST'
|
14
|
+
@response_output.write envelope.response
|
15
|
+
@message_output.write envelope.msg
|
16
|
+
@after_callback = true
|
17
|
+
}
|
18
|
+
|
19
|
+
@error_callback = lambda { |envelope|
|
20
|
+
$logger.debug 'FIRING ERROR CALLBACK FROM TEST'
|
21
|
+
@response_output.write envelope.response
|
22
|
+
@message_output.write envelope.msg
|
23
|
+
@after_error_callback = true
|
24
|
+
}
|
25
|
+
|
26
|
+
@pn = Pubnub.new(:max_retries => 0, :subscribe_key => :demo, :publish_key => :demo, :auth_key => :demoish_authkey, :secret_key => 'some_secret_key', :error_callback => @error_callback)
|
27
|
+
@pn.uuid = 'rubytests'
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'uses ssl' do
|
31
|
+
context 'passes callback as block' do
|
32
|
+
context 'gets valid json in respone' do
|
33
|
+
context 'gets status 200 in response' do
|
34
|
+
context 'uses sync connection' do
|
35
|
+
it 'works fine' do
|
36
|
+
VCR.use_cassette("where_now-ssl-block-valid-200-sync", :record => :none) do
|
37
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
38
|
+
|
39
|
+
eventually do
|
40
|
+
@after_callback.should eq true
|
41
|
+
@response_output.seek 0
|
42
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"}'
|
43
|
+
@message_output.seek 0
|
44
|
+
@message_output.read.should eq 'OK'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
context 'uses async connection' do
|
50
|
+
it 'works fine' do
|
51
|
+
VCR.use_cassette("where_now-ssl-block-valid-200-async", :record => :none) do
|
52
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
53
|
+
|
54
|
+
eventually do
|
55
|
+
@after_callback.should eq true
|
56
|
+
@response_output.seek 0
|
57
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"}'
|
58
|
+
@message_output.seek 0
|
59
|
+
@message_output.read.should eq 'OK'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
context 'gets status non-200 in response' do
|
66
|
+
context 'uses sync connection' do
|
67
|
+
it 'works fine' do
|
68
|
+
VCR.use_cassette("where_now-ssl-block-valid-non-200-sync", :record => :none) do
|
69
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
70
|
+
|
71
|
+
eventually do
|
72
|
+
@after_error_callback.should eq true
|
73
|
+
@response_output.seek 0
|
74
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"}'
|
75
|
+
@message_output.seek 0
|
76
|
+
@message_output.read.should eq '[0,"Non 2xx server response."]'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
context 'uses async connection' do
|
83
|
+
it 'works fine' do
|
84
|
+
VCR.use_cassette("where_now-ssl-block-valid-non-200-async", :record => :none) do
|
85
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
86
|
+
|
87
|
+
eventually do
|
88
|
+
@after_error_callback.should eq true
|
89
|
+
@response_output.seek 0
|
90
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"}'
|
91
|
+
@message_output.seek 0
|
92
|
+
@message_output.read.should eq '[0,"Non 2xx server response."]'
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
context 'gets invalid json in respone' do
|
101
|
+
context 'gets status 200 in response' do
|
102
|
+
context 'uses sync connection' do
|
103
|
+
it 'works fine' do
|
104
|
+
VCR.use_cassette("where_now-ssl-block-invalid-200-sync", :record => :none) do
|
105
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
106
|
+
|
107
|
+
eventually do
|
108
|
+
@after_error_callback.should eq true
|
109
|
+
@response_output.seek 0
|
110
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"'
|
111
|
+
@message_output.seek 0
|
112
|
+
@message_output.read.should eq "[0,\"Invalid JSON in response.\"]"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
end
|
118
|
+
context 'uses async connection' do
|
119
|
+
it 'works fine' do
|
120
|
+
VCR.use_cassette("where_now-ssl-block-invalid-200-async", :record => :none) do
|
121
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
122
|
+
|
123
|
+
eventually do
|
124
|
+
@after_error_callback.should eq true
|
125
|
+
@response_output.seek 0
|
126
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"'
|
127
|
+
@message_output.seek 0
|
128
|
+
@message_output.read.should eq "[0,\"Invalid JSON in response.\"]"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
context 'gets status non-200 in response' do
|
136
|
+
context 'uses sync connection' do
|
137
|
+
it 'works fine' do
|
138
|
+
VCR.use_cassette("where_now-ssl-block-invalid-non-200-sync", :record => :none) do
|
139
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
140
|
+
|
141
|
+
eventually do
|
142
|
+
@after_error_callback.should eq true
|
143
|
+
@response_output.seek 0
|
144
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"'
|
145
|
+
@message_output.seek 0
|
146
|
+
@message_output.read.should eq "[0,\"Invalid JSON in response.\"]"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
end
|
152
|
+
context 'uses async connection' do
|
153
|
+
it 'works fine' do
|
154
|
+
VCR.use_cassette("where_now-ssl-block-invalid-200-async", :record => :none) do
|
155
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
156
|
+
|
157
|
+
eventually do
|
158
|
+
@after_error_callback.should eq true
|
159
|
+
@response_output.seek 0
|
160
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"'
|
161
|
+
@message_output.seek 0
|
162
|
+
@message_output.read.should eq "[0,\"Invalid JSON in response.\"]"
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
context 'passes callback as parameter' do
|
172
|
+
context 'gets valid json in respone' do
|
173
|
+
context 'gets status 200 in response' do
|
174
|
+
context 'uses sync connection' do
|
175
|
+
it 'works fine' do
|
176
|
+
VCR.use_cassette("where_now-ssl-parameter-valid-200-sync", :record => :none) do
|
177
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
178
|
+
|
179
|
+
eventually do
|
180
|
+
@after_callback.should eq true
|
181
|
+
@response_output.seek 0
|
182
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"}'
|
183
|
+
@message_output.seek 0
|
184
|
+
@message_output.read.should eq 'OK'
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
context 'uses async connection' do
|
190
|
+
it 'works fine' do
|
191
|
+
VCR.use_cassette("where_now-ssl-parameter-valid-200-async", :record => :none) do
|
192
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
193
|
+
|
194
|
+
eventually do
|
195
|
+
@after_callback.should eq true
|
196
|
+
@response_output.seek 0
|
197
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"}'
|
198
|
+
@message_output.seek 0
|
199
|
+
@message_output.read.should eq 'OK'
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
context 'gets status non-200 in response' do
|
207
|
+
context 'uses sync connection' do
|
208
|
+
it 'works fine' do
|
209
|
+
VCR.use_cassette("where_now-ssl-parameter-valid-non-200-sync", :record => :none) do
|
210
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
211
|
+
|
212
|
+
eventually do
|
213
|
+
@after_error_callback.should eq true
|
214
|
+
@response_output.seek 0
|
215
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"}'
|
216
|
+
@message_output.seek 0
|
217
|
+
@message_output.read.should eq '[0,"Non 2xx server response."]'
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
222
|
+
end
|
223
|
+
context 'uses async connection' do
|
224
|
+
it 'works fine' do
|
225
|
+
VCR.use_cassette("where_now-ssl-parameter-valid-non-200-async", :record => :none) do
|
226
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
227
|
+
|
228
|
+
eventually do
|
229
|
+
@after_error_callback.should eq true
|
230
|
+
@response_output.seek 0
|
231
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"}'
|
232
|
+
@message_output.seek 0
|
233
|
+
@message_output.read.should eq '[0,"Non 2xx server response."]'
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
context 'gets invalid json in respone' do
|
242
|
+
context 'gets status 200 in response' do
|
243
|
+
context 'uses sync connection' do
|
244
|
+
it 'works fine' do
|
245
|
+
VCR.use_cassette("where_now-ssl-parameter-invalid-200-sync", :record => :none) do
|
246
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
247
|
+
|
248
|
+
eventually do
|
249
|
+
@after_error_callback.should eq true
|
250
|
+
@response_output.seek 0
|
251
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"'
|
252
|
+
@message_output.seek 0
|
253
|
+
@message_output.read.should eq "[0,\"Invalid JSON in response.\"]"
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
end
|
258
|
+
end
|
259
|
+
context 'uses async connection' do
|
260
|
+
it 'works fine' do
|
261
|
+
VCR.use_cassette("where_now-ssl-parameter-invalid-200-async", :record => :none) do
|
262
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
263
|
+
|
264
|
+
eventually do
|
265
|
+
@after_error_callback.should eq true
|
266
|
+
@response_output.seek 0
|
267
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"'
|
268
|
+
@message_output.seek 0
|
269
|
+
@message_output.read.should eq "[0,\"Invalid JSON in response.\"]"
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
276
|
+
context 'gets status non-200 in response' do
|
277
|
+
context 'uses sync connection' do
|
278
|
+
it 'works fine' do
|
279
|
+
VCR.use_cassette("where_now-ssl-parameter-invalid-non-200-sync", :record => :none) do
|
280
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
281
|
+
|
282
|
+
eventually do
|
283
|
+
@after_error_callback.should eq true
|
284
|
+
@response_output.seek 0
|
285
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"'
|
286
|
+
@message_output.seek 0
|
287
|
+
@message_output.read.should eq "[0,\"Invalid JSON in response.\"]"
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
end
|
292
|
+
end
|
293
|
+
context 'uses async connection' do
|
294
|
+
it 'works fine' do
|
295
|
+
VCR.use_cassette("where_now-ssl-parameter-invalid-200-async", :record => :none) do
|
296
|
+
@pn.where_now(:ssl => true, :http_sync => false, :uuid => "demo_uuid", &@callback)
|
297
|
+
|
298
|
+
eventually do
|
299
|
+
@after_error_callback.should eq true
|
300
|
+
@response_output.seek 0
|
301
|
+
@response_output.read.should eq '{"status": 200, "message": "OK", "payload": {"channels": []}, "service": "Presence"'
|
302
|
+
@message_output.seek 0
|
303
|
+
@message_output.read.should eq "[0,\"Invalid JSON in response.\"]"
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
metadata
CHANGED
@@ -1,74 +1,88 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubnub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PubNub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '1.8'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '1.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: net-http-persistent
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.9'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '1.6'
|
55
69
|
description: Ruby anywhere in the world in 250ms with PubNub!
|
56
|
-
email:
|
70
|
+
email:
|
71
|
+
- support@pubnub.com
|
57
72
|
executables: []
|
58
73
|
extensions: []
|
59
74
|
extra_rdoc_files: []
|
60
75
|
files:
|
61
76
|
- ".gitignore"
|
62
|
-
-
|
77
|
+
- 3.5_to_3.6_upgrade_notes.md
|
78
|
+
- CHANGELOG.txt
|
63
79
|
- Gemfile
|
64
80
|
- Gemfile.lock
|
65
|
-
- LICENSE
|
81
|
+
- LICENSE.txt
|
66
82
|
- README.md
|
67
83
|
- Rakefile
|
68
|
-
- VERSION
|
69
84
|
- examples/chaos/tmp/pids/passenger.3000.pid.lock
|
70
85
|
- examples/demo_console.rb
|
71
|
-
- examples/demo_console_new.rb
|
72
86
|
- examples/error_server.rb
|
73
87
|
- examples/pubnub_livestream/.gitignore
|
74
88
|
- examples/pubnub_livestream/Gemfile
|
@@ -229,6 +243,11 @@ files:
|
|
229
243
|
- fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-one-channel-mix.yml
|
230
244
|
- fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-one-channel-string.yml
|
231
245
|
- fixtures/vcr_cassettes/grant-application-level.yml
|
246
|
+
- fixtures/vcr_cassettes/grant-multiple-channels-presence-multi-1.yml
|
247
|
+
- fixtures/vcr_cassettes/grant-multiple-channels-presence-multi-2.yml
|
248
|
+
- fixtures/vcr_cassettes/grant-multiple-channels-presence-multi-3.yml
|
249
|
+
- fixtures/vcr_cassettes/grant-multiple-channels-presence-multi-4.yml
|
250
|
+
- fixtures/vcr_cassettes/grant-multiple-channels-presence.yml
|
232
251
|
- fixtures/vcr_cassettes/grant-multiple-channels.yml
|
233
252
|
- fixtures/vcr_cassettes/grant-nonssl-block-invalid-200-async.yml
|
234
253
|
- fixtures/vcr_cassettes/grant-nonssl-block-invalid-200-sync.yml
|
@@ -262,7 +281,6 @@ files:
|
|
262
281
|
- fixtures/vcr_cassettes/grant-ssl-parameter-valid-200-sync.yml
|
263
282
|
- fixtures/vcr_cassettes/grant-ssl-parameter-valid-non-200-async.yml
|
264
283
|
- fixtures/vcr_cassettes/grant-ssl-parameter-valid-non-200-sync.yml
|
265
|
-
- fixtures/vcr_cassettes/heartbeat-non200.yml
|
266
284
|
- fixtures/vcr_cassettes/heartbeat-test.yml
|
267
285
|
- fixtures/vcr_cassettes/heartbeated-subscribe.yml
|
268
286
|
- fixtures/vcr_cassettes/here_now-nonssl-block-invalid-200-async.yml
|
@@ -529,6 +547,12 @@ files:
|
|
529
547
|
- fixtures/vcr_cassettes/revoke-ssl-parameter-valid-non-200-sync.yml
|
530
548
|
- fixtures/vcr_cassettes/single-event-invalid-json.yml
|
531
549
|
- fixtures/vcr_cassettes/single-event-non200.yml
|
550
|
+
- fixtures/vcr_cassettes/state-async-set-state-via-subbedclient-2.yml
|
551
|
+
- fixtures/vcr_cassettes/state-async-set-state-via-subbedclient.yml
|
552
|
+
- fixtures/vcr_cassettes/state-async-set-state-via-subscribe.yml
|
553
|
+
- fixtures/vcr_cassettes/state-set-state-via-client-2.yml
|
554
|
+
- fixtures/vcr_cassettes/state-set-state-via-client.yml
|
555
|
+
- fixtures/vcr_cassettes/state-set-state-via-subscribe.yml
|
532
556
|
- fixtures/vcr_cassettes/subscribe-nonssl-block-invalid-200-async.yml
|
533
557
|
- fixtures/vcr_cassettes/subscribe-nonssl-block-invalid-200-sync.yml
|
534
558
|
- fixtures/vcr_cassettes/subscribe-nonssl-block-invalid-non-200-async.yml
|
@@ -627,6 +651,22 @@ files:
|
|
627
651
|
- fixtures/vcr_cassettes/v3-presence-ssl-parameter-valid-200-sync.yml
|
628
652
|
- fixtures/vcr_cassettes/v3-presence-ssl-parameter-valid-non-200-async.yml
|
629
653
|
- fixtures/vcr_cassettes/v3-presence-ssl-parameter-valid-non-200-sync.yml
|
654
|
+
- fixtures/vcr_cassettes/where_now-ssl-block-invalid-200-async.yml
|
655
|
+
- fixtures/vcr_cassettes/where_now-ssl-block-invalid-200-sync.yml
|
656
|
+
- fixtures/vcr_cassettes/where_now-ssl-block-invalid-non-200-async.yml
|
657
|
+
- fixtures/vcr_cassettes/where_now-ssl-block-invalid-non-200-sync.yml
|
658
|
+
- fixtures/vcr_cassettes/where_now-ssl-block-valid-200-async.yml
|
659
|
+
- fixtures/vcr_cassettes/where_now-ssl-block-valid-200-sync.yml
|
660
|
+
- fixtures/vcr_cassettes/where_now-ssl-block-valid-non-200-async.yml
|
661
|
+
- fixtures/vcr_cassettes/where_now-ssl-block-valid-non-200-sync.yml
|
662
|
+
- fixtures/vcr_cassettes/where_now-ssl-parameter-invalid-200-async.yml
|
663
|
+
- fixtures/vcr_cassettes/where_now-ssl-parameter-invalid-200-sync.yml
|
664
|
+
- fixtures/vcr_cassettes/where_now-ssl-parameter-invalid-non-200-async.yml
|
665
|
+
- fixtures/vcr_cassettes/where_now-ssl-parameter-invalid-non-200-sync.yml
|
666
|
+
- fixtures/vcr_cassettes/where_now-ssl-parameter-valid-200-async.yml
|
667
|
+
- fixtures/vcr_cassettes/where_now-ssl-parameter-valid-200-sync.yml
|
668
|
+
- fixtures/vcr_cassettes/where_now-ssl-parameter-valid-non-200-async.yml
|
669
|
+
- fixtures/vcr_cassettes/where_now-ssl-parameter-valid-non-200-sync.yml
|
630
670
|
- lib/pubnub.rb
|
631
671
|
- lib/pubnub/client.rb
|
632
672
|
- lib/pubnub/configuration.rb
|
@@ -642,8 +682,11 @@ files:
|
|
642
682
|
- lib/pubnub/events/presence.rb
|
643
683
|
- lib/pubnub/events/publish.rb
|
644
684
|
- lib/pubnub/events/revoke.rb
|
685
|
+
- lib/pubnub/events/set_state.rb
|
686
|
+
- lib/pubnub/events/state.rb
|
645
687
|
- lib/pubnub/events/subscribe.rb
|
646
688
|
- lib/pubnub/events/time.rb
|
689
|
+
- lib/pubnub/events/where_now.rb
|
647
690
|
- lib/pubnub/exceptions.rb
|
648
691
|
- lib/pubnub/formatter.rb
|
649
692
|
- lib/pubnub/pam.rb
|
@@ -653,6 +696,7 @@ files:
|
|
653
696
|
- lib/pubnub/version.rb
|
654
697
|
- pubnub.gemspec
|
655
698
|
- spec/lib/auth_key_flow_spec.rb
|
699
|
+
- spec/lib/channel_presence_concat_pam_spec.rb
|
656
700
|
- spec/lib/client_spec.rb
|
657
701
|
- spec/lib/encoder_spec.rb
|
658
702
|
- spec/lib/eof_error_spec.rb
|
@@ -678,17 +722,17 @@ files:
|
|
678
722
|
- spec/lib/integration/publish_spec_old.rb
|
679
723
|
- spec/lib/integration/revoke_dpc_spec.rb
|
680
724
|
- spec/lib/integration/revoke_spec.rb
|
725
|
+
- spec/lib/integration/state_spec.rb
|
681
726
|
- spec/lib/integration/subscribe_dpc_spec.rb
|
682
727
|
- spec/lib/integration/subscribe_spec.rb
|
683
728
|
- spec/lib/integration/time_dpc_spec.rb
|
684
729
|
- spec/lib/integration/time_spec.rb
|
685
730
|
- spec/lib/integration/v3_presence_dpc_spec.rb
|
686
731
|
- spec/lib/integration/v3_presence_spec.rb
|
732
|
+
- spec/lib/integration/where_now_spec.rb
|
687
733
|
- spec/lib/retry_logic_spec.rb
|
688
734
|
- spec/lib/subscribe_event.rb
|
689
735
|
- spec/spec_helper.rb
|
690
|
-
- spec/tools/pam-test-generator.rb
|
691
|
-
- spec/tools/test-generator.rb
|
692
736
|
homepage: http://github.com/pubnub/ruby
|
693
737
|
licenses:
|
694
738
|
- MIT
|
@@ -712,6 +756,44 @@ rubyforge_project:
|
|
712
756
|
rubygems_version: 2.0.3
|
713
757
|
signing_key:
|
714
758
|
specification_version: 4
|
715
|
-
summary: PubNub Official Ruby gem
|
716
|
-
test_files:
|
759
|
+
summary: PubNub Official Ruby gem.
|
760
|
+
test_files:
|
761
|
+
- spec/lib/auth_key_flow_spec.rb
|
762
|
+
- spec/lib/channel_presence_concat_pam_spec.rb
|
763
|
+
- spec/lib/client_spec.rb
|
764
|
+
- spec/lib/encoder_spec.rb
|
765
|
+
- spec/lib/eof_error_spec.rb
|
766
|
+
- spec/lib/formatting_envelope_spec.rb
|
767
|
+
- spec/lib/heartbeat_spec.rb
|
768
|
+
- spec/lib/integration/audit_dpc_spec.rb
|
769
|
+
- spec/lib/integration/audit_spec.rb
|
770
|
+
- spec/lib/integration/global_here_now_dpc_spec.rb
|
771
|
+
- spec/lib/integration/global_here_now_spec.rb
|
772
|
+
- spec/lib/integration/grant_dpc_spec.rb
|
773
|
+
- spec/lib/integration/grant_spec.rb
|
774
|
+
- spec/lib/integration/here_now_dpc_spec.rb
|
775
|
+
- spec/lib/integration/here_now_spec.rb
|
776
|
+
- spec/lib/integration/history_dpc_spec.rb
|
777
|
+
- spec/lib/integration/history_spec.rb
|
778
|
+
- spec/lib/integration/leave_dpc_spec.rb
|
779
|
+
- spec/lib/integration/leave_spec.rb
|
780
|
+
- spec/lib/integration/multiplexed_subscribe_flow_spec.rb
|
781
|
+
- spec/lib/integration/presence_dpc_spec.rb
|
782
|
+
- spec/lib/integration/presence_spec.rb
|
783
|
+
- spec/lib/integration/publish_dpc_spec.rb
|
784
|
+
- spec/lib/integration/publish_spec.rb
|
785
|
+
- spec/lib/integration/publish_spec_old.rb
|
786
|
+
- spec/lib/integration/revoke_dpc_spec.rb
|
787
|
+
- spec/lib/integration/revoke_spec.rb
|
788
|
+
- spec/lib/integration/state_spec.rb
|
789
|
+
- spec/lib/integration/subscribe_dpc_spec.rb
|
790
|
+
- spec/lib/integration/subscribe_spec.rb
|
791
|
+
- spec/lib/integration/time_dpc_spec.rb
|
792
|
+
- spec/lib/integration/time_spec.rb
|
793
|
+
- spec/lib/integration/v3_presence_dpc_spec.rb
|
794
|
+
- spec/lib/integration/v3_presence_spec.rb
|
795
|
+
- spec/lib/integration/where_now_spec.rb
|
796
|
+
- spec/lib/retry_logic_spec.rb
|
797
|
+
- spec/lib/subscribe_event.rb
|
798
|
+
- spec/spec_helper.rb
|
717
799
|
has_rdoc:
|