pubnub 4.0.9 → 4.0.12

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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/.pubnub.yml +49 -3
  3. data/CHANGELOG.md +10 -0
  4. data/Gemfile.lock +2 -2
  5. data/VERSION +1 -1
  6. data/fixtures/vcr_cassettes/examples/status_request_message_count_exceeded.yml +1484 -0
  7. data/fixtures/vcr_cassettes/lib/super_admin/cg.yml +47 -0
  8. data/fixtures/vcr_cassettes/lib/super_admin/here_now.yml +47 -0
  9. data/fixtures/vcr_cassettes/lib/super_admin/history.yml +46 -0
  10. data/fixtures/vcr_cassettes/lib/super_admin/leave.yml +46 -0
  11. data/fixtures/vcr_cassettes/lib/super_admin/presence.yml +79 -0
  12. data/fixtures/vcr_cassettes/lib/super_admin/publish.yml +40 -0
  13. data/fixtures/vcr_cassettes/lib/super_admin/state.yml +47 -0
  14. data/fixtures/vcr_cassettes/lib/super_admin/subscribe.yml +77 -0
  15. data/fixtures/vcr_cassettes/lib/super_admin/time.yml +40 -0
  16. data/fixtures/vcr_cassettes/lib/super_admin/where_now.yml +47 -0
  17. data/lib/pubnub/client.rb +4 -0
  18. data/lib/pubnub/configuration.rb +2 -1
  19. data/lib/pubnub/constants.rb +2 -0
  20. data/lib/pubnub/event.rb +78 -20
  21. data/lib/pubnub/events/audit.rb +4 -0
  22. data/lib/pubnub/events/channel_registration.rb +3 -36
  23. data/lib/pubnub/events/grant.rb +4 -0
  24. data/lib/pubnub/events/heartbeat.rb +5 -38
  25. data/lib/pubnub/events/here_now.rb +5 -38
  26. data/lib/pubnub/events/history.rb +5 -38
  27. data/lib/pubnub/events/leave.rb +4 -39
  28. data/lib/pubnub/events/presence.rb +6 -0
  29. data/lib/pubnub/events/publish.rb +12 -45
  30. data/lib/pubnub/events/revoke.rb +4 -0
  31. data/lib/pubnub/events/set_state.rb +5 -33
  32. data/lib/pubnub/events/state.rb +5 -38
  33. data/lib/pubnub/events/subscribe.rb +6 -0
  34. data/lib/pubnub/events/time.rb +4 -37
  35. data/lib/pubnub/events/where_now.rb +4 -37
  36. data/lib/pubnub/formatter.rb +7 -5
  37. data/lib/pubnub/pam.rb +0 -18
  38. data/lib/pubnub/single_event.rb +0 -4
  39. data/lib/pubnub/subscribe_event.rb +3 -1
  40. data/lib/pubnub/subscribe_event/callbacks.rb +11 -0
  41. data/lib/pubnub/subscriber.rb +31 -0
  42. data/lib/pubnub/version.rb +1 -1
  43. data/spec/examples/channel_registration_examples_spec.rb +0 -1
  44. data/spec/examples/heartbeat_examples_spec.rb +0 -1
  45. data/spec/examples/here_now_examples_spec.rb +0 -1
  46. data/spec/examples/history_examples_spec.rb +0 -1
  47. data/spec/examples/leave_examples_spec.rb +0 -1
  48. data/spec/examples/presence_examples_spec.rb +0 -1
  49. data/spec/examples/publish_examples_spec.rb +0 -865
  50. data/spec/examples/revoke_examples_spec.rb +3888 -3888
  51. data/spec/examples/set_state_examples_spec.rb +0 -1
  52. data/spec/examples/state_examples_spec.rb +0 -1
  53. data/spec/examples/status_request_message_count_exceeded_spec.rb +41 -0
  54. data/spec/examples/subscribe_examples_spec.rb +0 -445
  55. data/spec/examples/time_examples_spec.rb +0 -1
  56. data/spec/examples/where_now_examples_spec.rb +0 -1
  57. data/spec/lib/events/channel_registration_spec.rb +0 -1
  58. data/spec/lib/events/heartbeat_spec.rb +0 -1
  59. data/spec/lib/events/here_now_spec.rb +0 -1
  60. data/spec/lib/events/history_spec.rb +0 -1
  61. data/spec/lib/events/leave_spec.rb +0 -1
  62. data/spec/lib/events/presence_spec.rb +0 -4
  63. data/spec/lib/events/publish_spec.rb +0 -3
  64. data/spec/lib/events/state_spec.rb +0 -1
  65. data/spec/lib/events/subscribe_spec.rb +0 -7
  66. data/spec/lib/events/time_spec.rb +0 -1
  67. data/spec/lib/events/timeout_handling_spec.rb +30 -0
  68. data/spec/lib/events/where_now_spec.rb +0 -1
  69. data/spec/lib/super_admin_spec.rb +166 -0
  70. data/spec/spec_helper.rb +5 -3
  71. metadata +33 -16
@@ -11,7 +11,6 @@ describe Pubnub::Time do
11
11
  @pubnub = Pubnub.new(
12
12
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
13
13
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
14
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
15
14
  uuid: 'ruby-test-uuid-client-one',
16
15
  auth_key: 'ruby-test-auth-client-one'
17
16
  )
@@ -11,7 +11,6 @@ describe Pubnub::WhereNow do
11
11
  @pubnub = Pubnub.new(
12
12
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
13
13
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
14
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
15
14
  uuid: 'ruby-test-uuid-client-one',
16
15
  auth_key: 'ruby-test-auth-client-one'
17
16
  )
@@ -14,7 +14,6 @@ describe Pubnub::ChannelRegistration do
14
14
  @pubnub = Pubnub::Client.new(
15
15
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
16
16
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
17
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
18
17
  auth_key: 'ruby-test-auth',
19
18
  uuid: 'ruby-test-uuid'
20
19
  )
@@ -14,7 +14,6 @@ describe Pubnub::Heartbeat do
14
14
  @pubnub = Pubnub::Client.new(
15
15
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
16
16
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
17
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
18
17
  auth_key: 'ruby-test-auth',
19
18
  uuid: 'ruby-test-uuid'
20
19
  )
@@ -14,7 +14,6 @@ describe Pubnub::HereNow do
14
14
  @pubnub = Pubnub::Client.new(
15
15
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
16
16
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
17
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
18
17
  auth_key: 'ruby-test-auth',
19
18
  uuid: 'ruby-test-uuid'
20
19
  )
@@ -14,7 +14,6 @@ describe Pubnub::History do
14
14
  @pubnub = Pubnub::Client.new(
15
15
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
16
16
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
17
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
18
17
  auth_key: 'ruby-test-auth',
19
18
  uuid: 'ruby-test-uuid'
20
19
  )
@@ -14,7 +14,6 @@ describe Pubnub::Leave do
14
14
  @pubnub = Pubnub::Client.new(
15
15
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
16
16
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
17
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
18
17
  auth_key: 'ruby-test-auth',
19
18
  uuid: 'ruby-test-uuid'
20
19
  )
@@ -27,7 +27,6 @@ describe Pubnub::Presence do
27
27
  @pubnub = Pubnub::Client.new(
28
28
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
29
29
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
30
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
31
30
  auth_key: 'ruby-test-auth',
32
31
  uuid: 'ruby-test-uuid'
33
32
  )
@@ -52,7 +51,6 @@ describe Pubnub::Presence do
52
51
  @pubnub = Pubnub::Client.new(
53
52
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
54
53
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
55
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
56
54
  auth_key: 'ruby-test-auth',
57
55
  uuid: 'ruby-test-uuid'
58
56
  )
@@ -78,7 +76,6 @@ describe Pubnub::Presence do
78
76
  @pubnub = Pubnub::Client.new(
79
77
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
80
78
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
81
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
82
79
  auth_key: 'ruby-test-auth',
83
80
  uuid: 'ruby-test-uuid'
84
81
  )
@@ -99,7 +96,6 @@ describe Pubnub::Presence do
99
96
  @pubnub = Pubnub::Client.new(
100
97
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
101
98
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
102
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
103
99
  auth_key: 'ruby-test-auth',
104
100
  uuid: 'ruby-test-uuid'
105
101
  )
@@ -14,7 +14,6 @@ describe Pubnub::Publish do
14
14
  @pubnub = Pubnub::Client.new(
15
15
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
16
16
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
17
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
18
17
  auth_key: 'ruby-test-auth',
19
18
  uuid: 'ruby-test-uuid'
20
19
  )
@@ -50,9 +49,7 @@ describe Pubnub::Publish do
50
49
  :subscribe_key => :demo,
51
50
  :publish_key => :demo,
52
51
  :auth_key => :demoish_authkey,
53
- :secret_key => 'some_secret_key',
54
52
  :error_callback => @error_callback
55
-
56
53
  )
57
54
 
58
55
  @pubnub.uuid = 'tester'
@@ -14,7 +14,6 @@ describe Pubnub::State do
14
14
  @pubnub = Pubnub::Client.new(
15
15
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
16
16
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
17
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
18
17
  auth_key: 'ruby-test-auth',
19
18
  uuid: 'ruby-test-uuid'
20
19
  )
@@ -27,7 +27,6 @@ describe Pubnub::Subscribe do
27
27
  @pubnub = Pubnub::Client.new(
28
28
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
29
29
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
30
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
31
30
  auth_key: 'ruby-test-auth',
32
31
  uuid: 'ruby-test-uuid'
33
32
  )
@@ -86,7 +85,6 @@ describe Pubnub::Subscribe do
86
85
  @pubnub = Pubnub::Client.new(
87
86
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
88
87
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
89
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
90
88
  auth_key: 'ruby-test-auth',
91
89
  uuid: 'ruby-test-uuid'
92
90
  )
@@ -129,7 +127,6 @@ describe Pubnub::Subscribe do
129
127
  @pubnub = Pubnub::Client.new(
130
128
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
131
129
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
132
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
133
130
  auth_key: 'ruby-test-auth',
134
131
  uuid: 'ruby-test-uuid'
135
132
  )
@@ -150,7 +147,6 @@ describe Pubnub::Subscribe do
150
147
  @pubnub = Pubnub::Client.new(
151
148
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
152
149
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
153
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
154
150
  auth_key: 'ruby-test-auth',
155
151
  uuid: 'ruby-test-uuid'
156
152
  )
@@ -172,7 +168,6 @@ describe Pubnub::Subscribe do
172
168
  @pubnub = Pubnub::Client.new(
173
169
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
174
170
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
175
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
176
171
  auth_key: 'ruby-test-auth',
177
172
  uuid: 'ruby-test-uuid'
178
173
  )
@@ -194,7 +189,6 @@ describe Pubnub::Subscribe do
194
189
  @pubnub = Pubnub::Client.new(
195
190
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
196
191
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
197
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
198
192
  auth_key: 'ruby-test-auth',
199
193
  uuid: 'ruby-test-uuid'
200
194
  )
@@ -215,7 +209,6 @@ describe Pubnub::Subscribe do
215
209
  @pubnub = Pubnub::Client.new(
216
210
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
217
211
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
218
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
219
212
  auth_key: 'ruby-test-auth',
220
213
  uuid: 'ruby-test-uuid'
221
214
  )
@@ -14,7 +14,6 @@ describe Pubnub::Time do
14
14
  @pubnub = Pubnub::Client.new(
15
15
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
16
16
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
17
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
18
17
  auth_key: 'ruby-test-auth',
19
18
  uuid: 'ruby-test-uuid'
20
19
  )
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'timeout' do
4
+ around :each do |example|
5
+ Celluloid.boot
6
+ example.run
7
+ Celluloid.shutdown
8
+ end
9
+
10
+ context 'in single event' do
11
+ before :each do
12
+ @pubnub = Pubnub::Client.new(
13
+ subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
14
+ publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
15
+ auth_key: 'ruby-test-auth',
16
+ uuid: 'ruby-test-uuid'
17
+ )
18
+ end
19
+
20
+ it 'forms valid ErrorEnvelope on error' do
21
+ HTTPClient.any_instance.stub(get: HTTPClient::ReceiveTimeoutError.new)
22
+
23
+ envelope = @pubnub.time.value
24
+ expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
25
+ expect(envelope.status[:code]).to eq 408
26
+ expect(envelope.status[:category]).to eq Pubnub::Constants::STATUS_TIMEOUT
27
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
28
+ end
29
+ end
30
+ end
@@ -14,7 +14,6 @@ describe Pubnub::WhereNow do
14
14
  @pubnub = Pubnub::Client.new(
15
15
  subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
16
16
  publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
17
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
18
17
  auth_key: 'ruby-test-auth',
19
18
  uuid: 'ruby-test-uuid'
20
19
  )
@@ -0,0 +1,166 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Super admin mode' do
4
+
5
+ around :each do |example|
6
+ Celluloid.boot
7
+ example.run
8
+ Celluloid.shutdown
9
+ end
10
+
11
+ before(:each) do
12
+ Pubnub::Client.any_instance.stub(:sdk_version).and_return('PubNub-Ruby/4.0.10')
13
+
14
+ @messages = []
15
+ @statuses = []
16
+ @presences = []
17
+
18
+ @callbacks = Pubnub::SubscribeCallback.new(
19
+ message: ->(envelope) { @messages << envelope },
20
+ presence: ->(envelope) { @presences << envelope },
21
+ status: ->(envelope) { @statuses << envelope }
22
+ )
23
+
24
+ @pubnub = Pubnub.new(
25
+ subscribe_key: 'sub-c-f9f24520-9c56-11e6-a681-02ee2ddab7fe',
26
+ publish_key: 'pub-c-9bb9ae77-a60c-4788-96ab-75cbe5d5dd11',
27
+ secret_key: 'sec-c-MjZkYmQyMDUtYmRhZi00ZDY3LThjZGQtNjU2NmNjNmJkODM3',
28
+ uuid: 'ruby-test',
29
+ reconnect_interval: 0
30
+ )
31
+
32
+ @pubnub.add_listener(callback: @callbacks)
33
+ end
34
+
35
+ it 'works with channel registration' do
36
+ Pubnub::ChannelRegistration.any_instance.stub(:current_time).and_return(1477672650)
37
+
38
+ VCR.use_cassette('lib/super_admin/cg', record: :once) do
39
+ envelope = @pubnub.channel_registration(
40
+ action: :add,
41
+ channel: :demo,
42
+ group: :demo
43
+ ).value
44
+
45
+ expect(envelope.status[:client_request].to_s.index('&signature=')).to be_truthy
46
+ end
47
+ end
48
+
49
+ it 'works with here_now' do
50
+ Pubnub::HereNow.any_instance.stub(:current_time).and_return(1477672650)
51
+
52
+ VCR.use_cassette('lib/super_admin/here_now', record: :once) do
53
+ envelope = @pubnub.here_now(
54
+ channel: :demo
55
+ ).value
56
+
57
+ expect(envelope.status[:client_request].to_s.index('&signature=')).to be_truthy
58
+ end
59
+ end
60
+
61
+ it 'works with history' do
62
+ Pubnub::History.any_instance.stub(:current_time).and_return(1477672650)
63
+
64
+ VCR.use_cassette('lib/super_admin/history', record: :once) do
65
+ envelope = @pubnub.history(
66
+ channel: :demo
67
+ ).value
68
+
69
+ expect(envelope.status[:client_request].to_s.index('&signature=')).to be_truthy
70
+
71
+ end
72
+ end
73
+
74
+ it 'works with leave' do
75
+ Pubnub::Leave.any_instance.stub(:current_time).and_return(1477907746)
76
+
77
+ VCR.use_cassette('lib/super_admin/leave', record: :once) do
78
+ envelope = @pubnub.leave(
79
+ channel: :demo
80
+ ).value
81
+
82
+ expect(envelope.status[:client_request].to_s.index('&signature=')).to be_truthy
83
+ end
84
+ end
85
+
86
+ it 'works with presence' do
87
+ VCR.use_cassette('lib/super_admin/presence', record: :once) do
88
+ Pubnub::Subscribe.any_instance.stub(:current_time).and_return(1477921137)
89
+
90
+ @pubnub.presence(channel: :demo)
91
+
92
+ eventually do
93
+ envelope = @presences.first
94
+ expect(envelope.status[:client_request].to_s.index('&signature=')).to be_truthy
95
+ end
96
+
97
+ end
98
+ end
99
+
100
+ it 'works with publish' do
101
+ Pubnub::Publish.any_instance.stub(:current_time).and_return(1477919007)
102
+ Pubnub::Client.any_instance.stub(:generate_ortt).and_return(14779190077911314)
103
+
104
+ VCR.use_cassette('lib/super_admin/publish', record: :once) do
105
+ envelope = @pubnub.publish(
106
+ channel: 'demo',
107
+ message: 'whatever',
108
+ http_sync: true
109
+ )
110
+
111
+ expect(envelope.status[:client_request].to_s.index('&signature=')).to be_truthy
112
+ expect(envelope).to be_an_instance_of(Pubnub::Envelope)
113
+ end
114
+ end
115
+
116
+ it 'works with state' do
117
+ Pubnub::State.any_instance.stub(:current_time).and_return(1477672672)
118
+
119
+ VCR.use_cassette('lib/super_admin/state', record: :once) do
120
+ envelope = @pubnub.state(
121
+ channel: :demo,
122
+ uuid: :whatever
123
+ ).value
124
+
125
+ expect(envelope.status[:client_request].to_s.index('&signature=')).to be_truthy
126
+
127
+ end
128
+ end
129
+
130
+ it 'works with subscribe' do
131
+ Pubnub::Subscribe.any_instance.stub(:current_time).and_return(1477921157)
132
+
133
+
134
+ VCR.use_cassette('lib/super_admin/subscribe', record: :once) do
135
+ @pubnub.subscribe(channel: :demo)
136
+
137
+ eventually do
138
+ envelope = @messages.first
139
+ expect(envelope.status[:client_request].to_s.index('&signature=')).to be_truthy
140
+ end
141
+ end
142
+ end
143
+
144
+ it 'works with time' do
145
+ Pubnub::Time.any_instance.stub(:current_time).and_return(1477672693)
146
+
147
+ VCR.use_cassette('lib/super_admin/time', record: :once) do
148
+ envelope = @pubnub.time.value
149
+
150
+ expect(envelope.status[:client_request].to_s.index('&signature=')).to be_truthy
151
+ end
152
+ end
153
+
154
+ it 'works with where_now' do
155
+ Pubnub::WhereNow.any_instance.stub(:current_time).and_return(1477672693)
156
+
157
+ VCR.use_cassette('lib/super_admin/where_now', record: :once) do
158
+ envelope = @pubnub.where_now(
159
+ uuid: 'ruby-test'
160
+ ).value
161
+
162
+ expect(envelope.status[:client_request].to_s.index('&signature=')).to be_truthy
163
+
164
+ end
165
+ end
166
+ end
data/spec/spec_helper.rb CHANGED
@@ -57,9 +57,11 @@ RSpec.configure do |config|
57
57
  logfile.sync = true
58
58
  Celluloid.logger = Logger.new(logfile)
59
59
 
60
- # config.around do |example|
61
- # Timeout.timeout(20) do
62
- # example.run
60
+ # config.around(:each) do |example|
61
+ # if example.metadata[:disable_vcr]
62
+ # WebMock.allow_net_connect!
63
+ # VCR.turned_off { example_method.run }
64
+ # WebMock.disable_net_connect!
63
65
  # end
64
66
  # end
65
67
  end
metadata CHANGED
@@ -1,31 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubnub
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.9
4
+ version: 4.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - PubNub
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-10 00:00:00.000000000 Z
11
+ date: 2016-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: celluloid
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
18
  version: '0.17'
20
- type: :runtime
19
+ name: celluloid
21
20
  prerelease: false
21
+ type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.17'
27
27
  - !ruby/object:Gem::Dependency
28
- name: json
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - ">="
@@ -34,8 +33,9 @@ dependencies:
34
33
  - - "<"
35
34
  - !ruby/object:Gem::Version
36
35
  version: '3'
37
- type: :runtime
36
+ name: json
38
37
  prerelease: false
38
+ type: :runtime
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - ">="
@@ -45,42 +45,42 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: '3'
47
47
  - !ruby/object:Gem::Dependency
48
- name: httpclient
49
48
  requirement: !ruby/object:Gem::Requirement
50
49
  requirements:
51
50
  - - "~>"
52
51
  - !ruby/object:Gem::Version
53
52
  version: '2.8'
54
- type: :runtime
53
+ name: httpclient
55
54
  prerelease: false
55
+ type: :runtime
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '2.8'
61
61
  - !ruby/object:Gem::Dependency
62
- name: dry-validation
63
62
  requirement: !ruby/object:Gem::Requirement
64
63
  requirements:
65
64
  - - "~>"
66
65
  - !ruby/object:Gem::Version
67
66
  version: '0.10'
68
- type: :runtime
67
+ name: dry-validation
69
68
  prerelease: false
69
+ type: :runtime
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0.10'
75
75
  - !ruby/object:Gem::Dependency
76
- name: bundler
77
76
  requirement: !ruby/object:Gem::Requirement
78
77
  requirements:
79
78
  - - "~>"
80
79
  - !ruby/object:Gem::Version
81
80
  version: '1.7'
82
- type: :development
81
+ name: bundler
83
82
  prerelease: false
83
+ type: :development
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
@@ -9974,6 +9974,7 @@ files:
9974
9974
  - fixtures/vcr_cassettes/examples/state/7.yml
9975
9975
  - fixtures/vcr_cassettes/examples/state/8.yml
9976
9976
  - fixtures/vcr_cassettes/examples/state/9.yml
9977
+ - fixtures/vcr_cassettes/examples/status_request_message_count_exceeded.yml
9977
9978
  - fixtures/vcr_cassettes/examples/subscribe/0.yml
9978
9979
  - fixtures/vcr_cassettes/examples/subscribe/1.yml
9979
9980
  - fixtures/vcr_cassettes/examples/subscribe/10.yml
@@ -10469,6 +10470,16 @@ files:
10469
10470
  - fixtures/vcr_cassettes/lib/events/time.yml
10470
10471
  - fixtures/vcr_cassettes/lib/events/where-now-error.yml
10471
10472
  - fixtures/vcr_cassettes/lib/events/where-now.yml
10473
+ - fixtures/vcr_cassettes/lib/super_admin/cg.yml
10474
+ - fixtures/vcr_cassettes/lib/super_admin/here_now.yml
10475
+ - fixtures/vcr_cassettes/lib/super_admin/history.yml
10476
+ - fixtures/vcr_cassettes/lib/super_admin/leave.yml
10477
+ - fixtures/vcr_cassettes/lib/super_admin/presence.yml
10478
+ - fixtures/vcr_cassettes/lib/super_admin/publish.yml
10479
+ - fixtures/vcr_cassettes/lib/super_admin/state.yml
10480
+ - fixtures/vcr_cassettes/lib/super_admin/subscribe.yml
10481
+ - fixtures/vcr_cassettes/lib/super_admin/time.yml
10482
+ - fixtures/vcr_cassettes/lib/super_admin/where_now.yml
10472
10483
  - fixtures/vcr_cassettes/test_examples/audit-158_http_sync_true_callback_block_channel_channel_auth-key_key.yml
10473
10484
  - lib/pubnub.rb
10474
10485
  - lib/pubnub/client.rb
@@ -10544,6 +10555,7 @@ files:
10544
10555
  - spec/examples/revoke_examples_spec.rb
10545
10556
  - spec/examples/set_state_examples_spec.rb
10546
10557
  - spec/examples/state_examples_spec.rb
10558
+ - spec/examples/status_request_message_count_exceeded_spec.rb
10547
10559
  - spec/examples/subscribe_examples_spec.rb
10548
10560
  - spec/examples/time_examples_spec.rb
10549
10561
  - spec/examples/where_now_examples_spec.rb
@@ -10564,8 +10576,10 @@ files:
10564
10576
  - spec/lib/events/state_spec.rb
10565
10577
  - spec/lib/events/subscribe_spec.rb
10566
10578
  - spec/lib/events/time_spec.rb
10579
+ - spec/lib/events/timeout_handling_spec.rb
10567
10580
  - spec/lib/events/where_now_spec.rb
10568
10581
  - spec/lib/pubnub_spec.rb
10582
+ - spec/lib/super_admin_spec.rb
10569
10583
  - spec/lib/uuid_spec.rb
10570
10584
  - spec/spec_expectations.rb
10571
10585
  - spec/spec_helper.rb
@@ -10591,9 +10605,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
10591
10605
  - !ruby/object:Gem::Version
10592
10606
  version: '0'
10593
10607
  requirements: []
10594
- rubyforge_project:
10595
- rubygems_version: 2.5.1
10596
- signing_key:
10608
+ rubyforge_project:
10609
+ rubygems_version: 2.6.6
10610
+ signing_key:
10597
10611
  specification_version: 4
10598
10612
  summary: PubNub Official Ruby gem.
10599
10613
  test_files:
@@ -10609,6 +10623,7 @@ test_files:
10609
10623
  - spec/examples/revoke_examples_spec.rb
10610
10624
  - spec/examples/set_state_examples_spec.rb
10611
10625
  - spec/examples/state_examples_spec.rb
10626
+ - spec/examples/status_request_message_count_exceeded_spec.rb
10612
10627
  - spec/examples/subscribe_examples_spec.rb
10613
10628
  - spec/examples/time_examples_spec.rb
10614
10629
  - spec/examples/where_now_examples_spec.rb
@@ -10629,8 +10644,10 @@ test_files:
10629
10644
  - spec/lib/events/state_spec.rb
10630
10645
  - spec/lib/events/subscribe_spec.rb
10631
10646
  - spec/lib/events/time_spec.rb
10647
+ - spec/lib/events/timeout_handling_spec.rb
10632
10648
  - spec/lib/events/where_now_spec.rb
10633
10649
  - spec/lib/pubnub_spec.rb
10650
+ - spec/lib/super_admin_spec.rb
10634
10651
  - spec/lib/uuid_spec.rb
10635
10652
  - spec/spec_expectations.rb
10636
10653
  - spec/spec_helper.rb