pubnub 4.5.0 → 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/.pubnub.yml +53 -37
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- 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/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/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/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/lib/pubnub/client.rb +4 -1
- data/lib/pubnub/client/helpers.rb +1 -1
- data/lib/pubnub/configuration.rb +1 -0
- data/lib/pubnub/constants.rb +1 -0
- data/lib/pubnub/crypto.rb +22 -8
- data/lib/pubnub/event.rb +7 -1
- data/lib/pubnub/events/history.rb +2 -1
- data/lib/pubnub/events/publish.rb +2 -2
- data/lib/pubnub/events/remove_channel_members.rb +1 -1
- data/lib/pubnub/events/remove_channel_metadata.rb +1 -1
- data/lib/pubnub/events/remove_memberships.rb +1 -1
- data/lib/pubnub/events/remove_uuid_metadata.rb +1 -1
- data/lib/pubnub/events/set_channel_members.rb +1 -1
- data/lib/pubnub/events/set_channel_metadata.rb +1 -1
- data/lib/pubnub/events/set_memberships.rb +1 -1
- data/lib/pubnub/events/set_uuid_metadata.rb +1 -1
- data/lib/pubnub/events/signal.rb +1 -1
- data/lib/pubnub/formatter.rb +3 -3
- data/lib/pubnub/subscribe_event/formatter.rb +4 -2
- data/lib/pubnub/version.rb +1 -1
- data/spec/examples/history_examples_spec.rb +87 -9
- 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_memberships_examples_spec.rb +121 -0
- data/spec/examples/remove_uuid_metadata_examples_spec.rb +107 -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/subscribe_examples_1_spec.rb +2 -2
- data/spec/examples/subscribe_examples_2_spec.rb +4 -4
- data/spec/lib/events/subscribe_spec.rb +2 -0
- data/spec/lib/multiple_ciphers_spec.rb +16 -4
- data/spec/spec_helper.rb +1 -1
- metadata +50 -3
@@ -0,0 +1,93 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Pubnub::HereNow do
|
4
|
+
around :each do |example|
|
5
|
+
@fired = false
|
6
|
+
|
7
|
+
@callback = -> (_envelope) do
|
8
|
+
@fired = true
|
9
|
+
end
|
10
|
+
|
11
|
+
@pubnub = Pubnub.new(
|
12
|
+
publish_key: "pub-a-mock-key",
|
13
|
+
subscribe_key: 'sub-a-mock-key',
|
14
|
+
uuid: "ruby-test-uuid-client-one",
|
15
|
+
auth_key: "ruby-test-auth-client-one",
|
16
|
+
random_iv: false
|
17
|
+
)
|
18
|
+
|
19
|
+
example.run_with_retry retry: 10
|
20
|
+
end
|
21
|
+
|
22
|
+
it "__channel__channel___metadata__name_some_name___include__custom___http_sync__true___cipher_key__nil___random_iv__false___callback__lambda_" do
|
23
|
+
VCR.use_cassette("examples/channel_metadata/001", record: :once) do
|
24
|
+
envelope = @pubnub.set_channel_metadata(
|
25
|
+
channel: 'channel',
|
26
|
+
metadata: { name: 'some_name' },
|
27
|
+
include: { custom: true },
|
28
|
+
http_sync: true,
|
29
|
+
callback: @callback
|
30
|
+
)
|
31
|
+
|
32
|
+
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
|
33
|
+
expect(envelope.error?).to eq false
|
34
|
+
expect(@fired).to eq true
|
35
|
+
expect(@pubnub.env[:random_iv]).to eq false
|
36
|
+
|
37
|
+
expect(envelope.status[:code]).to eq(200)
|
38
|
+
expect(envelope.status[:operation]).to eq(:set_channel_metadata)
|
39
|
+
expect(envelope.status[:category]).to eq(:ack)
|
40
|
+
expect(envelope.status[:client_request].path.split('/').last).to eq("channel")
|
41
|
+
expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", auth_key: "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it "__channel__channel___metadata__name_some_name___include__nil___http_sync__true___cipher_key__enigma___random_iv__false___callback__nil_" do
|
46
|
+
VCR.use_cassette("examples/channel_metadata/002", record: :once) do
|
47
|
+
pubnub = Pubnub.new(
|
48
|
+
publish_key: "pub-a-mock-key",
|
49
|
+
subscribe_key: 'sub-a-mock-key',
|
50
|
+
uuid: "ruby-test-uuid-client-one",
|
51
|
+
auth_key: "ruby-test-auth-client-one",
|
52
|
+
random_iv: false,
|
53
|
+
cipher_key: "enigma"
|
54
|
+
)
|
55
|
+
|
56
|
+
envelope = pubnub.set_channel_metadata(channel: 'channel', metadata: { name: 'some_name' }, http_sync: true)
|
57
|
+
|
58
|
+
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
|
59
|
+
expect(envelope.error?).to eq false
|
60
|
+
expect(pubnub.env[:random_iv]).to eq false
|
61
|
+
|
62
|
+
expect(envelope.status[:code]).to eq(200)
|
63
|
+
expect(envelope.status[:operation]).to eq(:set_channel_metadata)
|
64
|
+
expect(envelope.status[:category]).to eq(:ack)
|
65
|
+
expect(envelope.status[:client_request].path.split('/').last).to eq("channel")
|
66
|
+
expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", auth_key: "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
it "__channel__channel___metadata__name_some_name___include__nil___http_sync__true___cipher_key__enigma___random_iv__true___callback__nil_" do
|
71
|
+
VCR.use_cassette("examples/channel_metadata/003", record: :once) do
|
72
|
+
pubnub = Pubnub.new(
|
73
|
+
publish_key: "pub-a-mock-key",
|
74
|
+
subscribe_key: 'sub-a-mock-key',
|
75
|
+
uuid: "ruby-test-uuid-client-one",
|
76
|
+
auth_key: "ruby-test-auth-client-one",
|
77
|
+
cipher_key: "enigma"
|
78
|
+
)
|
79
|
+
|
80
|
+
envelope = pubnub.set_channel_metadata(channel: 'channel', metadata: { name: 'some_name' }, http_sync: true)
|
81
|
+
|
82
|
+
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
|
83
|
+
expect(envelope.error?).to eq false
|
84
|
+
expect(pubnub.env[:random_iv]).to eq true
|
85
|
+
|
86
|
+
expect(envelope.status[:code]).to eq(200)
|
87
|
+
expect(envelope.status[:operation]).to eq(:set_channel_metadata)
|
88
|
+
expect(envelope.status[:category]).to eq(:ack)
|
89
|
+
expect(envelope.status[:client_request].path.split('/').last).to eq("channel")
|
90
|
+
expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", auth_key: "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Pubnub::HereNow do
|
4
|
+
around :each do |example|
|
5
|
+
@fired = false
|
6
|
+
|
7
|
+
@callback = -> (_envelope) do
|
8
|
+
@fired = true
|
9
|
+
end
|
10
|
+
|
11
|
+
@pubnub = Pubnub.new(
|
12
|
+
publish_key: "pub-a-mock-key",
|
13
|
+
subscribe_key: 'sub-a-mock-key',
|
14
|
+
uuid: "ruby-test-uuid-client-one",
|
15
|
+
auth_key: "ruby-test-auth-client-one",
|
16
|
+
random_iv: false
|
17
|
+
)
|
18
|
+
|
19
|
+
example.run_with_retry retry: 10
|
20
|
+
end
|
21
|
+
|
22
|
+
it "__uuid__nil___channels__channel___include__count___http_sync__true___cipher_key__nil___random_iv__false___callback__lambda_" do
|
23
|
+
VCR.use_cassette("examples/memberships/001", record: :once) do
|
24
|
+
@pubnub.set_channel_metadata(channel: 'channel', metadata: { name: 'some_name' }, http_sync: true)
|
25
|
+
@pubnub.set_uuid_metadata(uuid: nil, metadata: { name: 'magnum' }, http_sync: true)
|
26
|
+
envelope = @pubnub.set_memberships(
|
27
|
+
uuid: nil,
|
28
|
+
channels: [{ channel: 'channel' }],
|
29
|
+
include: { count: true },
|
30
|
+
http_sync: true,
|
31
|
+
callback: @callback
|
32
|
+
)
|
33
|
+
|
34
|
+
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
|
35
|
+
expect(envelope.error?).to eq false
|
36
|
+
expect(@fired).to eq true
|
37
|
+
expect(@pubnub.env[:random_iv]).to eq false
|
38
|
+
|
39
|
+
expect(envelope.status[:code]).to eq(200)
|
40
|
+
expect(envelope.status[:operation]).to eq(:set_memberships)
|
41
|
+
expect(envelope.status[:category]).to eq(:ack)
|
42
|
+
expect(envelope.status[:client_request].path.split('/')[-2]).to eq("ruby-test-uuid-client-one")
|
43
|
+
expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", auth_key: "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it "__uuid__bob___channels__channel___include__count___http_sync__true___cipher_key__nil___random_iv__false___callback__nil_" do
|
48
|
+
VCR.use_cassette("examples/memberships/002", record: :once) do
|
49
|
+
@pubnub.set_channel_metadata(channel: 'channel', metadata: { name: 'some_name' }, http_sync: true)
|
50
|
+
@pubnub.set_uuid_metadata(uuid: 'bob', metadata: { name: 'magnum' }, http_sync: true)
|
51
|
+
envelope = @pubnub.set_memberships(
|
52
|
+
uuid: 'bob',
|
53
|
+
channels: [{ channel: 'channel' }],
|
54
|
+
include: { count: true },
|
55
|
+
http_sync: true
|
56
|
+
)
|
57
|
+
|
58
|
+
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
|
59
|
+
expect(envelope.error?).to eq false
|
60
|
+
expect(@pubnub.env[:random_iv]).to eq false
|
61
|
+
|
62
|
+
expect(envelope.status[:code]).to eq(200)
|
63
|
+
expect(envelope.status[:operation]).to eq(:set_memberships)
|
64
|
+
expect(envelope.status[:category]).to eq(:ack)
|
65
|
+
expect(envelope.status[:client_request].path.split('/')[-2]).to eq("bob")
|
66
|
+
expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", auth_key: "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
it "__uuid__bob___channels__channel___include__nil___http_sync__true___cipher_key__enigma___random_iv__false___callback__nil_" do
|
71
|
+
VCR.use_cassette("examples/memberships/003", record: :once) do
|
72
|
+
@pubnub.set_channel_metadata(channel: 'channel', metadata: { name: 'some_name' }, http_sync: true)
|
73
|
+
@pubnub.set_uuid_metadata(uuid: 'bob', metadata: { name: 'magnum' }, http_sync: true)
|
74
|
+
pubnub = Pubnub.new(
|
75
|
+
publish_key: "pub-a-mock-key",
|
76
|
+
subscribe_key: 'sub-a-mock-key',
|
77
|
+
uuid: "ruby-test-uuid-client-one",
|
78
|
+
auth_key: "ruby-test-auth-client-one",
|
79
|
+
random_iv: false,
|
80
|
+
cipher_key: "enigma"
|
81
|
+
)
|
82
|
+
|
83
|
+
envelope = pubnub.set_memberships(uuid: 'bob', channels: [{ channel: 'channel' }], http_sync: true)
|
84
|
+
|
85
|
+
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
|
86
|
+
expect(envelope.error?).to eq false
|
87
|
+
expect(pubnub.env[:random_iv]).to eq false
|
88
|
+
|
89
|
+
expect(envelope.status[:code]).to eq(200)
|
90
|
+
expect(envelope.status[:operation]).to eq(:set_memberships)
|
91
|
+
expect(envelope.status[:category]).to eq(:ack)
|
92
|
+
expect(envelope.status[:client_request].path.split('/')[-2]).to eq("bob")
|
93
|
+
expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", auth_key: "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
it "__uuid__bob___channels__channel___include__nil___http_sync__true___cipher_key__enigma___random_iv__true___callback__nil_" do
|
98
|
+
VCR.use_cassette("examples/memberships/004", record: :once) do
|
99
|
+
@pubnub.set_channel_metadata(channel: 'channel', metadata: { name: 'some_name' }, http_sync: true)
|
100
|
+
@pubnub.set_uuid_metadata(uuid: 'bob', metadata: { name: 'magnum' }, http_sync: true)
|
101
|
+
pubnub = Pubnub.new(
|
102
|
+
publish_key: "pub-a-mock-key",
|
103
|
+
subscribe_key: 'sub-a-mock-key',
|
104
|
+
uuid: "ruby-test-uuid-client-one",
|
105
|
+
auth_key: "ruby-test-auth-client-one",
|
106
|
+
cipher_key: "enigma"
|
107
|
+
)
|
108
|
+
|
109
|
+
envelope = pubnub.set_memberships(uuid: 'bob', channels: [{ channel: 'channel' }], http_sync: true)
|
110
|
+
|
111
|
+
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
|
112
|
+
expect(envelope.error?).to eq false
|
113
|
+
expect(pubnub.env[:random_iv]).to eq true
|
114
|
+
|
115
|
+
expect(envelope.status[:code]).to eq(200)
|
116
|
+
expect(envelope.status[:operation]).to eq(:set_memberships)
|
117
|
+
expect(envelope.status[:category]).to eq(:ack)
|
118
|
+
expect(envelope.status[:client_request].path.split('/')[-2]).to eq("bob")
|
119
|
+
expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", auth_key: "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Pubnub::HereNow do
|
4
|
+
around :each do |example|
|
5
|
+
@fired = false
|
6
|
+
|
7
|
+
@callback = -> (_envelope) do
|
8
|
+
@fired = true
|
9
|
+
end
|
10
|
+
|
11
|
+
@pubnub = Pubnub.new(
|
12
|
+
publish_key: "pub-a-mock-key",
|
13
|
+
subscribe_key: 'sub-a-mock-key',
|
14
|
+
uuid: "ruby-test-uuid-client-one",
|
15
|
+
auth_key: "ruby-test-auth-client-one",
|
16
|
+
random_iv: false
|
17
|
+
)
|
18
|
+
|
19
|
+
example.run_with_retry retry: 10
|
20
|
+
end
|
21
|
+
|
22
|
+
it "__uuid__nil___metadata__name_magnum___include__custom___http_sync__true___cipher_key__nil___random_iv__false___callback__lambda_" do
|
23
|
+
VCR.use_cassette("examples/uuid_metadata/001", record: :once) do
|
24
|
+
envelope = @pubnub.set_uuid_metadata(
|
25
|
+
uuid: nil,
|
26
|
+
metadata: { name: 'magnum' },
|
27
|
+
include: { custom: true },
|
28
|
+
http_sync: true,
|
29
|
+
callback: @callback
|
30
|
+
)
|
31
|
+
|
32
|
+
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
|
33
|
+
expect(envelope.error?).to eq false
|
34
|
+
expect(@fired).to eq true
|
35
|
+
expect(@pubnub.env[:random_iv]).to eq false
|
36
|
+
|
37
|
+
expect(envelope.status[:code]).to eq(200)
|
38
|
+
expect(envelope.status[:operation]).to eq(:set_uuid_metadata)
|
39
|
+
expect(envelope.status[:category]).to eq(:ack)
|
40
|
+
expect(envelope.status[:client_request].path.split('/').last).to eq("ruby-test-uuid-client-one")
|
41
|
+
expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", auth_key: "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it "__uuid__bob___metadata__name_magnum___include__custom___http_sync__true___cipher_key__nil___random_iv__false___callback__nil_" do
|
46
|
+
VCR.use_cassette("examples/uuid_metadata/002", record: :once) do
|
47
|
+
envelope = @pubnub.set_uuid_metadata(
|
48
|
+
uuid: 'bob',
|
49
|
+
metadata: { name: 'magnum' },
|
50
|
+
include: { custom: true },
|
51
|
+
http_sync: true
|
52
|
+
)
|
53
|
+
|
54
|
+
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
|
55
|
+
expect(envelope.error?).to eq false
|
56
|
+
expect(@pubnub.env[:random_iv]).to eq false
|
57
|
+
|
58
|
+
expect(envelope.status[:code]).to eq(200)
|
59
|
+
expect(envelope.status[:operation]).to eq(:set_uuid_metadata)
|
60
|
+
expect(envelope.status[:category]).to eq(:ack)
|
61
|
+
expect(envelope.status[:client_request].path.split('/').last).to eq("bob")
|
62
|
+
expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", auth_key: "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it "__uuid__bob___metadata__name_magnum___include__nil___http_sync__true___cipher_key__enigma___random_iv__false___callback__nil_" do
|
67
|
+
VCR.use_cassette("examples/uuid_metadata/003", record: :once) do
|
68
|
+
pubnub = Pubnub.new(
|
69
|
+
publish_key: "pub-a-mock-key",
|
70
|
+
subscribe_key: 'sub-a-mock-key',
|
71
|
+
uuid: "ruby-test-uuid-client-one",
|
72
|
+
auth_key: "ruby-test-auth-client-one",
|
73
|
+
random_iv: false,
|
74
|
+
cipher_key: "enigma"
|
75
|
+
)
|
76
|
+
|
77
|
+
envelope = pubnub.set_uuid_metadata(uuid: 'bob', metadata: { name: 'magnum' }, http_sync: true)
|
78
|
+
|
79
|
+
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
|
80
|
+
expect(envelope.error?).to eq false
|
81
|
+
expect(pubnub.env[:random_iv]).to eq false
|
82
|
+
|
83
|
+
expect(envelope.status[:code]).to eq(200)
|
84
|
+
expect(envelope.status[:operation]).to eq(:set_uuid_metadata)
|
85
|
+
expect(envelope.status[:category]).to eq(:ack)
|
86
|
+
expect(envelope.status[:client_request].path.split('/').last).to eq("bob")
|
87
|
+
expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", auth_key: "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
it "__uuid__bob___metadata__name_magnum___include__nil___http_sync__true___cipher_key__enigma___random_iv__true___callback__nil_" do
|
92
|
+
VCR.use_cassette("examples/uuid_metadata/004", record: :once) do
|
93
|
+
pubnub = Pubnub.new(
|
94
|
+
publish_key: "pub-a-mock-key",
|
95
|
+
subscribe_key: 'sub-a-mock-key',
|
96
|
+
uuid: "ruby-test-uuid-client-one",
|
97
|
+
auth_key: "ruby-test-auth-client-one",
|
98
|
+
cipher_key: "enigma"
|
99
|
+
)
|
100
|
+
|
101
|
+
envelope = pubnub.set_uuid_metadata(uuid: 'bob', metadata: { name: 'magnum' }, http_sync: true)
|
102
|
+
|
103
|
+
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
|
104
|
+
expect(envelope.error?).to eq false
|
105
|
+
expect(pubnub.env[:random_iv]).to eq true
|
106
|
+
|
107
|
+
expect(envelope.status[:code]).to eq(200)
|
108
|
+
expect(envelope.status[:operation]).to eq(:set_uuid_metadata)
|
109
|
+
expect(envelope.status[:category]).to eq(:ack)
|
110
|
+
expect(envelope.status[:client_request].path.split('/').last).to eq("bob")
|
111
|
+
expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", auth_key: "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -14,7 +14,7 @@ describe Pubnub::Subscribe do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
let(:pubnub_cipher_params) do
|
17
|
-
pubnub_params.merge({cipher_key: "super-secret-cipher-key"})
|
17
|
+
pubnub_params.merge({cipher_key: "super-secret-cipher-key", random_iv: false})
|
18
18
|
end
|
19
19
|
|
20
20
|
let(:pubnub) { Pubnub.new(**pubnub_params) }
|
@@ -17458,7 +17458,7 @@ describe Pubnub::Subscribe do
|
|
17458
17458
|
expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
|
17459
17459
|
expect(@status_envelopes[0].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
17460
17460
|
true
|
17461
|
-
end
|
17461
|
+
end
|
17462
17462
|
end
|
17463
17463
|
end
|
17464
17464
|
|
@@ -14,7 +14,7 @@ describe Pubnub::Subscribe do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
let(:pubnub_cipher_params) do
|
17
|
-
pubnub_params.merge({cipher_key: "super-secret-cipher-key"})
|
17
|
+
pubnub_params.merge({cipher_key: "super-secret-cipher-key", random_iv: false})
|
18
18
|
end
|
19
19
|
|
20
20
|
let(:pubnub) { Pubnub.new(**pubnub_params) }
|
@@ -853,7 +853,7 @@ describe Pubnub::Subscribe do
|
|
853
853
|
expect(envelopes[0].result[:data]).to eq({:message => "ruby is awesome", :subscribed_channel => "demo", :actual_channel => "demo", :publish_time_object => {:timetoken => "14654009949699093", :region_code => 12}, :message_meta_data => nil, :presence_event => nil, :presence => nil})
|
854
854
|
end
|
855
855
|
end
|
856
|
-
|
856
|
+
|
857
857
|
it "__channel___demo____presence__nil___channel_group__nil___http_sync__true___callback___block_cipherkeysuper-secret-cipher-key" do
|
858
858
|
|
859
859
|
VCR.use_cassette("examples/subscribe/265", record: :none) do
|
@@ -933,7 +933,7 @@ describe Pubnub::Subscribe do
|
|
933
933
|
expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
|
934
934
|
expect(@status_envelopes[0].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
935
935
|
true
|
936
|
-
end
|
936
|
+
end
|
937
937
|
end
|
938
938
|
end
|
939
939
|
|
@@ -16177,7 +16177,7 @@ describe Pubnub::Subscribe do
|
|
16177
16177
|
expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
|
16178
16178
|
expect(@status_envelopes[0].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
|
16179
16179
|
true
|
16180
|
-
end
|
16180
|
+
end
|
16181
16181
|
end
|
16182
16182
|
end
|
16183
16183
|
|
@@ -69,6 +69,7 @@ describe Pubnub::Subscribe do
|
|
69
69
|
publish_key: "demo",
|
70
70
|
uuid: "ruby-test-uuid",
|
71
71
|
cipher_key: "demo",
|
72
|
+
random_iv: false
|
72
73
|
)
|
73
74
|
|
74
75
|
@pubnub.add_listener(callback: @callbacks)
|
@@ -244,6 +245,7 @@ describe Pubnub::Subscribe do
|
|
244
245
|
publish_key: "demo",
|
245
246
|
uuid: "ruby-test-uuid",
|
246
247
|
cipher_key: "demo",
|
248
|
+
random_iv: false
|
247
249
|
)
|
248
250
|
|
249
251
|
VCR.use_cassette("lib/events/subscribe-cipher-async", record: :once) do
|
@@ -6,7 +6,7 @@ describe "Using multiple cipher keys" do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it "works with publish" do
|
9
|
-
@pubnub = Pubnub.new(subscribe_key: :demo, publish_key: :demo, cipher_key: "this_doesnt_fit_anywhere")
|
9
|
+
@pubnub = Pubnub.new(subscribe_key: :demo, publish_key: :demo, cipher_key: "this_doesnt_fit_anywhere", random_iv: false)
|
10
10
|
|
11
11
|
VCR.use_cassette("lib/multiple_ciphers", record: :once) do
|
12
12
|
# Fetch current timestamp
|
@@ -16,12 +16,14 @@ describe "Using multiple cipher keys" do
|
|
16
16
|
channel: :multiple_cipher_test,
|
17
17
|
message: "Some test message",
|
18
18
|
cipher_key: "super_secret",
|
19
|
+
random_iv: false,
|
19
20
|
http_sync: true,
|
20
21
|
)
|
21
22
|
|
22
23
|
e0 = @pubnub.subscribe(
|
23
24
|
channel: :multiple_cipher_test,
|
24
25
|
cipher_key: "super_secret",
|
26
|
+
random_iv: false,
|
25
27
|
http_sync: true,
|
26
28
|
).first
|
27
29
|
|
@@ -29,12 +31,14 @@ describe "Using multiple cipher keys" do
|
|
29
31
|
channel: :multiple_cipher_test,
|
30
32
|
message: "Another test message",
|
31
33
|
cipher_key: "another_secret",
|
34
|
+
random_iv: false,
|
32
35
|
http_sync: true,
|
33
36
|
)
|
34
37
|
|
35
38
|
e1 = @pubnub.subscribe(
|
36
39
|
channel: :multiple_cipher_test,
|
37
40
|
cipher_key: "another_secret",
|
41
|
+
random_iv: false,
|
38
42
|
http_sync: true,
|
39
43
|
).first
|
40
44
|
|
@@ -44,19 +48,21 @@ describe "Using multiple cipher keys" do
|
|
44
48
|
end
|
45
49
|
|
46
50
|
it "works with history" do
|
47
|
-
@pubnub = Pubnub.new(subscribe_key: :demo, publish_key: :demo, cipher_key: "this_doesnt_fit_anywhere")
|
51
|
+
@pubnub = Pubnub.new(subscribe_key: :demo, publish_key: :demo, cipher_key: "this_doesnt_fit_anywhere", random_iv: false)
|
48
52
|
|
49
53
|
VCR.use_cassette("lib/multiple_ciphers_history", record: :once) do
|
50
54
|
@pubnub.publish(
|
51
55
|
channel: :multiple_cipher_test,
|
52
56
|
message: "Some test message",
|
53
57
|
cipher_key: "super_secret",
|
58
|
+
random_iv: false,
|
54
59
|
http_sync: true,
|
55
60
|
)
|
56
61
|
|
57
62
|
e0 = @pubnub.history(
|
58
63
|
channel: :multiple_cipher_test,
|
59
64
|
cipher_key: "super_secret",
|
65
|
+
random_iv: false,
|
60
66
|
count: 1,
|
61
67
|
http_sync: true,
|
62
68
|
)
|
@@ -65,12 +71,14 @@ describe "Using multiple cipher keys" do
|
|
65
71
|
channel: :multiple_cipher_test,
|
66
72
|
message: "Another test message",
|
67
73
|
cipher_key: "another_secret",
|
74
|
+
random_iv: false,
|
68
75
|
http_sync: true,
|
69
76
|
)
|
70
77
|
|
71
78
|
e1 = @pubnub.history(
|
72
79
|
channel: :multiple_cipher_test,
|
73
80
|
cipher_key: "another_secret",
|
81
|
+
random_iv: false,
|
74
82
|
count: 1,
|
75
83
|
http_sync: true,
|
76
84
|
)
|
@@ -81,19 +89,21 @@ describe "Using multiple cipher keys" do
|
|
81
89
|
end
|
82
90
|
|
83
91
|
it "works with async history" do
|
84
|
-
@pubnub = Pubnub.new(subscribe_key: :demo, publish_key: :demo, cipher_key: "this_doesnt_fit_anywhere")
|
92
|
+
@pubnub = Pubnub.new(subscribe_key: :demo, publish_key: :demo, cipher_key: "this_doesnt_fit_anywhere", random_iv: false)
|
85
93
|
|
86
94
|
VCR.use_cassette("lib/multiple_ciphers_history", record: :once) do
|
87
95
|
@pubnub.publish(
|
88
96
|
channel: :multiple_cipher_test,
|
89
97
|
message: "Some test message",
|
90
98
|
cipher_key: "super_secret",
|
99
|
+
random_iv: false,
|
91
100
|
http_sync: true,
|
92
101
|
)
|
93
102
|
|
94
103
|
e0 = @pubnub.history(
|
95
104
|
channel: :multiple_cipher_test,
|
96
105
|
cipher_key: "super_secret",
|
106
|
+
random_iv: false,
|
97
107
|
count: 1,
|
98
108
|
).value
|
99
109
|
|
@@ -101,12 +111,14 @@ describe "Using multiple cipher keys" do
|
|
101
111
|
channel: :multiple_cipher_test,
|
102
112
|
message: "Another test message",
|
103
113
|
cipher_key: "another_secret",
|
114
|
+
random_iv: false,
|
104
115
|
http_sync: true,
|
105
116
|
)
|
106
117
|
|
107
118
|
e1 = @pubnub.history(
|
108
119
|
channel: :multiple_cipher_test,
|
109
120
|
cipher_key: "another_secret",
|
121
|
+
random_iv: false,
|
110
122
|
count: 1,
|
111
123
|
).value
|
112
124
|
|
@@ -129,7 +141,7 @@ describe "Using multiple cipher keys" do
|
|
129
141
|
ciphers[data[:issuing_client_id]]
|
130
142
|
end
|
131
143
|
|
132
|
-
@pubnub = Pubnub.new(subscribe_key: :demo, publish_key: :demo, cipher_key_selector: lambda_cipher_key)
|
144
|
+
@pubnub = Pubnub.new(subscribe_key: :demo, publish_key: :demo, cipher_key_selector: lambda_cipher_key, random_iv: false)
|
133
145
|
@pubnub.add_listener(callback: cb)
|
134
146
|
|
135
147
|
VCR.use_cassette("lib/callable_cipher_key", record: :once) do
|