pubnub 4.2.6 → 4.6.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 +113 -56
- data/.travis.yml +4 -2
- data/CHANGELOG.md +39 -11
- data/Gemfile.lock +10 -1
- 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/channel_members/001.yml +111 -0
- data/fixtures/vcr_cassettes/examples/channel_members/002.yml +111 -0
- data/fixtures/vcr_cassettes/examples/channel_members/003.yml +111 -0
- data/fixtures/vcr_cassettes/examples/channel_members/004.yml +147 -0
- data/fixtures/vcr_cassettes/examples/channel_members/005.yml +147 -0
- data/fixtures/vcr_cassettes/examples/channel_members/006.yml +147 -0
- data/fixtures/vcr_cassettes/examples/channel_metadata/001.yml +39 -0
- data/fixtures/vcr_cassettes/examples/channel_metadata/002.yml +39 -0
- data/fixtures/vcr_cassettes/examples/channel_metadata/003.yml +39 -0
- data/fixtures/vcr_cassettes/examples/channel_metadata/004.yml +73 -0
- data/fixtures/vcr_cassettes/examples/channel_metadata/005.yml +73 -0
- data/fixtures/vcr_cassettes/examples/channel_metadata/006.yml +73 -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/include_meta__encrypted.yml +7 -7
- data/fixtures/vcr_cassettes/examples/history/include_meta__encrypted_random_iv.yml +46 -0
- data/fixtures/vcr_cassettes/examples/history/include_token__encrypted.yml +6 -6
- data/fixtures/vcr_cassettes/examples/history/include_token__encrypted_random_iv.yml +46 -0
- data/fixtures/vcr_cassettes/examples/history/no_includes__encrypted.yml +6 -6
- data/fixtures/vcr_cassettes/examples/history/no_includes__encrypted_random_iv.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/memberships/001.yml +111 -0
- data/fixtures/vcr_cassettes/examples/memberships/002.yml +111 -0
- data/fixtures/vcr_cassettes/examples/memberships/003.yml +111 -0
- data/fixtures/vcr_cassettes/examples/memberships/004.yml +111 -0
- data/fixtures/vcr_cassettes/examples/memberships/005.yml +147 -0
- data/fixtures/vcr_cassettes/examples/memberships/006.yml +147 -0
- data/fixtures/vcr_cassettes/examples/memberships/007.yml +147 -0
- data/fixtures/vcr_cassettes/examples/memberships/008.yml +147 -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/examples/uuid_metadata/001.yml +39 -0
- data/fixtures/vcr_cassettes/examples/uuid_metadata/002.yml +39 -0
- data/fixtures/vcr_cassettes/examples/uuid_metadata/003.yml +39 -0
- data/fixtures/vcr_cassettes/examples/uuid_metadata/004.yml +39 -0
- data/fixtures/vcr_cassettes/examples/uuid_metadata/005.yml +73 -0
- data/fixtures/vcr_cassettes/examples/uuid_metadata/006.yml +73 -0
- data/fixtures/vcr_cassettes/examples/uuid_metadata/007.yml +73 -0
- data/fixtures/vcr_cassettes/examples/uuid_metadata/008.yml +73 -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 +22 -16
- data/lib/pubnub/client/events.rb +4 -2
- data/lib/pubnub/client/helpers.rb +1 -1
- data/lib/pubnub/configuration.rb +1 -0
- data/lib/pubnub/constants.rb +20 -18
- data/lib/pubnub/crypto.rb +22 -8
- data/lib/pubnub/event.rb +39 -17
- 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 +2 -1
- data/lib/pubnub/events/list_push_provisions.rb +29 -12
- data/lib/pubnub/events/publish.rb +2 -2
- data/lib/pubnub/events/remove_channel_members.rb +137 -0
- data/lib/pubnub/events/{delete_space.rb → remove_channel_metadata.rb} +13 -13
- 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} +13 -13
- 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/events/signal.rb +1 -1
- data/lib/pubnub/formatter.rb +31 -4
- data/lib/pubnub/pam.rb +2 -11
- data/lib/pubnub/subscribe_callback.rb +1 -3
- data/lib/pubnub/subscribe_event/formatter.rb +30 -19
- 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/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 +87 -9
- data/spec/examples/list_push_provisions_spec.rb +164 -0
- data/spec/examples/presence_examples_spec.rb +222 -186
- data/spec/examples/publish_examples_spec.rb +864 -0
- data/spec/examples/remove_channel_members_examples_spec.rb +100 -0
- data/spec/examples/remove_channel_metadata_examples_spec.rb +89 -0
- 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/remove_memberships_examples_spec.rb +121 -0
- data/spec/examples/remove_uuid_metadata_examples_spec.rb +107 -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/set_channel_members_examples_spec.rb +99 -0
- data/spec/examples/set_channel_metadata_examples_spec.rb +93 -0
- data/spec/examples/set_memberships_examples_spec.rb +122 -0
- data/spec/examples/set_uuid_metadata_examples_spec.rb +114 -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 +104 -65
- data/spec/lib/events/uuid_metadata_spec.rb +86 -0
- data/spec/lib/multiple_ciphers_spec.rb +16 -4
- 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 +153 -65
- 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
|
@@ -56,6 +69,7 @@ describe Pubnub::Subscribe do
|
|
56
69
|
publish_key: "demo",
|
57
70
|
uuid: "ruby-test-uuid",
|
58
71
|
cipher_key: "demo",
|
72
|
+
random_iv: false
|
59
73
|
)
|
60
74
|
|
61
75
|
@pubnub.add_listener(callback: @callbacks)
|
@@ -64,7 +78,10 @@ describe Pubnub::Subscribe do
|
|
64
78
|
@pubnub.subscribe(channel: :whatever)
|
65
79
|
|
66
80
|
eventually do
|
67
|
-
|
81
|
+
if @messages.length > 0
|
82
|
+
expect(@messages.first.result[:data][:message]).to eq("text" => "hey")
|
83
|
+
true
|
84
|
+
end
|
68
85
|
end
|
69
86
|
end
|
70
87
|
end
|
@@ -100,15 +117,18 @@ describe Pubnub::Subscribe do
|
|
100
117
|
sleep 0.1
|
101
118
|
|
102
119
|
eventually do
|
103
|
-
|
104
|
-
|
105
|
-
|
120
|
+
if @statuses.length > 0
|
121
|
+
envelope = @statuses.first
|
122
|
+
expect(envelope).to be_a_kind_of Pubnub::ErrorEnvelope
|
123
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
124
|
+
true
|
125
|
+
end
|
106
126
|
end
|
107
127
|
end
|
108
128
|
end
|
109
129
|
|
110
|
-
it "
|
111
|
-
VCR.use_cassette("lib/events/subscribe-
|
130
|
+
it "uuid metadata update works" do
|
131
|
+
VCR.use_cassette("lib/events/subscribe-uuid-metadata-set-async", record: :once) do
|
112
132
|
@pubnub = Pubnub::Client.new(
|
113
133
|
subscribe_key: "sub-a-mock-key",
|
114
134
|
publish_key: "pub-a-mock-key",
|
@@ -118,20 +138,24 @@ describe Pubnub::Subscribe do
|
|
118
138
|
|
119
139
|
@pubnub.add_listener(callback: @callbacks)
|
120
140
|
|
121
|
-
@pubnub.subscribe(channel: :
|
141
|
+
@pubnub.subscribe(channel: :uuid_mg3)
|
122
142
|
|
123
143
|
eventually do
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
144
|
+
if @uuid_metadata_events.length > 0
|
145
|
+
envelope = @uuid_metadata_events.first
|
146
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
147
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
148
|
+
expect(envelope.result[:data][:message]['event']).to eq 'set'
|
149
|
+
expect(envelope.result[:data][:message]['type']).to eq 'uuid'
|
150
|
+
expect(envelope.result[:data][:message]['data']['id']).to eq 'uuid_mg3'
|
151
|
+
true
|
152
|
+
end
|
129
153
|
end
|
130
154
|
end
|
131
155
|
end
|
132
156
|
|
133
|
-
it "
|
134
|
-
VCR.use_cassette("lib/events/subscribe-
|
157
|
+
it "channel metadata update works" do
|
158
|
+
VCR.use_cassette("lib/events/subscribe-channel-metadata-set-async", record: :once) do
|
135
159
|
@pubnub = Pubnub::Client.new(
|
136
160
|
subscribe_key: "sub-a-mock-key",
|
137
161
|
publish_key: "pub-a-mock-key",
|
@@ -141,20 +165,24 @@ describe Pubnub::Subscribe do
|
|
141
165
|
|
142
166
|
@pubnub.add_listener(callback: @callbacks)
|
143
167
|
|
144
|
-
@pubnub.subscribe(channel: :
|
168
|
+
@pubnub.subscribe(channel: :rb_channel_3)
|
145
169
|
|
146
170
|
eventually do
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
171
|
+
if @channel_metadata_events.length > 0
|
172
|
+
envelope = @channel_metadata_events.first
|
173
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
174
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
175
|
+
expect(envelope.result[:data][:message]['event']).to eq 'set'
|
176
|
+
expect(envelope.result[:data][:message]['type']).to eq 'channel'
|
177
|
+
# expect(envelope.result[:data][:message]['data']['id']).to eq 'rb_channel_3'
|
178
|
+
true
|
179
|
+
end
|
152
180
|
end
|
153
181
|
end
|
154
182
|
end
|
155
183
|
|
156
|
-
it "member
|
157
|
-
VCR.use_cassette("lib/events/subscribe-member-
|
184
|
+
it "member set works" do
|
185
|
+
VCR.use_cassette("lib/events/subscribe-member-set-async", record: :once) do
|
158
186
|
@pubnub = Pubnub::Client.new(
|
159
187
|
subscribe_key: "sub-a-mock-key",
|
160
188
|
publish_key: "pub-a-mock-key",
|
@@ -164,21 +192,24 @@ describe Pubnub::Subscribe do
|
|
164
192
|
|
165
193
|
@pubnub.add_listener(callback: @callbacks)
|
166
194
|
|
167
|
-
@pubnub.subscribe(channel: :
|
195
|
+
@pubnub.subscribe(channel: :rb_channel_3)
|
168
196
|
|
169
197
|
eventually do
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
198
|
+
if @membership_events.length > 0
|
199
|
+
envelope = @membership_events.first
|
200
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
201
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
202
|
+
expect(envelope.result[:data][:message]['event']).to eq 'set'
|
203
|
+
expect(envelope.result[:data][:message]['type']).to eq 'membership'
|
204
|
+
expect(envelope.result[:data][:message]['data']['uuid']['id']).to eq 'uuid_mg3'
|
205
|
+
true
|
206
|
+
end
|
176
207
|
end
|
177
208
|
end
|
178
209
|
end
|
179
210
|
|
180
|
-
it "membership
|
181
|
-
VCR.use_cassette("lib/events/subscribe-membership-
|
211
|
+
it "membership set works" do
|
212
|
+
VCR.use_cassette("lib/events/subscribe-membership-set-async", record: :once) do
|
182
213
|
@pubnub = Pubnub::Client.new(
|
183
214
|
subscribe_key: "sub-a-mock-key",
|
184
215
|
publish_key: "pub-a-mock-key",
|
@@ -188,15 +219,18 @@ describe Pubnub::Subscribe do
|
|
188
219
|
|
189
220
|
@pubnub.add_listener(callback: @callbacks)
|
190
221
|
|
191
|
-
@pubnub.subscribe(channel: :
|
222
|
+
@pubnub.subscribe(channel: :uuid_mg5)
|
192
223
|
|
193
224
|
eventually do
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
225
|
+
if @membership_events.length > 0
|
226
|
+
envelope = @membership_events.first
|
227
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
228
|
+
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
229
|
+
expect(envelope.result[:data][:message]['event']).to eq 'set'
|
230
|
+
expect(envelope.result[:data][:message]['type']).to eq 'membership'
|
231
|
+
expect(envelope.result[:data][:message]['data']['channel']['id']).to eq 'rb_channel_5'
|
232
|
+
true
|
233
|
+
end
|
200
234
|
end
|
201
235
|
end
|
202
236
|
end
|
@@ -211,13 +245,17 @@ describe Pubnub::Subscribe do
|
|
211
245
|
publish_key: "demo",
|
212
246
|
uuid: "ruby-test-uuid",
|
213
247
|
cipher_key: "demo",
|
248
|
+
random_iv: false
|
214
249
|
)
|
215
250
|
|
216
251
|
VCR.use_cassette("lib/events/subscribe-cipher-async", record: :once) do
|
217
252
|
@pubnub.subscribe(channel: :whatever, http_sync: true)
|
218
253
|
@messages = @pubnub.subscribe(channel: :whatever, http_sync: true)
|
219
254
|
eventually do
|
220
|
-
|
255
|
+
if @messages.length > 0
|
256
|
+
expect(@messages.first.result[:data][:message]).to eq("text" => "hey")
|
257
|
+
true
|
258
|
+
end
|
221
259
|
end
|
222
260
|
end
|
223
261
|
end
|
@@ -258,8 +296,8 @@ describe Pubnub::Subscribe do
|
|
258
296
|
end
|
259
297
|
end
|
260
298
|
|
261
|
-
it "
|
262
|
-
VCR.use_cassette("lib/events/subscribe-
|
299
|
+
it "uuid metadata remove works" do
|
300
|
+
VCR.use_cassette("lib/events/subscribe-uuid-metadata-remove-sync", record: :once) do
|
263
301
|
@pubnub = Pubnub::Client.new(
|
264
302
|
subscribe_key: "sub-a-mock-key",
|
265
303
|
publish_key: "pub-a-mock-key",
|
@@ -267,19 +305,20 @@ describe Pubnub::Subscribe do
|
|
267
305
|
uuid: "ruby-test-uuid"
|
268
306
|
)
|
269
307
|
|
270
|
-
@pubnub.subscribe(channel: :
|
271
|
-
envelopes = @pubnub.subscribe(channel: :
|
308
|
+
@pubnub.subscribe(channel: :uuid_mg3, http_sync: true)
|
309
|
+
envelopes = @pubnub.subscribe(channel: :uuid_mg3, http_sync: true)
|
272
310
|
|
273
311
|
envelope = envelopes.first
|
274
312
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
275
313
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
276
314
|
expect(envelope.result[:data][:message]['event']).to eq 'delete'
|
277
|
-
expect(envelope.result[:data][:message]['type']).to eq '
|
315
|
+
expect(envelope.result[:data][:message]['type']).to eq 'uuid'
|
316
|
+
expect(envelope.result[:data][:message]['data']['id']).to eq 'uuid_mg3'
|
278
317
|
end
|
279
318
|
end
|
280
319
|
|
281
|
-
it "
|
282
|
-
VCR.use_cassette("lib/events/subscribe-
|
320
|
+
it "channel metadata remove works" do
|
321
|
+
VCR.use_cassette("lib/events/subscribe-channel-metadata-remove-sync", record: :once) do
|
283
322
|
@pubnub = Pubnub::Client.new(
|
284
323
|
subscribe_key: "sub-a-mock-key",
|
285
324
|
publish_key: "pub-a-mock-key",
|
@@ -287,20 +326,20 @@ describe Pubnub::Subscribe do
|
|
287
326
|
uuid: "ruby-test-uuid"
|
288
327
|
)
|
289
328
|
|
290
|
-
@pubnub.subscribe(channel: :
|
291
|
-
envelopes = @pubnub.subscribe(channel: :
|
329
|
+
@pubnub.subscribe(channel: :rb_channel_1, http_sync: true)
|
330
|
+
envelopes = @pubnub.subscribe(channel: :rb_channel_1, http_sync: true)
|
292
331
|
|
293
332
|
envelope = envelopes.first
|
294
333
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
295
334
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
296
335
|
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 '
|
336
|
+
expect(envelope.result[:data][:message]['type']).to eq 'channel'
|
337
|
+
expect(envelope.result[:data][:message]['data']['id']).to eq 'rb_channel_1'
|
299
338
|
end
|
300
339
|
end
|
301
340
|
|
302
341
|
it "member remove works" do
|
303
|
-
VCR.use_cassette("lib/events/subscribe-member-remove-
|
342
|
+
VCR.use_cassette("lib/events/subscribe-member-remove-sync", record: :once) do
|
304
343
|
@pubnub = Pubnub::Client.new(
|
305
344
|
subscribe_key: "sub-a-mock-key",
|
306
345
|
publish_key: "pub-a-mock-key",
|
@@ -308,15 +347,15 @@ describe Pubnub::Subscribe do
|
|
308
347
|
uuid: "ruby-test-uuid"
|
309
348
|
)
|
310
349
|
|
311
|
-
@pubnub.subscribe(channel: :
|
312
|
-
envelopes = @pubnub.subscribe(channel: :
|
350
|
+
@pubnub.subscribe(channel: :rb_channel_1, http_sync: true)
|
351
|
+
envelopes = @pubnub.subscribe(channel: :rb_channel_1, http_sync: true)
|
313
352
|
|
314
353
|
envelope = envelopes.first
|
315
354
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
316
355
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
317
356
|
expect(envelope.result[:data][:message]['event']).to eq 'delete'
|
318
357
|
expect(envelope.result[:data][:message]['type']).to eq 'membership'
|
319
|
-
expect(envelope.result[:data][:message]['data']['
|
358
|
+
expect(envelope.result[:data][:message]['data']['uuid']['id']).to eq 'uuid_mg1'
|
320
359
|
end
|
321
360
|
end
|
322
361
|
|
@@ -329,15 +368,15 @@ describe Pubnub::Subscribe do
|
|
329
368
|
uuid: "ruby-test-uuid"
|
330
369
|
)
|
331
370
|
|
332
|
-
@pubnub.subscribe(channel: :
|
333
|
-
envelopes = @pubnub.subscribe(channel: :
|
371
|
+
@pubnub.subscribe(channel: :uuid_mg1, http_sync: true)
|
372
|
+
envelopes = @pubnub.subscribe(channel: :uuid_mg1, http_sync: true)
|
334
373
|
|
335
374
|
envelope = envelopes.first
|
336
375
|
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
337
376
|
expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
|
338
377
|
expect(envelope.result[:data][:message]['event']).to eq 'delete'
|
339
378
|
expect(envelope.result[:data][:message]['type']).to eq 'membership'
|
340
|
-
expect(envelope.result[:data][:message]['data']['
|
379
|
+
expect(envelope.result[:data][:message]['data']['channel']['id']).to eq 'rb_channel_1'
|
341
380
|
end
|
342
381
|
|
343
382
|
end
|