pubnub 4.0.27 → 4.0.28

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pubnub might be problematic. Click here for more details.

Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.pubnub.yml +8 -1
  3. data/.rubocop.yml +9 -3
  4. data/.travis.yml +6 -19
  5. data/CHANGELOG.md +86 -82
  6. data/Gemfile +7 -5
  7. data/Gemfile.lock +155 -157
  8. data/README.md +34 -34
  9. data/VERSION +1 -1
  10. data/gemfiles/celluloid_017.gemfile +4 -4
  11. data/gemfiles/celluloid_018.gemfile +4 -4
  12. data/gemfiles/celluloid_master.gemfile +4 -4
  13. data/gemfiles/concurrent-ruby-1.0.5.gem +0 -0
  14. data/gemfiles/concurrent-ruby-edge-0.3.1.gem +0 -0
  15. data/lib/pubnub.rb +3 -3
  16. data/lib/pubnub/client.rb +19 -16
  17. data/lib/pubnub/client/events.rb +5 -5
  18. data/lib/pubnub/client/getters_setters.rb +11 -12
  19. data/lib/pubnub/client/paged_history.rb +11 -9
  20. data/lib/pubnub/configuration.rb +1 -2
  21. data/lib/pubnub/constants.rb +47 -47
  22. data/lib/pubnub/crypto.rb +2 -2
  23. data/lib/pubnub/envelope.rb +7 -5
  24. data/lib/pubnub/error.rb +22 -15
  25. data/lib/pubnub/event.rb +24 -25
  26. data/lib/pubnub/event/formatter.rb +8 -5
  27. data/lib/pubnub/event/signature.rb +3 -3
  28. data/lib/pubnub/events/audit.rb +1 -1
  29. data/lib/pubnub/events/channel_registration.rb +10 -15
  30. data/lib/pubnub/events/delete_messages.rb +9 -9
  31. data/lib/pubnub/events/grant.rb +3 -3
  32. data/lib/pubnub/events/heartbeat.rb +4 -8
  33. data/lib/pubnub/events/here_now.rb +4 -8
  34. data/lib/pubnub/events/history.rb +10 -10
  35. data/lib/pubnub/events/leave.rb +2 -2
  36. data/lib/pubnub/events/presence.rb +1 -1
  37. data/lib/pubnub/events/publish.rb +3 -5
  38. data/lib/pubnub/events/revoke.rb +3 -3
  39. data/lib/pubnub/events/set_state.rb +3 -3
  40. data/lib/pubnub/events/state.rb +4 -6
  41. data/lib/pubnub/events/subscribe.rb +1 -1
  42. data/lib/pubnub/events/time.rb +2 -2
  43. data/lib/pubnub/events/where_now.rb +6 -6
  44. data/lib/pubnub/format.rb +73 -0
  45. data/lib/pubnub/formatter.rb +23 -21
  46. data/lib/pubnub/heart.rb +4 -4
  47. data/lib/pubnub/origin_manager.rb +3 -5
  48. data/lib/pubnub/pam.rb +5 -5
  49. data/lib/pubnub/schemas/envelope_schema.rb +1 -1
  50. data/lib/pubnub/subscribe_callback.rb +3 -3
  51. data/lib/pubnub/subscribe_event.rb +6 -10
  52. data/lib/pubnub/subscribe_event/formatter.rb +82 -80
  53. data/lib/pubnub/subscribe_event/heartbeat.rb +1 -1
  54. data/lib/pubnub/subscriber.rb +31 -32
  55. data/lib/pubnub/telemetry.rb +26 -27
  56. data/lib/pubnub/validators/audit.rb +3 -2
  57. data/lib/pubnub/validators/channel_registration.rb +6 -4
  58. data/lib/pubnub/validators/client.rb +1 -0
  59. data/lib/pubnub/validators/common_validator.rb +37 -31
  60. data/lib/pubnub/validators/delete.rb +5 -4
  61. data/lib/pubnub/validators/grant.rb +3 -2
  62. data/lib/pubnub/validators/history.rb +3 -2
  63. data/lib/pubnub/validators/leave.rb +3 -2
  64. data/lib/pubnub/validators/presence.rb +3 -2
  65. data/lib/pubnub/validators/publish.rb +15 -10
  66. data/lib/pubnub/validators/set_state.rb +0 -2
  67. data/lib/pubnub/validators/state.rb +3 -2
  68. data/lib/pubnub/version.rb +1 -1
  69. data/pubnub.gemspec +19 -18
  70. data/spec/examples/audit_examples_spec.rb +1268 -1418
  71. data/spec/examples/channel_registration_examples_spec.rb +655 -757
  72. data/spec/examples/delete_messages_examples_spec.rb +19 -21
  73. data/spec/examples/grant_examples_spec.rb +34028 -37920
  74. data/spec/examples/heartbeat_examples_spec.rb +583 -731
  75. data/spec/examples/here_now_examples_spec.rb +493 -569
  76. data/spec/examples/history_examples_spec.rb +979 -1127
  77. data/spec/examples/leave_examples_spec.rb +439 -551
  78. data/spec/examples/presence_examples_spec.rb +686 -830
  79. data/spec/examples/publish_examples_spec.rb +27223 -31547
  80. data/spec/examples/publish_with_ttl_spec.rb +11 -14
  81. data/spec/examples/revoke_examples_spec.rb +68048 -75828
  82. data/spec/examples/set_state_examples_spec.rb +295 -371
  83. data/spec/examples/state_examples_spec.rb +169 -197
  84. data/spec/examples/status_request_message_count_exceeded_spec.rb +16 -19
  85. data/spec/examples/subscribe_examples_spec.rb +43843 -52035
  86. data/spec/examples/time_examples_spec.rb +82 -98
  87. data/spec/examples/where_now_examples_spec.rb +88 -104
  88. data/spec/lib/client_spec.rb +99 -117
  89. data/spec/lib/connection_callback_spec.rb +27 -33
  90. data/spec/lib/custom_retries_examples_spec.rb +8 -11
  91. data/spec/lib/event_spec.rb +35 -42
  92. data/spec/lib/events/audit_spec.rb +19 -25
  93. data/spec/lib/events/channel_registration_spec.rb +17 -23
  94. data/spec/lib/events/delete_messages_spec.rb +14 -20
  95. data/spec/lib/events/grant_spec.rb +15 -21
  96. data/spec/lib/events/heartbeat_spec.rb +21 -27
  97. data/spec/lib/events/here_now_spec.rb +14 -20
  98. data/spec/lib/events/history_spec.rb +14 -20
  99. data/spec/lib/events/leave_spec.rb +14 -20
  100. data/spec/lib/events/presence_delta_spec.rb +15 -16
  101. data/spec/lib/events/presence_spec.rb +36 -45
  102. data/spec/lib/events/publish_spec.rb +33 -40
  103. data/spec/lib/events/revoke_spec.rb +16 -22
  104. data/spec/lib/events/state_spec.rb +16 -22
  105. data/spec/lib/events/subscribe_spec.rb +75 -85
  106. data/spec/lib/events/time_spec.rb +12 -18
  107. data/spec/lib/events/timeout_handling_spec.rb +8 -14
  108. data/spec/lib/events/where_now_spec.rb +14 -20
  109. data/spec/lib/keep_alive_spec.rb +4 -8
  110. data/spec/lib/multiple_ciphers_spec.rb +56 -60
  111. data/spec/lib/pubnub_spec.rb +10 -13
  112. data/spec/lib/signatures_spec.rb +118 -120
  113. data/spec/lib/ssl_error_spec.rb +14 -18
  114. data/spec/lib/super_admin_spec.rb +58 -66
  115. data/spec/lib/uuid_spec.rb +3 -4
  116. data/spec/spec_expectations.rb +3 -3
  117. data/spec/spec_helper.rb +29 -46
  118. metadata +52 -22
  119. data/lib/pubnub/message.rb +0 -43
@@ -1,39 +1,33 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Pubnub::Publish do
4
- it_behaves_like 'an event'
4
+ it_behaves_like "an event"
5
5
 
6
- around :each do |example|
7
- Celluloid.boot
8
- example.run
9
- Celluloid.shutdown
10
- end
11
-
12
- context 'given basic parameters' do
6
+ context "given basic parameters" do
13
7
  before :each do
14
8
  @pubnub = Pubnub::Client.new(
15
- subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
16
- publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
17
- auth_key: 'ruby-test-auth',
18
- uuid: 'ruby-test-uuid'
9
+ subscribe_key: "sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f",
10
+ publish_key: "pub-c-b42cec2f-f468-4784-8833-dd2b074538c4",
11
+ auth_key: "ruby-test-auth",
12
+ uuid: "ruby-test-uuid",
19
13
  )
20
14
  end
21
- it 'works' do
22
- VCR.use_cassette('lib/events/publish', record: :once) do
15
+ it "works" do
16
+ VCR.use_cassette("lib/events/publish", record: :once) do
23
17
  envelope = @pubnub.publish(
24
- channel: :demo,
25
- message: 'whatever'
18
+ channel: :demo,
19
+ message: "whatever",
26
20
  ).value
27
21
 
28
22
  expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
29
23
  end
30
24
  end
31
25
 
32
- it 'forms valid ErrorEnvelope on error' do
33
- VCR.use_cassette('lib/events/publish-error', record: :once) do
26
+ it "forms valid ErrorEnvelope on error" do
27
+ VCR.use_cassette("lib/events/publish-error", record: :once) do
34
28
  envelope = @pubnub.publish(
35
- channel: :demo,
36
- message: 'whatever'
29
+ channel: :demo,
30
+ message: "whatever",
37
31
  ).value
38
32
 
39
33
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
@@ -42,39 +36,38 @@ describe Pubnub::Publish do
42
36
  end
43
37
  end
44
38
 
45
- context 'store, replicate' do
39
+ context "store, replicate" do
46
40
  before(:each) do
47
41
  @pubnub = Pubnub.new(
48
- :max_retries => 0,
49
- :subscribe_key => :demo,
50
- :publish_key => :demo,
51
- :auth_key => :demoish_authkey,
52
- :error_callback => @error_callback
42
+ :max_retries => 0,
43
+ :subscribe_key => :demo,
44
+ :publish_key => :demo,
45
+ :auth_key => :demoish_authkey,
46
+ :error_callback => @error_callback,
53
47
  )
54
48
 
55
- @pubnub.uuid = 'tester'
49
+ @pubnub.uuid = "tester"
56
50
  end
57
51
 
58
- it 'works' do
59
- VCR.use_cassette('integration/publish/publish-store-replicate', record: :once) do
52
+ it "works" do
53
+ VCR.use_cassette("integration/publish/publish-store-replicate", record: :once) do
60
54
  future = @pubnub.publish(
61
- message: { text: 'sometext' },
62
- channel: 'ruby_demo_channel',
63
- callback: @callback,
64
- store: false,
65
- replicate: false
55
+ message: {text: "sometext"},
56
+ channel: "ruby_demo_channel",
57
+ callback: @callback,
58
+ store: false,
59
+ replicate: false,
66
60
  )
67
61
 
68
62
  future.value
69
63
  end
70
64
  end
71
65
 
72
- it 'works with fire method' do
73
- VCR.use_cassette('integration/publish/publish-store-replicate', record: :once) do
74
-
66
+ it "works with fire method" do
67
+ VCR.use_cassette("integration/publish/publish-store-replicate", record: :once) do
75
68
  future = @pubnub.fire(
76
- message: { text: 'sometext' },
77
- channel: 'ruby_demo_channel',
69
+ message: {text: "sometext"},
70
+ channel: "ruby_demo_channel",
78
71
  )
79
72
 
80
73
  future.value
@@ -1,32 +1,26 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Pubnub::Revoke do
4
- it_behaves_like 'an event'
4
+ it_behaves_like "an event"
5
5
 
6
- around :each do |example|
7
- Celluloid.boot
8
- example.run
9
- Celluloid.shutdown
10
- end
11
-
12
- context 'given basic parameters' do
6
+ context "given basic parameters" do
13
7
  before :each do
14
8
  Pubnub::Revoke.any_instance.stub(:current_time).and_return 1463307484
15
- Pubnub::Revoke.any_instance.stub(:signature).and_return '7FvZ9FQeu9q_uTx8ICyK8CiWDOeD1Qc6nrsNfqP0fyY='
9
+ Pubnub::Revoke.any_instance.stub(:signature).and_return "7FvZ9FQeu9q_uTx8ICyK8CiWDOeD1Qc6nrsNfqP0fyY="
16
10
 
17
11
  @pubnub = Pubnub::Client.new(
18
- subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
19
- publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
20
- secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
21
- auth_key: 'ruby-test-auth',
22
- uuid: 'ruby-test-uuid'
12
+ subscribe_key: "sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f",
13
+ publish_key: "pub-c-b42cec2f-f468-4784-8833-dd2b074538c4",
14
+ secret_key: "sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy",
15
+ auth_key: "ruby-test-auth",
16
+ uuid: "ruby-test-uuid",
23
17
  )
24
18
  end
25
19
 
26
- it 'works' do
27
- VCR.use_cassette('lib/events/revoke', record: :once) do
20
+ it "works" do
21
+ VCR.use_cassette("lib/events/revoke", record: :once) do
28
22
  envelope = @pubnub.revoke(
29
- channel: :demo
23
+ channel: :demo,
30
24
  ).value
31
25
 
32
26
  expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
@@ -34,10 +28,10 @@ describe Pubnub::Revoke do
34
28
  end
35
29
  end
36
30
 
37
- it 'forms valid ErrorEnvelope on error' do
38
- VCR.use_cassette('lib/events/revoke-error', record: :once) do
31
+ it "forms valid ErrorEnvelope on error" do
32
+ VCR.use_cassette("lib/events/revoke-error", record: :once) do
39
33
  envelope = @pubnub.revoke(
40
- channel: :demo
34
+ channel: :demo,
41
35
  ).value
42
36
 
43
37
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
@@ -46,4 +40,4 @@ describe Pubnub::Revoke do
46
40
  end
47
41
  end
48
42
  end
49
- end
43
+ end
@@ -1,29 +1,23 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Pubnub::State do
4
- it_behaves_like 'an event'
4
+ it_behaves_like "an event"
5
5
 
6
- around :each do |example|
7
- Celluloid.boot
8
- example.run
9
- Celluloid.shutdown
10
- end
11
-
12
- context 'given basic parameters' do
6
+ context "given basic parameters" do
13
7
  before :each do
14
8
  @pubnub = Pubnub::Client.new(
15
- subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
16
- publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
17
- auth_key: 'ruby-test-auth',
18
- uuid: 'ruby-test-uuid'
9
+ subscribe_key: "sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f",
10
+ publish_key: "pub-c-b42cec2f-f468-4784-8833-dd2b074538c4",
11
+ auth_key: "ruby-test-auth",
12
+ uuid: "ruby-test-uuid",
19
13
  )
20
14
  end
21
15
 
22
- it 'works' do
23
- VCR.use_cassette('lib/events/state', record: :once) do
16
+ it "works" do
17
+ VCR.use_cassette("lib/events/state", record: :once) do
24
18
  envelope = @pubnub.state(
25
- channel: :demo,
26
- uuid: :whatever
19
+ channel: :demo,
20
+ uuid: :whatever,
27
21
  ).value
28
22
 
29
23
  expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
@@ -31,11 +25,11 @@ describe Pubnub::State do
31
25
  end
32
26
  end
33
27
 
34
- it 'forms valid ErrorEnvelope on error' do
35
- VCR.use_cassette('lib/events/state-error', record: :once) do
28
+ it "forms valid ErrorEnvelope on error" do
29
+ VCR.use_cassette("lib/events/state-error", record: :once) do
36
30
  envelope = @pubnub.state(
37
- channel: :demo,
38
- uuid: :whatever
31
+ channel: :demo,
32
+ uuid: :whatever,
39
33
  ).value
40
34
 
41
35
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
@@ -43,4 +37,4 @@ describe Pubnub::State do
43
37
  end
44
38
  end
45
39
  end
46
- end
40
+ end
@@ -1,34 +1,33 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Pubnub::Subscribe do
4
4
  # it_behaves_like 'an event'
5
5
 
6
6
  around :each do |example|
7
- Celluloid.boot
8
- example.run
9
- Celluloid.shutdown
7
+ example.run_with_retry retry: 10
10
8
  end
11
9
 
12
- context 'given basic parameters' do
10
+
11
+ context "given basic parameters" do
13
12
  before :each do
14
13
  @messages = []
15
14
  @statuses = []
16
15
 
17
16
  @callbacks = Pubnub::SubscribeCallback.new(
18
- message: ->(envelope) { @messages << envelope },
19
- presence: ->(_envelope) {},
20
- status: ->(envelope) { @statuses << envelope }
17
+ message: -> (envelope) { @messages << envelope },
18
+ presence: -> (_envelope) { },
19
+ status: -> (envelope) { @statuses << envelope },
21
20
  )
22
21
  end
23
22
 
24
- context 'async' do
25
- it 'works' do
26
- VCR.use_cassette('lib/events/subscribe-async', record: :once) do
23
+ context "async" do
24
+ it "works" do
25
+ VCR.use_cassette("lib/events/subscribe-async", record: :once) do
27
26
  @pubnub = Pubnub::Client.new(
28
- subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
29
- publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
30
- auth_key: 'ruby-test-auth',
31
- uuid: 'ruby-test-uuid'
27
+ subscribe_key: "sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f",
28
+ publish_key: "pub-c-b42cec2f-f468-4784-8833-dd2b074538c4",
29
+ auth_key: "ruby-test-auth",
30
+ uuid: "ruby-test-uuid",
32
31
  )
33
32
 
34
33
  @pubnub.add_listener(callback: @callbacks)
@@ -40,53 +39,51 @@ describe Pubnub::Subscribe do
40
39
  expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
41
40
  expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
42
41
  end
43
-
44
42
  end
45
43
  end
46
44
 
47
- it 'works with cipher key' do
45
+ it "works with cipher key" do
48
46
  @pubnub = Pubnub::Client.new(
49
- subscribe_key: 'demo',
50
- publish_key: 'demo',
51
- uuid: 'ruby-test-uuid',
52
- cipher_key: 'demo'
47
+ subscribe_key: "demo",
48
+ publish_key: "demo",
49
+ uuid: "ruby-test-uuid",
50
+ cipher_key: "demo",
53
51
  )
54
52
 
55
53
  @pubnub.add_listener(callback: @callbacks)
56
54
 
57
- VCR.use_cassette('lib/events/subscribe-cipher-async', record: :once) do
55
+ VCR.use_cassette("lib/events/subscribe-cipher-async", record: :once) do
58
56
  @pubnub.subscribe(channel: :whatever)
59
57
 
60
58
  eventually do
61
- expect(@messages.first.result[:data][:message]).to eq('text' => 'hey')
59
+ expect(@messages.first.result[:data][:message]).to eq("text" => "hey")
62
60
  end
63
61
  end
64
62
  end
65
63
 
66
- it 'allows subscribing additional channels' do
64
+ it "allows subscribing additional channels" do
67
65
  @pubnub = Pubnub::Client.new(
68
- subscribe_key: 'demo',
69
- publish_key: 'demo',
70
- uuid: 'ruby-test-uuid'
66
+ subscribe_key: "demo",
67
+ publish_key: "demo",
68
+ uuid: "ruby-test-uuid",
71
69
  )
72
70
 
73
- VCR.use_cassette('lib/events/subscribe-playing-async', record: :once) do
71
+ VCR.use_cassette("lib/events/subscribe-playing-async", record: :once) do
74
72
  @pubnub.subscribe(channel: :demo)
75
73
  #sleep(0.1)
76
74
  @pubnub.subscribe(channel: :whatever)
77
75
  #sleep(0.1)
78
76
  @pubnub.leave(channel: [:whatever, :demo])
79
77
  end
80
-
81
78
  end
82
79
 
83
- it 'fires status callback on error' do
84
- VCR.use_cassette('lib/events/subscribe-async-error', record: :once) do
80
+ it "fires status callback on error" do
81
+ VCR.use_cassette("lib/events/subscribe-async-error", record: :once) do
85
82
  @pubnub = Pubnub::Client.new(
86
- subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
87
- publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
88
- auth_key: 'ruby-test-auth',
89
- uuid: 'ruby-test-uuid'
83
+ subscribe_key: "sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f",
84
+ publish_key: "pub-c-b42cec2f-f468-4784-8833-dd2b074538c4",
85
+ auth_key: "ruby-test-auth",
86
+ uuid: "ruby-test-uuid",
90
87
  )
91
88
 
92
89
  @pubnub.add_listener(callback: @callbacks)
@@ -99,56 +96,53 @@ describe Pubnub::Subscribe do
99
96
  expect(envelope).to be_a_kind_of Pubnub::ErrorEnvelope
100
97
  expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
101
98
  end
102
-
103
99
  end
104
100
  end
105
101
  end
106
102
 
107
- context 'sync' do
108
- it 'works with cipher key' do
103
+ context "sync" do
104
+ it "works with cipher key" do
109
105
  @pubnub = Pubnub::Client.new(
110
- subscribe_key: 'demo',
111
- publish_key: 'demo',
112
- uuid: 'ruby-test-uuid',
113
- cipher_key: 'demo'
106
+ subscribe_key: "demo",
107
+ publish_key: "demo",
108
+ uuid: "ruby-test-uuid",
109
+ cipher_key: "demo",
114
110
  )
115
111
 
116
- VCR.use_cassette('lib/events/subscribe-cipher-async', record: :once) do
112
+ VCR.use_cassette("lib/events/subscribe-cipher-async", record: :once) do
117
113
  @pubnub.subscribe(channel: :whatever, http_sync: true)
118
114
  @messages = @pubnub.subscribe(channel: :whatever, http_sync: true)
119
115
  eventually do
120
- expect(@messages.first.result[:data][:message]).to eq('text' => 'hey')
116
+ expect(@messages.first.result[:data][:message]).to eq("text" => "hey")
121
117
  end
122
118
  end
123
119
  end
124
120
 
125
- it 'works' do
126
- VCR.use_cassette('lib/events/subscribe-sync', record: :once) do
121
+ it "works" do
122
+ VCR.use_cassette("lib/events/subscribe-sync", record: :once) do
127
123
  @pubnub = Pubnub::Client.new(
128
- subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
129
- publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
130
- auth_key: 'ruby-test-auth',
131
- uuid: 'ruby-test-uuid'
124
+ subscribe_key: "sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f",
125
+ publish_key: "pub-c-b42cec2f-f468-4784-8833-dd2b074538c4",
126
+ auth_key: "ruby-test-auth",
127
+ uuid: "ruby-test-uuid",
132
128
  )
133
129
 
134
130
  @pubnub.subscribe(channel: :demo, http_sync: true)
135
131
  envelopes = @pubnub.subscribe(channel: :demo, http_sync: true)
136
132
 
137
-
138
133
  envelope = envelopes.first
139
134
  expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
140
135
  expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
141
-
142
136
  end
143
137
  end
144
138
 
145
- it 'fires status callback on error' do
146
- VCR.use_cassette('lib/events/subscribe-sync-error', record: :once) do
139
+ it "fires status callback on error" do
140
+ VCR.use_cassette("lib/events/subscribe-sync-error", record: :once) do
147
141
  @pubnub = Pubnub::Client.new(
148
- subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
149
- publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
150
- auth_key: 'ruby-test-auth',
151
- uuid: 'ruby-test-uuid'
142
+ subscribe_key: "sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f",
143
+ publish_key: "pub-c-b42cec2f-f468-4784-8833-dd2b074538c4",
144
+ auth_key: "ruby-test-auth",
145
+ uuid: "ruby-test-uuid",
152
146
  )
153
147
 
154
148
  @pubnub.subscribe(channel: :demo, http_sync: true)
@@ -157,40 +151,36 @@ describe Pubnub::Subscribe do
157
151
  envelope = envelopes.first
158
152
  expect(envelope).to be_a_kind_of Pubnub::ErrorEnvelope
159
153
  expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
160
-
161
154
  end
162
155
  end
163
156
  end
164
157
 
165
- context 'aliases' do
166
- it 'pass channels to channel' do
167
- VCR.use_cassette('lib/events/subscribe-sync', record: :once) do
158
+ context "aliases" do
159
+ it "pass channels to channel" do
160
+ VCR.use_cassette("lib/events/subscribe-sync", record: :once) do
168
161
  @pubnub = Pubnub::Client.new(
169
- subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
170
- publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
171
- auth_key: 'ruby-test-auth',
172
- uuid: 'ruby-test-uuid'
162
+ subscribe_key: "sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f",
163
+ publish_key: "pub-c-b42cec2f-f468-4784-8833-dd2b074538c4",
164
+ auth_key: "ruby-test-auth",
165
+ uuid: "ruby-test-uuid",
173
166
  )
174
167
 
175
168
  @pubnub.subscribe(channels: :demo, http_sync: true)
176
169
  envelopes = @pubnub.subscribe(channels: :demo, http_sync: true)
177
170
 
178
-
179
171
  envelope = envelopes.first
180
172
  expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
181
173
  expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
182
-
183
174
  end
184
175
  end
185
176
 
186
- it 'pass channel_groups to channel_group' do
187
- VCR.use_cassette('lib/events/subscribe-channel-groups', record: :once) do
188
-
177
+ it "pass channel_groups to channel_group" do
178
+ VCR.use_cassette("lib/events/subscribe-channel-groups", record: :once) do
189
179
  @pubnub = Pubnub::Client.new(
190
- subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
191
- publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
192
- auth_key: 'ruby-test-auth',
193
- uuid: 'ruby-test-uuid'
180
+ subscribe_key: "sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f",
181
+ publish_key: "pub-c-b42cec2f-f468-4784-8833-dd2b074538c4",
182
+ auth_key: "ruby-test-auth",
183
+ uuid: "ruby-test-uuid",
194
184
  )
195
185
 
196
186
  @pubnub.subscribe(channel_groups: :demo, http_sync: true)
@@ -203,18 +193,18 @@ describe Pubnub::Subscribe do
203
193
  end
204
194
  end
205
195
 
206
- context 'flags' do
207
- it 'with with_presence' do
208
- VCR.use_cassette('lib/events/subscribe-with-presence', record: :once) do
196
+ context "flags" do
197
+ it "with with_presence" do
198
+ VCR.use_cassette("lib/events/subscribe-with-presence", record: :once) do
209
199
  @pubnub = Pubnub::Client.new(
210
- subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
211
- publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
212
- auth_key: 'ruby-test-auth',
213
- uuid: 'ruby-test-uuid'
200
+ subscribe_key: "sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f",
201
+ publish_key: "pub-c-b42cec2f-f468-4784-8833-dd2b074538c4",
202
+ auth_key: "ruby-test-auth",
203
+ uuid: "ruby-test-uuid",
214
204
  )
215
205
 
216
- @pubnub.subscribe(channels: [:demo, :demo1, 'demo.*'], with_presence: true, http_sync: true)
217
- envelopes = @pubnub.subscribe(channels: [:demo, :demo1, 'demo.*'], with_presence: true, http_sync: true)
206
+ @pubnub.subscribe(channels: [:demo, :demo1, "demo.*"], with_presence: true, http_sync: true)
207
+ envelopes = @pubnub.subscribe(channels: [:demo, :demo1, "demo.*"], with_presence: true, http_sync: true)
218
208
 
219
209
  envelope = envelopes.first
220
210
  expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
@@ -223,4 +213,4 @@ describe Pubnub::Subscribe do
223
213
  end
224
214
  end
225
215
  end
226
- end
216
+ end