pubnub 4.0.23 → 4.0.25
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/.pubnub.yml +18 -1
- data/.travis.yml +23 -6
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +59 -50
- data/VERSION +1 -1
- data/fixtures/vcr_cassettes/examples/delete_messages_channel.yml +46 -0
- data/fixtures/vcr_cassettes/examples/delete_messages_channel_end.yml +46 -0
- data/fixtures/vcr_cassettes/examples/delete_messages_channel_start.yml +46 -0
- data/fixtures/vcr_cassettes/examples/delete_messages_channel_start_end.yml +46 -0
- data/fixtures/vcr_cassettes/lib/events/delete_messages-error.yml +46 -0
- data/fixtures/vcr_cassettes/lib/events/delete_messages.yml +46 -0
- data/gemfiles/celluloid_017.gemfile +25 -0
- data/gemfiles/celluloid_017.gemfile.lock +159 -0
- data/gemfiles/celluloid_018.gemfile +25 -0
- data/gemfiles/celluloid_018.gemfile.lock +159 -0
- data/gemfiles/celluloid_master.gemfile +25 -0
- data/gemfiles/celluloid_master.gemfile.lock +155 -0
- data/lib/pubnub.rb +3 -0
- data/lib/pubnub/client.rb +13 -1
- data/lib/pubnub/client/events.rb +1 -1
- data/lib/pubnub/constants.rb +1 -0
- data/lib/pubnub/event.rb +20 -5
- data/lib/pubnub/event/formatter.rb +1 -3
- data/lib/pubnub/events/channel_registration.rb +1 -0
- data/lib/pubnub/events/delete_messages.rb +63 -0
- data/lib/pubnub/events/heartbeat.rb +1 -0
- data/lib/pubnub/events/here_now.rb +1 -0
- data/lib/pubnub/events/history.rb +1 -0
- data/lib/pubnub/events/leave.rb +1 -0
- data/lib/pubnub/events/presence.rb +1 -0
- data/lib/pubnub/events/publish.rb +1 -0
- data/lib/pubnub/events/set_state.rb +1 -0
- data/lib/pubnub/events/state.rb +1 -0
- data/lib/pubnub/events/time.rb +1 -0
- data/lib/pubnub/events/where_now.rb +1 -0
- data/lib/pubnub/pam.rb +2 -1
- data/lib/pubnub/telemetry.rb +29 -0
- data/lib/pubnub/validators/delete.rb +24 -0
- data/lib/pubnub/version.rb +1 -1
- data/spec/examples/audit_examples_spec.rb +3 -1
- data/spec/examples/channel_registration_examples_spec.rb +3 -1
- data/spec/examples/delete_messages_examples_spec.rb +48 -0
- data/spec/examples/grant_examples_spec.rb +2 -2
- data/spec/examples/heartbeat_examples_spec.rb +2 -2
- data/spec/examples/here_now_examples_spec.rb +2 -2
- data/spec/examples/history_examples_spec.rb +2 -2
- data/spec/examples/leave_examples_spec.rb +2 -2
- data/spec/examples/presence_examples_spec.rb +2 -2
- data/spec/examples/publish_examples_spec.rb +2 -2
- data/spec/examples/publish_with_ttl_spec.rb +3 -2
- data/spec/examples/revoke_examples_spec.rb +2 -2
- data/spec/examples/set_state_examples_spec.rb +2 -2
- data/spec/examples/state_examples_spec.rb +2 -2
- data/spec/examples/subscribe_examples_spec.rb +2 -2
- data/spec/examples/time_examples_spec.rb +2 -2
- data/spec/examples/where_now_examples_spec.rb +2 -2
- data/spec/lib/events/delete_messages_spec.rb +43 -0
- data/spec/lib/events/grant_spec.rb +27 -28
- data/spec/lib/events/timeout_handling_spec.rb +20 -14
- data/spec/lib/pubnub_spec.rb +7 -1
- data/spec/spec_helper.rb +21 -0
- metadata +22 -3
@@ -2,6 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Pubnub::Time do
|
4
4
|
around :each do |example|
|
5
|
+
Celluloid.boot
|
6
|
+
|
5
7
|
@fired = false
|
6
8
|
|
7
9
|
@callback = ->(_envelope) do
|
@@ -15,7 +17,6 @@ describe Pubnub::Time do
|
|
15
17
|
auth_key: 'ruby-test-auth-client-one'
|
16
18
|
)
|
17
19
|
|
18
|
-
Celluloid.boot
|
19
20
|
example.run
|
20
21
|
Celluloid.shutdown
|
21
22
|
end
|
@@ -126,4 +127,3 @@ end
|
|
126
127
|
|
127
128
|
|
128
129
|
end
|
129
|
-
|
@@ -2,6 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Pubnub::WhereNow do
|
4
4
|
around :each do |example|
|
5
|
+
Celluloid.boot
|
6
|
+
|
5
7
|
@fired = false
|
6
8
|
|
7
9
|
@callback = ->(_envelope) do
|
@@ -15,7 +17,6 @@ describe Pubnub::WhereNow do
|
|
15
17
|
auth_key: 'ruby-test-auth-client-one'
|
16
18
|
)
|
17
19
|
|
18
|
-
Celluloid.boot
|
19
20
|
example.run
|
20
21
|
Celluloid.shutdown
|
21
22
|
end
|
@@ -132,4 +133,3 @@ end
|
|
132
133
|
|
133
134
|
|
134
135
|
end
|
135
|
-
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pubnub::DeleteMessages do
|
4
|
+
it_behaves_like 'an event'
|
5
|
+
|
6
|
+
around :each do |example|
|
7
|
+
Celluloid.boot
|
8
|
+
example.run
|
9
|
+
Celluloid.shutdown
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'given basic parameters' do
|
13
|
+
before :each do
|
14
|
+
@pubnub = Pubnub::Client.new(
|
15
|
+
subscribe_key: 'sub-c-fc6c9226-655d-11e7-b272-02ee2ddab7fe',
|
16
|
+
publish_key: 'pub-c-b458bb23-c95d-4f43-9992-e2c118557e80',
|
17
|
+
auth_key: 'ruby-test-auth',
|
18
|
+
uuid: 'ruby-test-uuid'
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'works' do
|
23
|
+
VCR.use_cassette('lib/events/delete_messages', record: :once) do
|
24
|
+
envelope = @pubnub.delete_messages(
|
25
|
+
channel: :demo
|
26
|
+
).value
|
27
|
+
|
28
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'forms valid ErrorEnvelope on error' do
|
33
|
+
VCR.use_cassette('lib/events/delete_messages-error', record: :once) do
|
34
|
+
envelope = @pubnub.delete_messages(
|
35
|
+
channel: :demo
|
36
|
+
).value
|
37
|
+
|
38
|
+
expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
|
39
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -11,24 +11,26 @@ describe Pubnub::Grant do
|
|
11
11
|
|
12
12
|
context 'given basic parameters' do
|
13
13
|
before :each do
|
14
|
-
Pubnub::Grant.
|
15
|
-
Pubnub::Grant.
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
allow_any_instance_of(Pubnub::Grant).to receive(:current_time).and_return 1463146850
|
15
|
+
allow_any_instance_of(Pubnub::Grant).to receive(:signature).and_return 'udCXAk-z4VaU2JA2LgjVzED2LBZAKsjj86twYJoGPnY='
|
16
|
+
end
|
17
|
+
let(:pubnub) do
|
18
|
+
Pubnub::Client.new(
|
19
|
+
subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
|
20
|
+
publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
|
21
|
+
secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
|
22
|
+
auth_key: 'ruby-test-auth',
|
23
|
+
uuid: 'ruby-test-uuid'
|
23
24
|
)
|
24
25
|
end
|
26
|
+
let(:envelope) do
|
27
|
+
pubnub.grant(
|
28
|
+
channel: :demo
|
29
|
+
).value
|
30
|
+
end
|
25
31
|
|
26
32
|
it 'works' do
|
27
33
|
VCR.use_cassette('lib/events/grant', record: :once) do
|
28
|
-
envelope = @pubnub.grant(
|
29
|
-
channel: :demo
|
30
|
-
).value
|
31
|
-
|
32
34
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
|
33
35
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
|
34
36
|
end
|
@@ -36,28 +38,25 @@ describe Pubnub::Grant do
|
|
36
38
|
|
37
39
|
it 'forms valid ErrorEnvelope on error' do
|
38
40
|
VCR.use_cassette('lib/events/grant-error', record: :once) do
|
39
|
-
envelope = @pubnub.grant(
|
40
|
-
channel: :demo
|
41
|
-
).value
|
42
|
-
|
43
41
|
expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
|
44
42
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
|
45
43
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
|
46
44
|
end
|
47
45
|
end
|
48
46
|
|
49
|
-
|
50
|
-
HTTPClient
|
47
|
+
[
|
48
|
+
HTTPClient::ConnectTimeoutError,
|
49
|
+
HTTPClient::ReceiveTimeoutError,
|
50
|
+
HTTPClient::SendTimeoutError
|
51
|
+
].each do |error_class|
|
52
|
+
it "forms valid ErrorEnvelope on #{error_class}" do
|
53
|
+
allow_any_instance_of(HTTPClient).to receive(:get).and_return error_class.new
|
51
54
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
expect(envelope.status[:code]).to eq 408
|
58
|
-
expect(envelope.status[:category]).to eq Pubnub::Constants::STATUS_TIMEOUT
|
59
|
-
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
|
55
|
+
expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
|
56
|
+
expect(envelope.status[:code]).to eq 408
|
57
|
+
expect(envelope.status[:category]).to eq Pubnub::Constants::STATUS_TIMEOUT
|
58
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
|
59
|
+
end
|
60
60
|
end
|
61
61
|
end
|
62
|
-
|
63
62
|
end
|
@@ -8,23 +8,29 @@ describe 'timeout' do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
context 'in single event' do
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
let(:pubnub) do
|
12
|
+
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
17
|
)
|
18
18
|
end
|
19
|
+
let(:envelope) { pubnub.time.value }
|
19
20
|
|
20
|
-
|
21
|
-
HTTPClient
|
21
|
+
[
|
22
|
+
HTTPClient::ConnectTimeoutError,
|
23
|
+
HTTPClient::ReceiveTimeoutError,
|
24
|
+
HTTPClient::SendTimeoutError
|
25
|
+
].each do |error_class|
|
26
|
+
it "forms valid ErrorEnvelope on #{error_class}" do
|
27
|
+
allow_any_instance_of(HTTPClient).to receive(:get).and_return error_class.new
|
22
28
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
29
|
+
expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
|
30
|
+
expect(envelope.status[:code]).to eq 408
|
31
|
+
expect(envelope.status[:category]).to eq Pubnub::Constants::STATUS_TIMEOUT
|
32
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
|
33
|
+
end
|
28
34
|
end
|
29
35
|
end
|
30
|
-
end
|
36
|
+
end
|
data/spec/lib/pubnub_spec.rb
CHANGED
@@ -2,9 +2,15 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Pubnub do
|
4
4
|
|
5
|
+
around :each do |example|
|
6
|
+
Celluloid.boot
|
7
|
+
example.run
|
8
|
+
Celluloid.shutdown
|
9
|
+
end
|
10
|
+
|
5
11
|
context 'version' do
|
6
12
|
it 'has VERSION' do
|
7
|
-
expect(Pubnub::VERSION).to
|
13
|
+
expect(Pubnub::VERSION).to match(/\d+\.\d+\..+/)
|
8
14
|
end
|
9
15
|
end
|
10
16
|
|
data/spec/spec_helper.rb
CHANGED
@@ -23,6 +23,26 @@ end
|
|
23
23
|
|
24
24
|
Celluloid.task_class = Celluloid::Task::Threaded
|
25
25
|
|
26
|
+
module CelluloidHotFix
|
27
|
+
# We can't shutdown the actor if there is no actor running.
|
28
|
+
#
|
29
|
+
# See https://github.com/celluloid/celluloid/pull/766
|
30
|
+
def shutdown
|
31
|
+
super if @actor_system
|
32
|
+
@actor_system = nil
|
33
|
+
end
|
34
|
+
|
35
|
+
# We can't verify if the actor is running if there is no actor
|
36
|
+
# running.
|
37
|
+
#
|
38
|
+
# This is a problem generated by the hotfix above.
|
39
|
+
def running?
|
40
|
+
super if @actor_system
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
Celluloid.singleton_class.prepend(CelluloidHotFix)
|
45
|
+
|
26
46
|
# AsyncHelper allows us to wait for async operations
|
27
47
|
module AsyncHelper
|
28
48
|
def eventually(options = {})
|
@@ -75,4 +95,5 @@ VCR.configure do |c|
|
|
75
95
|
match_requests_on: [:method,
|
76
96
|
VCR.request_matchers.uri_without_param(:pnsdk, :uuid, :ortt, :seqn, :t)]
|
77
97
|
}
|
98
|
+
c.debug_logger = File.open('vcr.log', 'w')
|
78
99
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubnub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PubNub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|
@@ -237,6 +237,10 @@ files:
|
|
237
237
|
- fixtures/vcr_cassettes/examples/channel_registration/7.yml
|
238
238
|
- fixtures/vcr_cassettes/examples/channel_registration/8.yml
|
239
239
|
- fixtures/vcr_cassettes/examples/channel_registration/9.yml
|
240
|
+
- fixtures/vcr_cassettes/examples/delete_messages_channel.yml
|
241
|
+
- fixtures/vcr_cassettes/examples/delete_messages_channel_end.yml
|
242
|
+
- fixtures/vcr_cassettes/examples/delete_messages_channel_start.yml
|
243
|
+
- fixtures/vcr_cassettes/examples/delete_messages_channel_start_end.yml
|
240
244
|
- fixtures/vcr_cassettes/examples/grant/0.yml
|
241
245
|
- fixtures/vcr_cassettes/examples/grant/1.yml
|
242
246
|
- fixtures/vcr_cassettes/examples/grant/10.yml
|
@@ -10451,6 +10455,8 @@ files:
|
|
10451
10455
|
- fixtures/vcr_cassettes/lib/events/audit-works.yml
|
10452
10456
|
- fixtures/vcr_cassettes/lib/events/channel-registration-error.yml
|
10453
10457
|
- fixtures/vcr_cassettes/lib/events/channel-registration.yml
|
10458
|
+
- fixtures/vcr_cassettes/lib/events/delete_messages-error.yml
|
10459
|
+
- fixtures/vcr_cassettes/lib/events/delete_messages.yml
|
10454
10460
|
- fixtures/vcr_cassettes/lib/events/grant-error.yml
|
10455
10461
|
- fixtures/vcr_cassettes/lib/events/grant.yml
|
10456
10462
|
- fixtures/vcr_cassettes/lib/events/heartbeat-error.yml
|
@@ -10512,6 +10518,12 @@ files:
|
|
10512
10518
|
- fixtures/vcr_cassettes/lib/super_admin/time.yml
|
10513
10519
|
- fixtures/vcr_cassettes/lib/super_admin/where_now.yml
|
10514
10520
|
- fixtures/vcr_cassettes/test_examples/audit-158_http_sync_true_callback_block_channel_channel_auth-key_key.yml
|
10521
|
+
- gemfiles/celluloid_017.gemfile
|
10522
|
+
- gemfiles/celluloid_017.gemfile.lock
|
10523
|
+
- gemfiles/celluloid_018.gemfile
|
10524
|
+
- gemfiles/celluloid_018.gemfile.lock
|
10525
|
+
- gemfiles/celluloid_master.gemfile
|
10526
|
+
- gemfiles/celluloid_master.gemfile.lock
|
10515
10527
|
- lib/pubnub.rb
|
10516
10528
|
- lib/pubnub/client.rb
|
10517
10529
|
- lib/pubnub/client/events.rb
|
@@ -10529,6 +10541,7 @@ files:
|
|
10529
10541
|
- lib/pubnub/event/signature.rb
|
10530
10542
|
- lib/pubnub/events/audit.rb
|
10531
10543
|
- lib/pubnub/events/channel_registration.rb
|
10544
|
+
- lib/pubnub/events/delete_messages.rb
|
10532
10545
|
- lib/pubnub/events/grant.rb
|
10533
10546
|
- lib/pubnub/events/heartbeat.rb
|
10534
10547
|
- lib/pubnub/events/here_now.rb
|
@@ -10557,11 +10570,13 @@ files:
|
|
10557
10570
|
- lib/pubnub/subscribe_event/heartbeat.rb
|
10558
10571
|
- lib/pubnub/subscribe_event/removing.rb
|
10559
10572
|
- lib/pubnub/subscriber.rb
|
10573
|
+
- lib/pubnub/telemetry.rb
|
10560
10574
|
- lib/pubnub/uuid.rb
|
10561
10575
|
- lib/pubnub/validators/audit.rb
|
10562
10576
|
- lib/pubnub/validators/channel_registration.rb
|
10563
10577
|
- lib/pubnub/validators/client.rb
|
10564
10578
|
- lib/pubnub/validators/common_validator.rb
|
10579
|
+
- lib/pubnub/validators/delete.rb
|
10565
10580
|
- lib/pubnub/validators/grant.rb
|
10566
10581
|
- lib/pubnub/validators/heartbeat.rb
|
10567
10582
|
- lib/pubnub/validators/here_now.rb
|
@@ -10579,6 +10594,7 @@ files:
|
|
10579
10594
|
- pubnub.gemspec
|
10580
10595
|
- spec/examples/audit_examples_spec.rb
|
10581
10596
|
- spec/examples/channel_registration_examples_spec.rb
|
10597
|
+
- spec/examples/delete_messages_examples_spec.rb
|
10582
10598
|
- spec/examples/grant_examples_spec.rb
|
10583
10599
|
- spec/examples/heartbeat_examples_spec.rb
|
10584
10600
|
- spec/examples/here_now_examples_spec.rb
|
@@ -10600,6 +10616,7 @@ files:
|
|
10600
10616
|
- spec/lib/event_spec.rb
|
10601
10617
|
- spec/lib/events/audit_spec.rb
|
10602
10618
|
- spec/lib/events/channel_registration_spec.rb
|
10619
|
+
- spec/lib/events/delete_messages_spec.rb
|
10603
10620
|
- spec/lib/events/grant_spec.rb
|
10604
10621
|
- spec/lib/events/heartbeat_spec.rb
|
10605
10622
|
- spec/lib/events/here_now_spec.rb
|
@@ -10643,13 +10660,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
10643
10660
|
version: '0'
|
10644
10661
|
requirements: []
|
10645
10662
|
rubyforge_project:
|
10646
|
-
rubygems_version: 2.
|
10663
|
+
rubygems_version: 2.6.11
|
10647
10664
|
signing_key:
|
10648
10665
|
specification_version: 4
|
10649
10666
|
summary: PubNub Official Ruby gem.
|
10650
10667
|
test_files:
|
10651
10668
|
- spec/examples/audit_examples_spec.rb
|
10652
10669
|
- spec/examples/channel_registration_examples_spec.rb
|
10670
|
+
- spec/examples/delete_messages_examples_spec.rb
|
10653
10671
|
- spec/examples/grant_examples_spec.rb
|
10654
10672
|
- spec/examples/heartbeat_examples_spec.rb
|
10655
10673
|
- spec/examples/here_now_examples_spec.rb
|
@@ -10671,6 +10689,7 @@ test_files:
|
|
10671
10689
|
- spec/lib/event_spec.rb
|
10672
10690
|
- spec/lib/events/audit_spec.rb
|
10673
10691
|
- spec/lib/events/channel_registration_spec.rb
|
10692
|
+
- spec/lib/events/delete_messages_spec.rb
|
10674
10693
|
- spec/lib/events/grant_spec.rb
|
10675
10694
|
- spec/lib/events/heartbeat_spec.rb
|
10676
10695
|
- spec/lib/events/here_now_spec.rb
|