pubnub 4.2.5 → 4.5.0
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/.github/CODEOWNERS +1 -0
- data/.pubnub.yml +168 -117
- data/.travis.yml +13 -9
- data/CHANGELOG.md +31 -8
- data/Gemfile.lock +67 -64
- data/README.md +56 -17
- data/VERSION +1 -1
- data/fixtures/vcr_cassettes/examples/add_channels_to_push/001.yml +45 -0
- data/fixtures/vcr_cassettes/examples/add_channels_to_push/002.yml +45 -0
- data/fixtures/vcr_cassettes/examples/add_channels_to_push/003.yml +45 -0
- data/fixtures/vcr_cassettes/examples/add_channels_to_push/004.yml +45 -0
- data/fixtures/vcr_cassettes/examples/grant/1913.yml +1 -1
- data/fixtures/vcr_cassettes/examples/grant/1944.yml +8 -9
- data/fixtures/vcr_cassettes/examples/grant/1945.yml +359 -9
- data/fixtures/vcr_cassettes/examples/grant/1946.yml +8 -9
- data/fixtures/vcr_cassettes/examples/grant/1947.yml +8 -9
- data/fixtures/vcr_cassettes/examples/grant/1948.yml +8 -9
- data/fixtures/vcr_cassettes/examples/history/100.yml +46 -0
- data/fixtures/vcr_cassettes/examples/history/include_meta__encrypted.yml +46 -0
- data/fixtures/vcr_cassettes/examples/history/include_token__encrypted.yml +45 -0
- data/fixtures/vcr_cassettes/examples/history/no_includes__encrypted.yml +45 -0
- data/fixtures/vcr_cassettes/examples/list_push_provisions/001.yml +46 -0
- data/fixtures/vcr_cassettes/examples/list_push_provisions/002.yml +45 -0
- data/fixtures/vcr_cassettes/examples/list_push_provisions/003.yml +45 -0
- data/fixtures/vcr_cassettes/examples/remove_channels_from_push/001.yml +45 -0
- data/fixtures/vcr_cassettes/examples/remove_channels_from_push/002.yml +45 -0
- data/fixtures/vcr_cassettes/examples/remove_channels_from_push/003.yml +45 -0
- data/fixtures/vcr_cassettes/examples/remove_device_from_push/001.yml +45 -0
- data/fixtures/vcr_cassettes/examples/remove_device_from_push/002.yml +45 -0
- data/fixtures/vcr_cassettes/examples/remove_device_from_push/003.yml +45 -0
- data/fixtures/vcr_cassettes/lib/events/get_all_channels_metadata.yml +39 -0
- data/fixtures/vcr_cassettes/lib/events/get_all_uuid_metadata.yml +76 -0
- data/fixtures/vcr_cassettes/lib/events/get_channel_members.yml +37 -0
- data/fixtures/vcr_cassettes/lib/events/get_channel_metadata.yml +37 -0
- data/fixtures/vcr_cassettes/lib/events/get_memberships1.yml +37 -0
- data/fixtures/vcr_cassettes/lib/events/get_memberships2.yml +37 -0
- data/fixtures/vcr_cassettes/lib/events/get_uuid_metadata1.yml +76 -0
- data/fixtures/vcr_cassettes/lib/events/get_uuid_metadata2.yml +76 -0
- data/fixtures/vcr_cassettes/lib/events/grant-error.yml +2 -2
- data/fixtures/vcr_cassettes/lib/events/grant.yml +10 -11
- data/fixtures/vcr_cassettes/lib/events/remove_channel_members.yml +78 -0
- data/fixtures/vcr_cassettes/lib/events/{delete_space.yml → remove_channel_metadata.yml} +5 -6
- data/fixtures/vcr_cassettes/lib/events/{manage_memberships_remove.yml → remove_memberships1.yml} +8 -9
- data/fixtures/vcr_cassettes/lib/events/{manage_members_add.yml → remove_memberships2.yml} +8 -9
- data/fixtures/vcr_cassettes/lib/events/remove_uuid_metadata1.yml +76 -0
- data/fixtures/vcr_cassettes/lib/events/remove_uuid_metadata2.yml +76 -0
- data/fixtures/vcr_cassettes/lib/events/set_channel_members.yml +39 -0
- data/fixtures/vcr_cassettes/lib/events/set_channel_metadata.yml +39 -0
- data/fixtures/vcr_cassettes/lib/events/{manage_memberships_add.yml → set_memberships1.yml} +8 -9
- data/fixtures/vcr_cassettes/lib/events/set_memberships2.yml +39 -0
- data/fixtures/vcr_cassettes/lib/events/set_uuid_metadata1.yml +78 -0
- data/fixtures/vcr_cassettes/lib/events/set_uuid_metadata2.yml +78 -0
- data/fixtures/vcr_cassettes/lib/events/{subscribe-space-delete-async.yml → subscribe-channel-metadata-remove-sync.yml} +12 -14
- data/fixtures/vcr_cassettes/lib/events/subscribe-channel-metadata-set-async.yml +75 -0
- data/fixtures/vcr_cassettes/lib/events/{subscribe-member-remove-async.yml → subscribe-member-remove-sync.yml} +12 -14
- data/fixtures/vcr_cassettes/lib/events/subscribe-member-set-async.yml +75 -0
- data/fixtures/vcr_cassettes/lib/events/subscribe-membership-remove-async.yml +12 -14
- data/fixtures/vcr_cassettes/lib/events/{subscribe-user-update-async.yml → subscribe-membership-set-async.yml} +12 -14
- data/fixtures/vcr_cassettes/lib/events/{subscribe-user-delete-async.yml → subscribe-uuid-metadata-remove-sync.yml} +12 -14
- data/fixtures/vcr_cassettes/lib/events/subscribe-uuid-metadata-set-async.yml +75 -0
- data/lib/pubnub/client.rb +18 -15
- data/lib/pubnub/client/events.rb +4 -2
- data/lib/pubnub/client/paged_history.rb +1 -1
- data/lib/pubnub/constants.rb +19 -18
- data/lib/pubnub/event.rb +32 -16
- data/lib/pubnub/event/formatter.rb +4 -0
- data/lib/pubnub/event/signature.rb +22 -7
- data/lib/pubnub/events/add_channels_to_push.rb +29 -13
- data/lib/pubnub/events/get_all_channels_metadata.rb +104 -0
- data/lib/pubnub/events/get_all_uuid_metadata.rb +104 -0
- data/lib/pubnub/events/get_channel_members.rb +120 -0
- data/lib/pubnub/events/{update_space.rb → get_channel_metadata.rb} +27 -27
- data/lib/pubnub/events/get_memberships.rb +120 -0
- data/lib/pubnub/events/{create_space.rb → get_uuid_metadata.rb} +27 -25
- data/lib/pubnub/events/grant.rb +10 -1
- data/lib/pubnub/events/history.rb +17 -2
- data/lib/pubnub/events/list_push_provisions.rb +29 -12
- data/lib/pubnub/events/remove_channel_members.rb +137 -0
- data/lib/pubnub/events/{delete_space.rb → remove_channel_metadata.rb} +12 -12
- data/lib/pubnub/events/remove_channels_from_push.rb +29 -13
- data/lib/pubnub/events/remove_device_from_push.rb +30 -14
- data/lib/pubnub/events/remove_memberships.rb +137 -0
- data/lib/pubnub/events/{delete_user.rb → remove_uuid_metadata.rb} +12 -12
- data/lib/pubnub/events/set_channel_members.rb +140 -0
- data/lib/pubnub/events/{manage_members.rb → set_channel_metadata.rb} +32 -38
- data/lib/pubnub/events/set_memberships.rb +140 -0
- data/lib/pubnub/events/{create_user.rb → set_uuid_metadata.rb} +33 -17
- data/lib/pubnub/formatter.rb +30 -3
- data/lib/pubnub/pam.rb +2 -11
- data/lib/pubnub/subscribe_callback.rb +1 -3
- data/lib/pubnub/subscribe_event/formatter.rb +26 -17
- data/lib/pubnub/subscriber.rb +5 -6
- data/lib/pubnub/validators/add_channels_to_push.rb +52 -0
- data/lib/pubnub/validators/get_all_channels_metadata.rb +29 -0
- data/lib/pubnub/validators/get_all_uuid_metadata.rb +29 -0
- data/lib/pubnub/validators/get_channel_members.rb +39 -0
- data/lib/pubnub/validators/get_channel_metadata.rb +39 -0
- data/lib/pubnub/validators/get_memberships.rb +39 -0
- data/lib/pubnub/validators/get_uuid_metadata.rb +39 -0
- data/lib/pubnub/validators/grant.rb +37 -2
- data/lib/pubnub/validators/list_push_provisions.rb +43 -0
- data/lib/pubnub/validators/remove_channel_members.rb +52 -0
- data/lib/pubnub/validators/remove_channel_metadata.rb +39 -0
- data/lib/pubnub/validators/remove_channels_from_push.rb +52 -0
- data/lib/pubnub/validators/remove_device_from_push.rb +43 -0
- data/lib/pubnub/validators/remove_memberships.rb +52 -0
- data/lib/pubnub/validators/remove_uuid_metadata.rb +39 -0
- data/lib/pubnub/validators/set_channel_members.rb +78 -0
- data/lib/pubnub/validators/set_channel_metadata.rb +62 -0
- data/lib/pubnub/validators/set_memberships.rb +78 -0
- data/lib/pubnub/validators/set_uuid_metadata.rb +62 -0
- data/lib/pubnub/version.rb +1 -1
- data/pubnub.gemspec +1 -1
- data/spec/examples/add_channels_to_push_spec.rb +178 -0
- data/spec/examples/{grant_examples_spec.rb → grant_examples_1_spec.rb} +0 -8973
- data/spec/examples/grant_examples_2_spec.rb +9107 -0
- data/spec/examples/history_examples_spec.rb +85 -0
- data/spec/examples/list_push_provisions_spec.rb +164 -0
- data/spec/examples/presence_examples_spec.rb +222 -186
- data/spec/examples/remove_channels_from_push_spec.rb +164 -0
- data/spec/examples/remove_device_from_push_spec.rb +164 -0
- data/spec/examples/revoke_examples_1_spec.rb +27013 -0
- data/spec/examples/revoke_examples_2_spec.rb +27012 -0
- data/spec/examples/revoke_examples_3_spec.rb +17967 -0
- data/spec/examples/status_request_message_count_exceeded_spec.rb +4 -1
- data/spec/examples/subscribe_examples_1_spec.rb +26972 -0
- data/spec/examples/subscribe_examples_2_spec.rb +19575 -0
- data/spec/lib/connection_callback_spec.rb +4 -3
- data/spec/lib/event/formatter_spec.rb +22 -0
- data/spec/lib/events/channel_metadata_spec.rb +58 -0
- data/spec/lib/events/grant_spec.rb +3 -2
- data/spec/lib/events/membership_spec.rb +51 -21
- data/spec/lib/events/presence_delta_spec.rb +9 -6
- data/spec/lib/events/presence_spec.rb +13 -7
- data/spec/lib/events/subscribe_spec.rb +102 -65
- data/spec/lib/events/uuid_metadata_spec.rb +86 -0
- data/spec/lib/subscribe_event/formatter_spec.rb +22 -0
- data/spec/lib/super_admin_spec.rb +8 -4
- data/spec/spec_helper.rb +24 -8
- metadata +124 -79
- data/fixtures/vcr_cassettes/lib/events/create_space.yml +0 -40
- data/fixtures/vcr_cassettes/lib/events/create_user.yml +0 -40
- data/fixtures/vcr_cassettes/lib/events/delete_user.yml +0 -38
- data/fixtures/vcr_cassettes/lib/events/get_members.yml +0 -38
- data/fixtures/vcr_cassettes/lib/events/get_space.yml +0 -38
- data/fixtures/vcr_cassettes/lib/events/get_space_memberships.yml +0 -38
- data/fixtures/vcr_cassettes/lib/events/get_spaces.yml +0 -40
- data/fixtures/vcr_cassettes/lib/events/get_user.yml +0 -38
- data/fixtures/vcr_cassettes/lib/events/get_users.yml +0 -40
- data/fixtures/vcr_cassettes/lib/events/manage_members_remove.yml +0 -83
- data/fixtures/vcr_cassettes/lib/events/subscribe-member-add-async.yml +0 -77
- data/fixtures/vcr_cassettes/lib/events/subscribe-membership-add-async.yml +0 -77
- data/fixtures/vcr_cassettes/lib/events/subscribe-space-update-async.yml +0 -77
- data/fixtures/vcr_cassettes/lib/events/update_space.yml +0 -40
- data/fixtures/vcr_cassettes/lib/events/update_user.yml +0 -40
- data/lib/pubnub/events/get_members.rb +0 -93
- data/lib/pubnub/events/get_space.rb +0 -74
- data/lib/pubnub/events/get_space_memberships.rb +0 -93
- data/lib/pubnub/events/get_spaces.rb +0 -90
- data/lib/pubnub/events/get_user.rb +0 -74
- data/lib/pubnub/events/get_users.rb +0 -90
- data/lib/pubnub/events/manage_memberships.rb +0 -105
- data/lib/pubnub/events/update_user.rb +0 -86
- data/lib/pubnub/validators/create_space.rb +0 -44
- data/lib/pubnub/validators/create_user.rb +0 -44
- data/lib/pubnub/validators/delete_space.rb +0 -32
- data/lib/pubnub/validators/delete_user.rb +0 -32
- data/lib/pubnub/validators/get_members.rb +0 -32
- data/lib/pubnub/validators/get_space.rb +0 -32
- data/lib/pubnub/validators/get_space_memberships.rb +0 -32
- data/lib/pubnub/validators/get_spaces.rb +0 -16
- data/lib/pubnub/validators/get_user.rb +0 -32
- data/lib/pubnub/validators/get_users.rb +0 -16
- data/lib/pubnub/validators/manage_members.rb +0 -45
- data/lib/pubnub/validators/manage_memberships.rb +0 -45
- data/lib/pubnub/validators/push.rb +0 -43
- data/lib/pubnub/validators/update_space.rb +0 -45
- data/lib/pubnub/validators/update_user.rb +0 -45
- data/spec/examples/revoke_examples_spec.rb +0 -71950
- data/spec/examples/subscribe_examples_spec.rb +0 -45184
- data/spec/lib/events/space_spec.rb +0 -75
- data/spec/lib/events/user_spec.rb +0 -75
@@ -7,6 +7,7 @@ describe "Connect, disconnect and reconnect callbacks" do
|
|
7
7
|
|
8
8
|
before(:each) do
|
9
9
|
@connect_messages, @reconnect_messages, @disconnect_messages = [], [], []
|
10
|
+
@sleep_duration = ENV['JRUBY_TEST'] == 'true' ? 1.5 : 0.5
|
10
11
|
|
11
12
|
callback = Pubnub::SubscribeCallback.new(
|
12
13
|
message: -> (_envelope) { },
|
@@ -37,7 +38,7 @@ describe "Connect, disconnect and reconnect callbacks" do
|
|
37
38
|
it "fire connect callback when connection is made" do
|
38
39
|
VCR.use_cassette("client/connection_callbacks_0", :record => :once) do
|
39
40
|
@pubnub.subscribe(channel: :demo)
|
40
|
-
sleep
|
41
|
+
sleep @sleep_duration
|
41
42
|
expect(@connect_messages.size).to be > 0
|
42
43
|
end
|
43
44
|
end
|
@@ -47,7 +48,7 @@ describe "Connect, disconnect and reconnect callbacks" do
|
|
47
48
|
|
48
49
|
VCR.use_cassette("client/connection_callbacks_1", :record => :once) do
|
49
50
|
@pubnub.subscribe(channel: :demo)
|
50
|
-
sleep
|
51
|
+
sleep @sleep_duration
|
51
52
|
expect(@disconnect_messages.size).to be > 0
|
52
53
|
end
|
53
54
|
end
|
@@ -57,7 +58,7 @@ describe "Connect, disconnect and reconnect callbacks" do
|
|
57
58
|
|
58
59
|
VCR.use_cassette("client/connection_callbacks_2", :record => :once) do
|
59
60
|
@pubnub.subscribe(channel: :demo)
|
60
|
-
sleep
|
61
|
+
sleep @sleep_duration
|
61
62
|
expect(@reconnect_messages.size).to be > 0
|
62
63
|
end
|
63
64
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "formatter" do
|
4
|
+
around :each do |example|
|
5
|
+
example.run_with_retry retry: 10
|
6
|
+
end
|
7
|
+
|
8
|
+
it "does not hide errors when formatting" do
|
9
|
+
class MockFormatter
|
10
|
+
include Pubnub::Event::EFormatter
|
11
|
+
end
|
12
|
+
|
13
|
+
class TestError < StandardError
|
14
|
+
def message
|
15
|
+
"This is a test"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# ensure the correct error is raised instead of -> NoMethodError: undefined method `body'
|
20
|
+
expect { MockFormatter.new.format_envelopes(TestError.new('error'), nil) }.to raise_error(TestError)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Pubnub::SetChannelMetadata do
|
4
|
+
it_behaves_like "an event"
|
5
|
+
|
6
|
+
context "given basic parameters" do
|
7
|
+
before :each do
|
8
|
+
@pubnub = Pubnub::Client.new(
|
9
|
+
subscribe_key: "sub-a-mock-key",
|
10
|
+
publish_key: "pub-a-mock-key",
|
11
|
+
auth_key: "ruby-test-auth",
|
12
|
+
uuid: "ruby-test-uuid"
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "set_channel_metadata_works" do
|
17
|
+
VCR.use_cassette("lib/events/set_channel_metadata", record: :once) do
|
18
|
+
envelope = @pubnub.set_channel_metadata(
|
19
|
+
channel: "rb_channel",
|
20
|
+
metadata: { name: "some_name", custom: { XXX: "YYYY" } },
|
21
|
+
include: { custom: true }
|
22
|
+
).value
|
23
|
+
|
24
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
25
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it "get_channel_metadata_works" do
|
30
|
+
VCR.use_cassette("lib/events/get_channel_metadata", record: :once) do
|
31
|
+
envelope = @pubnub.get_channel_metadata(channel: "rb_channel", include: { custom: true }).value
|
32
|
+
|
33
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
34
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
it "get_all_channels_metadata_works" do
|
39
|
+
VCR.use_cassette("lib/events/get_all_channels_metadata", record: :once) do
|
40
|
+
envelope = @pubnub.get_all_channels_metadata(limit: 5, include: { custom: true }).value
|
41
|
+
|
42
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
43
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it "remove_channel_metadata_works" do
|
48
|
+
VCR.use_cassette("lib/events/remove_channel_metadata", record: :once) do
|
49
|
+
envelope = @pubnub.remove_channel_metadata(channel: "rb_channel").value
|
50
|
+
|
51
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
52
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -5,9 +5,10 @@ describe Pubnub::Grant do
|
|
5
5
|
|
6
6
|
context "given basic parameters" do
|
7
7
|
before :each do
|
8
|
-
allow_any_instance_of(Pubnub::Grant).to receive(:current_time).and_return
|
9
|
-
allow_any_instance_of(Pubnub::Grant).to receive(:signature).and_return "
|
8
|
+
allow_any_instance_of(Pubnub::Grant).to receive(:current_time).and_return 1602537897
|
9
|
+
allow_any_instance_of(Pubnub::Grant).to receive(:signature).and_return "v2.OdCTZXne_jEBewh3yY8iNDWcMCHC6BXNrg1Er9JoSTQ"
|
10
10
|
end
|
11
|
+
|
11
12
|
let(:pubnub) do
|
12
13
|
Pubnub::Client.new(
|
13
14
|
subscribe_key: "sub-a-mock-key",
|
@@ -1,63 +1,93 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe Pubnub::
|
3
|
+
describe Pubnub::SetMemberships do
|
4
4
|
it_behaves_like "an event"
|
5
5
|
|
6
6
|
context "given basic parameters" do
|
7
7
|
before :each do
|
8
8
|
@pubnub = Pubnub::Client.new(
|
9
|
-
subscribe_key: "
|
10
|
-
publish_key: "
|
9
|
+
subscribe_key: "sub-a-mock-key",
|
10
|
+
publish_key: "pub-a-mock-key",
|
11
11
|
auth_key: "ruby-test-auth",
|
12
12
|
uuid: "ruby-test-uuid",
|
13
13
|
)
|
14
14
|
end
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
|
16
|
+
it "get_channel_members_works" do
|
17
|
+
VCR.use_cassette("lib/events/get_channel_members", record: :once) do
|
18
|
+
envelope = @pubnub.get_channel_members(channel: "channel-1", include: { count: true, custom: true }).value
|
18
19
|
|
19
20
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
20
21
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
it "
|
25
|
-
VCR.use_cassette("lib/events/
|
26
|
-
envelope = @pubnub.
|
25
|
+
it "get_memberships_works_1" do
|
26
|
+
VCR.use_cassette("lib/events/get_memberships1", record: :once) do
|
27
|
+
envelope = @pubnub.get_memberships(uuid: "mg3", include: { count: true, custom: true }).value
|
27
28
|
|
28
29
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
29
30
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
33
|
-
it "
|
34
|
-
VCR.use_cassette("lib/events/
|
35
|
-
envelope = @pubnub.
|
34
|
+
it "get_memberships_works_2" do
|
35
|
+
VCR.use_cassette("lib/events/get_memberships2", record: :once) do
|
36
|
+
envelope = @pubnub.get_memberships(include: { count: true, custom: true }).value
|
36
37
|
|
37
38
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
38
39
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
39
40
|
end
|
40
41
|
end
|
41
|
-
|
42
|
-
|
43
|
-
|
42
|
+
|
43
|
+
it "set_memberships_works_1" do
|
44
|
+
VCR.use_cassette("lib/events/set_memberships1", record: :once) do
|
45
|
+
envelope = @pubnub.set_memberships(uuid: "mg3", channels: [{ channel: 'channel-1'}], include: { custom: true }).value
|
44
46
|
|
45
47
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
46
48
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
50
|
-
it "
|
51
|
-
VCR.use_cassette("lib/events/
|
52
|
-
envelope = @pubnub.
|
52
|
+
it "set_memberships_works_2" do
|
53
|
+
VCR.use_cassette("lib/events/set_memberships2", record: :once) do
|
54
|
+
envelope = @pubnub.set_memberships(channels: [{ channel: 'channel-1'}], include: { custom: true }).value
|
53
55
|
|
54
56
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
55
57
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
56
58
|
end
|
57
59
|
end
|
58
|
-
|
59
|
-
|
60
|
-
|
60
|
+
|
61
|
+
it "remove_memberships_works_1" do
|
62
|
+
VCR.use_cassette("lib/events/remove_memberships1", record: :once) do
|
63
|
+
envelope = @pubnub.remove_memberships(uuid: "mg3", channels: ['channel-1'], include: { custom: true }).value
|
64
|
+
|
65
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
66
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
it "remove_memberships_works_2" do
|
71
|
+
VCR.use_cassette("lib/events/remove_memberships2", record: :once) do
|
72
|
+
envelope = @pubnub.remove_memberships(channels: ['channel-1'], include: { custom: true }).value
|
73
|
+
|
74
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
75
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
it "set_channel_members_works" do
|
80
|
+
VCR.use_cassette("lib/events/set_channel_members", record: :once) do
|
81
|
+
envelope = @pubnub.set_channel_members(channel: "channel-1", uuids: [{uuid: 'mg2'}], include: { custom: true }).value
|
82
|
+
|
83
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
84
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
it "remove_channel_members_works" do
|
89
|
+
VCR.use_cassette("lib/events/remove_channel_members", record: :once) do
|
90
|
+
envelope = @pubnub.remove_channel_members(channel: "channel-1", uuids: ['mg2'], include: { custom: true }).value
|
61
91
|
|
62
92
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
63
93
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
@@ -8,12 +8,12 @@ describe Pubnub::Presence do
|
|
8
8
|
|
9
9
|
context "with interval events and delta" do
|
10
10
|
before :each do
|
11
|
-
@
|
11
|
+
@presences = []
|
12
12
|
@statuses = []
|
13
13
|
|
14
14
|
@callbacks = Pubnub::SubscribeCallback.new(
|
15
15
|
message: -> (_envelope) { },
|
16
|
-
presence: -> (envelope) { @
|
16
|
+
presence: -> (envelope) { @presences << envelope },
|
17
17
|
status: -> (envelope) { @statuses << envelope },
|
18
18
|
)
|
19
19
|
end
|
@@ -26,10 +26,13 @@ describe Pubnub::Presence do
|
|
26
26
|
pubnub.presence(channel: :demo)
|
27
27
|
|
28
28
|
eventually do
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
if @presences.length >= 4
|
30
|
+
expect(@presences[0].result[:data]).to eq({:message => {"action" => "interval", "timestamp" => 1490958575, "occupancy" => 3}, :subscribed_channel => "demo-pnpres", :actual_channel => "demo-pnpres", :publish_time_object => {:timetoken => "14909585750910131", :region_code => 1}, :message_meta_data => nil, :presence_event => "interval", :presence => {:uuid => nil, :timestamp => 1490958575, :state => nil, :occupancy => 3}})
|
31
|
+
expect(@presences[1].result[:data]).to eq({:message => {"action" => "interval", "timestamp" => 1490958585, "occupancy" => 4, "join" => ["Client-d39lr"]}, :subscribed_channel => "demo-pnpres", :actual_channel => "demo-pnpres", :publish_time_object => {:timetoken => "14909585850925693", :region_code => 1}, :message_meta_data => nil, :presence_event => "interval", :presence => {:uuid => nil, :timestamp => 1490958585, :state => nil, :occupancy => 4}})
|
32
|
+
expect(@presences[2].result[:data]).to eq({:message => {"action" => "interval", "timestamp" => 1490958595, "occupancy" => 3, "leave" => ["another-client"]}, :subscribed_channel => "demo-pnpres", :actual_channel => "demo-pnpres", :publish_time_object => {:timetoken => "14909585950916556", :region_code => 1}, :message_meta_data => nil, :presence_event => "interval", :presence => {:uuid => nil, :timestamp => 1490958595, :state => nil, :occupancy => 3}})
|
33
|
+
expect(@presences[3].result[:data]).to eq({:message => {"action" => "interval", "timestamp" => 1490958605, "occupancy" => 2, "join" => ["another-client"], "leave" => ["Client-d39lr", "client0"]}, :subscribed_channel => "demo-pnpres", :actual_channel => "demo-pnpres", :publish_time_object => {:timetoken => "14909586050915528", :region_code => 1}, :message_meta_data => nil, :presence_event => "interval", :presence => {:uuid => nil, :timestamp => 1490958605, :state => nil, :occupancy => 2}})
|
34
|
+
true
|
35
|
+
end
|
33
36
|
end
|
34
37
|
end
|
35
38
|
end
|
@@ -4,7 +4,7 @@ describe Pubnub::Presence do
|
|
4
4
|
around :each do |example|
|
5
5
|
example.run_with_retry retry: 10
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
it_behaves_like "an event"
|
9
9
|
|
10
10
|
context "given basic parameters" do
|
@@ -34,9 +34,12 @@ describe Pubnub::Presence do
|
|
34
34
|
@pubnub.presence(channel: :demo)
|
35
35
|
|
36
36
|
eventually do
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
if @messages.length > 0
|
38
|
+
envelope = @messages.first
|
39
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
40
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
41
|
+
true
|
42
|
+
end
|
40
43
|
end
|
41
44
|
end
|
42
45
|
end
|
@@ -56,9 +59,12 @@ describe Pubnub::Presence do
|
|
56
59
|
sleep 0.1
|
57
60
|
|
58
61
|
eventually do
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
+
if @statuses.length > 0
|
63
|
+
envelope = @statuses.first
|
64
|
+
expect(envelope).to be_a_kind_of Pubnub::ErrorEnvelope
|
65
|
+
# expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
|
66
|
+
true
|
67
|
+
end
|
62
68
|
end
|
63
69
|
end
|
64
70
|
end
|
@@ -13,8 +13,8 @@ describe Pubnub::Subscribe do
|
|
13
13
|
@messages = []
|
14
14
|
@statuses = []
|
15
15
|
@signals = []
|
16
|
-
@
|
17
|
-
@
|
16
|
+
@uuid_metadata_events = []
|
17
|
+
@channel_metadata_events = []
|
18
18
|
@membership_events = []
|
19
19
|
|
20
20
|
@callbacks = Pubnub::SubscribeCallback.new(
|
@@ -22,9 +22,19 @@ describe Pubnub::Subscribe do
|
|
22
22
|
presence: -> (_envelope) { },
|
23
23
|
status: -> (envelope) { @statuses << envelope },
|
24
24
|
signal: -> (envelope) { @signals << envelope },
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
object: -> (envelope) {
|
26
|
+
case envelope.result[:operation]
|
27
|
+
when Pubnub::Constants::OPERATION_SET_UUID_METADATA, Pubnub::Constants::OPERATION_REMOVE_UUID_METADATA
|
28
|
+
@uuid_metadata_events << envelope
|
29
|
+
when Pubnub::Constants::OPERATION_SET_CHANNEL_METADATA, Pubnub::Constants::OPERATION_REMOVE_CHANNEL_METADATA
|
30
|
+
@channel_metadata_events << envelope
|
31
|
+
when Pubnub::Constants::OPERATION_SET_CHANNEL_MEMBERS, Pubnub::Constants::OPERATION_REMOVE_CHANNEL_MEMBERS,
|
32
|
+
Pubnub::Constants::OPERATION_SET_MEMBERSHIPS, Pubnub::Constants::OPERATION_REMOVE_MEMBERSHIPS
|
33
|
+
@membership_events << envelope
|
34
|
+
else
|
35
|
+
puts "Unexpected operation"
|
36
|
+
end
|
37
|
+
}
|
28
38
|
)
|
29
39
|
end
|
30
40
|
|
@@ -43,9 +53,12 @@ describe Pubnub::Subscribe do
|
|
43
53
|
@pubnub.subscribe(channel: :demo)
|
44
54
|
|
45
55
|
eventually do
|
46
|
-
|
47
|
-
|
48
|
-
|
56
|
+
if @messages.length > 0
|
57
|
+
envelope = @messages.first
|
58
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
59
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
60
|
+
true
|
61
|
+
end
|
49
62
|
end
|
50
63
|
end
|
51
64
|
end
|
@@ -64,7 +77,10 @@ describe Pubnub::Subscribe do
|
|
64
77
|
@pubnub.subscribe(channel: :whatever)
|
65
78
|
|
66
79
|
eventually do
|
67
|
-
|
80
|
+
if @messages.length > 0
|
81
|
+
expect(@messages.first.result[:data][:message]).to eq("text" => "hey")
|
82
|
+
true
|
83
|
+
end
|
68
84
|
end
|
69
85
|
end
|
70
86
|
end
|
@@ -100,15 +116,18 @@ describe Pubnub::Subscribe do
|
|
100
116
|
sleep 0.1
|
101
117
|
|
102
118
|
eventually do
|
103
|
-
|
104
|
-
|
105
|
-
|
119
|
+
if @statuses.length > 0
|
120
|
+
envelope = @statuses.first
|
121
|
+
expect(envelope).to be_a_kind_of Pubnub::ErrorEnvelope
|
122
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
123
|
+
true
|
124
|
+
end
|
106
125
|
end
|
107
126
|
end
|
108
127
|
end
|
109
128
|
|
110
|
-
it "
|
111
|
-
VCR.use_cassette("lib/events/subscribe-
|
129
|
+
it "uuid metadata update works" do
|
130
|
+
VCR.use_cassette("lib/events/subscribe-uuid-metadata-set-async", record: :once) do
|
112
131
|
@pubnub = Pubnub::Client.new(
|
113
132
|
subscribe_key: "sub-a-mock-key",
|
114
133
|
publish_key: "pub-a-mock-key",
|
@@ -118,20 +137,24 @@ describe Pubnub::Subscribe do
|
|
118
137
|
|
119
138
|
@pubnub.add_listener(callback: @callbacks)
|
120
139
|
|
121
|
-
@pubnub.subscribe(channel: :
|
140
|
+
@pubnub.subscribe(channel: :uuid_mg3)
|
122
141
|
|
123
142
|
eventually do
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
143
|
+
if @uuid_metadata_events.length > 0
|
144
|
+
envelope = @uuid_metadata_events.first
|
145
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
146
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
147
|
+
expect(envelope.result[:data][:message]['event']).to eq 'set'
|
148
|
+
expect(envelope.result[:data][:message]['type']).to eq 'uuid'
|
149
|
+
expect(envelope.result[:data][:message]['data']['id']).to eq 'uuid_mg3'
|
150
|
+
true
|
151
|
+
end
|
129
152
|
end
|
130
153
|
end
|
131
154
|
end
|
132
155
|
|
133
|
-
it "
|
134
|
-
VCR.use_cassette("lib/events/subscribe-
|
156
|
+
it "channel metadata update works" do
|
157
|
+
VCR.use_cassette("lib/events/subscribe-channel-metadata-set-async", record: :once) do
|
135
158
|
@pubnub = Pubnub::Client.new(
|
136
159
|
subscribe_key: "sub-a-mock-key",
|
137
160
|
publish_key: "pub-a-mock-key",
|
@@ -141,20 +164,24 @@ describe Pubnub::Subscribe do
|
|
141
164
|
|
142
165
|
@pubnub.add_listener(callback: @callbacks)
|
143
166
|
|
144
|
-
@pubnub.subscribe(channel: :
|
167
|
+
@pubnub.subscribe(channel: :rb_channel_3)
|
145
168
|
|
146
169
|
eventually do
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
170
|
+
if @channel_metadata_events.length > 0
|
171
|
+
envelope = @channel_metadata_events.first
|
172
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
173
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
174
|
+
expect(envelope.result[:data][:message]['event']).to eq 'set'
|
175
|
+
expect(envelope.result[:data][:message]['type']).to eq 'channel'
|
176
|
+
# expect(envelope.result[:data][:message]['data']['id']).to eq 'rb_channel_3'
|
177
|
+
true
|
178
|
+
end
|
152
179
|
end
|
153
180
|
end
|
154
181
|
end
|
155
182
|
|
156
|
-
it "member
|
157
|
-
VCR.use_cassette("lib/events/subscribe-member-
|
183
|
+
it "member set works" do
|
184
|
+
VCR.use_cassette("lib/events/subscribe-member-set-async", record: :once) do
|
158
185
|
@pubnub = Pubnub::Client.new(
|
159
186
|
subscribe_key: "sub-a-mock-key",
|
160
187
|
publish_key: "pub-a-mock-key",
|
@@ -164,21 +191,24 @@ describe Pubnub::Subscribe do
|
|
164
191
|
|
165
192
|
@pubnub.add_listener(callback: @callbacks)
|
166
193
|
|
167
|
-
@pubnub.subscribe(channel: :
|
194
|
+
@pubnub.subscribe(channel: :rb_channel_3)
|
168
195
|
|
169
196
|
eventually do
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
197
|
+
if @membership_events.length > 0
|
198
|
+
envelope = @membership_events.first
|
199
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
200
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
201
|
+
expect(envelope.result[:data][:message]['event']).to eq 'set'
|
202
|
+
expect(envelope.result[:data][:message]['type']).to eq 'membership'
|
203
|
+
expect(envelope.result[:data][:message]['data']['uuid']['id']).to eq 'uuid_mg3'
|
204
|
+
true
|
205
|
+
end
|
176
206
|
end
|
177
207
|
end
|
178
208
|
end
|
179
209
|
|
180
|
-
it "membership
|
181
|
-
VCR.use_cassette("lib/events/subscribe-membership-
|
210
|
+
it "membership set works" do
|
211
|
+
VCR.use_cassette("lib/events/subscribe-membership-set-async", record: :once) do
|
182
212
|
@pubnub = Pubnub::Client.new(
|
183
213
|
subscribe_key: "sub-a-mock-key",
|
184
214
|
publish_key: "pub-a-mock-key",
|
@@ -188,15 +218,18 @@ describe Pubnub::Subscribe do
|
|
188
218
|
|
189
219
|
@pubnub.add_listener(callback: @callbacks)
|
190
220
|
|
191
|
-
@pubnub.subscribe(channel: :
|
221
|
+
@pubnub.subscribe(channel: :uuid_mg5)
|
192
222
|
|
193
223
|
eventually do
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
224
|
+
if @membership_events.length > 0
|
225
|
+
envelope = @membership_events.first
|
226
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
227
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
228
|
+
expect(envelope.result[:data][:message]['event']).to eq 'set'
|
229
|
+
expect(envelope.result[:data][:message]['type']).to eq 'membership'
|
230
|
+
expect(envelope.result[:data][:message]['data']['channel']['id']).to eq 'rb_channel_5'
|
231
|
+
true
|
232
|
+
end
|
200
233
|
end
|
201
234
|
end
|
202
235
|
end
|
@@ -217,7 +250,10 @@ describe Pubnub::Subscribe do
|
|
217
250
|
@pubnub.subscribe(channel: :whatever, http_sync: true)
|
218
251
|
@messages = @pubnub.subscribe(channel: :whatever, http_sync: true)
|
219
252
|
eventually do
|
220
|
-
|
253
|
+
if @messages.length > 0
|
254
|
+
expect(@messages.first.result[:data][:message]).to eq("text" => "hey")
|
255
|
+
true
|
256
|
+
end
|
221
257
|
end
|
222
258
|
end
|
223
259
|
end
|
@@ -258,8 +294,8 @@ describe Pubnub::Subscribe do
|
|
258
294
|
end
|
259
295
|
end
|
260
296
|
|
261
|
-
it "
|
262
|
-
VCR.use_cassette("lib/events/subscribe-
|
297
|
+
it "uuid metadata remove works" do
|
298
|
+
VCR.use_cassette("lib/events/subscribe-uuid-metadata-remove-sync", record: :once) do
|
263
299
|
@pubnub = Pubnub::Client.new(
|
264
300
|
subscribe_key: "sub-a-mock-key",
|
265
301
|
publish_key: "pub-a-mock-key",
|
@@ -267,19 +303,20 @@ describe Pubnub::Subscribe do
|
|
267
303
|
uuid: "ruby-test-uuid"
|
268
304
|
)
|
269
305
|
|
270
|
-
@pubnub.subscribe(channel: :
|
271
|
-
envelopes = @pubnub.subscribe(channel: :
|
306
|
+
@pubnub.subscribe(channel: :uuid_mg3, http_sync: true)
|
307
|
+
envelopes = @pubnub.subscribe(channel: :uuid_mg3, http_sync: true)
|
272
308
|
|
273
309
|
envelope = envelopes.first
|
274
310
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
275
311
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
276
312
|
expect(envelope.result[:data][:message]['event']).to eq 'delete'
|
277
|
-
expect(envelope.result[:data][:message]['type']).to eq '
|
313
|
+
expect(envelope.result[:data][:message]['type']).to eq 'uuid'
|
314
|
+
expect(envelope.result[:data][:message]['data']['id']).to eq 'uuid_mg3'
|
278
315
|
end
|
279
316
|
end
|
280
317
|
|
281
|
-
it "
|
282
|
-
VCR.use_cassette("lib/events/subscribe-
|
318
|
+
it "channel metadata remove works" do
|
319
|
+
VCR.use_cassette("lib/events/subscribe-channel-metadata-remove-sync", record: :once) do
|
283
320
|
@pubnub = Pubnub::Client.new(
|
284
321
|
subscribe_key: "sub-a-mock-key",
|
285
322
|
publish_key: "pub-a-mock-key",
|
@@ -287,20 +324,20 @@ describe Pubnub::Subscribe do
|
|
287
324
|
uuid: "ruby-test-uuid"
|
288
325
|
)
|
289
326
|
|
290
|
-
@pubnub.subscribe(channel: :
|
291
|
-
envelopes = @pubnub.subscribe(channel: :
|
327
|
+
@pubnub.subscribe(channel: :rb_channel_1, http_sync: true)
|
328
|
+
envelopes = @pubnub.subscribe(channel: :rb_channel_1, http_sync: true)
|
292
329
|
|
293
330
|
envelope = envelopes.first
|
294
331
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
295
332
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
296
333
|
expect(envelope.result[:data][:message]['event']).to eq 'delete'
|
297
|
-
expect(envelope.result[:data][:message]['type']).to eq '
|
298
|
-
expect(envelope.result[:data][:message]['data']['id']).to eq '
|
334
|
+
expect(envelope.result[:data][:message]['type']).to eq 'channel'
|
335
|
+
expect(envelope.result[:data][:message]['data']['id']).to eq 'rb_channel_1'
|
299
336
|
end
|
300
337
|
end
|
301
338
|
|
302
339
|
it "member remove works" do
|
303
|
-
VCR.use_cassette("lib/events/subscribe-member-remove-
|
340
|
+
VCR.use_cassette("lib/events/subscribe-member-remove-sync", record: :once) do
|
304
341
|
@pubnub = Pubnub::Client.new(
|
305
342
|
subscribe_key: "sub-a-mock-key",
|
306
343
|
publish_key: "pub-a-mock-key",
|
@@ -308,15 +345,15 @@ describe Pubnub::Subscribe do
|
|
308
345
|
uuid: "ruby-test-uuid"
|
309
346
|
)
|
310
347
|
|
311
|
-
@pubnub.subscribe(channel: :
|
312
|
-
envelopes = @pubnub.subscribe(channel: :
|
348
|
+
@pubnub.subscribe(channel: :rb_channel_1, http_sync: true)
|
349
|
+
envelopes = @pubnub.subscribe(channel: :rb_channel_1, http_sync: true)
|
313
350
|
|
314
351
|
envelope = envelopes.first
|
315
352
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
316
353
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
317
354
|
expect(envelope.result[:data][:message]['event']).to eq 'delete'
|
318
355
|
expect(envelope.result[:data][:message]['type']).to eq 'membership'
|
319
|
-
expect(envelope.result[:data][:message]['data']['
|
356
|
+
expect(envelope.result[:data][:message]['data']['uuid']['id']).to eq 'uuid_mg1'
|
320
357
|
end
|
321
358
|
end
|
322
359
|
|
@@ -329,15 +366,15 @@ describe Pubnub::Subscribe do
|
|
329
366
|
uuid: "ruby-test-uuid"
|
330
367
|
)
|
331
368
|
|
332
|
-
@pubnub.subscribe(channel: :
|
333
|
-
envelopes = @pubnub.subscribe(channel: :
|
369
|
+
@pubnub.subscribe(channel: :uuid_mg1, http_sync: true)
|
370
|
+
envelopes = @pubnub.subscribe(channel: :uuid_mg1, http_sync: true)
|
334
371
|
|
335
372
|
envelope = envelopes.first
|
336
373
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
337
374
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
338
375
|
expect(envelope.result[:data][:message]['event']).to eq 'delete'
|
339
376
|
expect(envelope.result[:data][:message]['type']).to eq 'membership'
|
340
|
-
expect(envelope.result[:data][:message]['data']['
|
377
|
+
expect(envelope.result[:data][:message]['data']['channel']['id']).to eq 'rb_channel_1'
|
341
378
|
end
|
342
379
|
|
343
380
|
end
|