pubnub 4.2.5 → 4.5.0

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

Potentially problematic release.


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

Files changed (183) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -0
  3. data/.pubnub.yml +168 -117
  4. data/.travis.yml +13 -9
  5. data/CHANGELOG.md +31 -8
  6. data/Gemfile.lock +67 -64
  7. data/README.md +56 -17
  8. data/VERSION +1 -1
  9. data/fixtures/vcr_cassettes/examples/add_channels_to_push/001.yml +45 -0
  10. data/fixtures/vcr_cassettes/examples/add_channels_to_push/002.yml +45 -0
  11. data/fixtures/vcr_cassettes/examples/add_channels_to_push/003.yml +45 -0
  12. data/fixtures/vcr_cassettes/examples/add_channels_to_push/004.yml +45 -0
  13. data/fixtures/vcr_cassettes/examples/grant/1913.yml +1 -1
  14. data/fixtures/vcr_cassettes/examples/grant/1944.yml +8 -9
  15. data/fixtures/vcr_cassettes/examples/grant/1945.yml +359 -9
  16. data/fixtures/vcr_cassettes/examples/grant/1946.yml +8 -9
  17. data/fixtures/vcr_cassettes/examples/grant/1947.yml +8 -9
  18. data/fixtures/vcr_cassettes/examples/grant/1948.yml +8 -9
  19. data/fixtures/vcr_cassettes/examples/history/100.yml +46 -0
  20. data/fixtures/vcr_cassettes/examples/history/include_meta__encrypted.yml +46 -0
  21. data/fixtures/vcr_cassettes/examples/history/include_token__encrypted.yml +45 -0
  22. data/fixtures/vcr_cassettes/examples/history/no_includes__encrypted.yml +45 -0
  23. data/fixtures/vcr_cassettes/examples/list_push_provisions/001.yml +46 -0
  24. data/fixtures/vcr_cassettes/examples/list_push_provisions/002.yml +45 -0
  25. data/fixtures/vcr_cassettes/examples/list_push_provisions/003.yml +45 -0
  26. data/fixtures/vcr_cassettes/examples/remove_channels_from_push/001.yml +45 -0
  27. data/fixtures/vcr_cassettes/examples/remove_channels_from_push/002.yml +45 -0
  28. data/fixtures/vcr_cassettes/examples/remove_channels_from_push/003.yml +45 -0
  29. data/fixtures/vcr_cassettes/examples/remove_device_from_push/001.yml +45 -0
  30. data/fixtures/vcr_cassettes/examples/remove_device_from_push/002.yml +45 -0
  31. data/fixtures/vcr_cassettes/examples/remove_device_from_push/003.yml +45 -0
  32. data/fixtures/vcr_cassettes/lib/events/get_all_channels_metadata.yml +39 -0
  33. data/fixtures/vcr_cassettes/lib/events/get_all_uuid_metadata.yml +76 -0
  34. data/fixtures/vcr_cassettes/lib/events/get_channel_members.yml +37 -0
  35. data/fixtures/vcr_cassettes/lib/events/get_channel_metadata.yml +37 -0
  36. data/fixtures/vcr_cassettes/lib/events/get_memberships1.yml +37 -0
  37. data/fixtures/vcr_cassettes/lib/events/get_memberships2.yml +37 -0
  38. data/fixtures/vcr_cassettes/lib/events/get_uuid_metadata1.yml +76 -0
  39. data/fixtures/vcr_cassettes/lib/events/get_uuid_metadata2.yml +76 -0
  40. data/fixtures/vcr_cassettes/lib/events/grant-error.yml +2 -2
  41. data/fixtures/vcr_cassettes/lib/events/grant.yml +10 -11
  42. data/fixtures/vcr_cassettes/lib/events/remove_channel_members.yml +78 -0
  43. data/fixtures/vcr_cassettes/lib/events/{delete_space.yml → remove_channel_metadata.yml} +5 -6
  44. data/fixtures/vcr_cassettes/lib/events/{manage_memberships_remove.yml → remove_memberships1.yml} +8 -9
  45. data/fixtures/vcr_cassettes/lib/events/{manage_members_add.yml → remove_memberships2.yml} +8 -9
  46. data/fixtures/vcr_cassettes/lib/events/remove_uuid_metadata1.yml +76 -0
  47. data/fixtures/vcr_cassettes/lib/events/remove_uuid_metadata2.yml +76 -0
  48. data/fixtures/vcr_cassettes/lib/events/set_channel_members.yml +39 -0
  49. data/fixtures/vcr_cassettes/lib/events/set_channel_metadata.yml +39 -0
  50. data/fixtures/vcr_cassettes/lib/events/{manage_memberships_add.yml → set_memberships1.yml} +8 -9
  51. data/fixtures/vcr_cassettes/lib/events/set_memberships2.yml +39 -0
  52. data/fixtures/vcr_cassettes/lib/events/set_uuid_metadata1.yml +78 -0
  53. data/fixtures/vcr_cassettes/lib/events/set_uuid_metadata2.yml +78 -0
  54. data/fixtures/vcr_cassettes/lib/events/{subscribe-space-delete-async.yml → subscribe-channel-metadata-remove-sync.yml} +12 -14
  55. data/fixtures/vcr_cassettes/lib/events/subscribe-channel-metadata-set-async.yml +75 -0
  56. data/fixtures/vcr_cassettes/lib/events/{subscribe-member-remove-async.yml → subscribe-member-remove-sync.yml} +12 -14
  57. data/fixtures/vcr_cassettes/lib/events/subscribe-member-set-async.yml +75 -0
  58. data/fixtures/vcr_cassettes/lib/events/subscribe-membership-remove-async.yml +12 -14
  59. data/fixtures/vcr_cassettes/lib/events/{subscribe-user-update-async.yml → subscribe-membership-set-async.yml} +12 -14
  60. data/fixtures/vcr_cassettes/lib/events/{subscribe-user-delete-async.yml → subscribe-uuid-metadata-remove-sync.yml} +12 -14
  61. data/fixtures/vcr_cassettes/lib/events/subscribe-uuid-metadata-set-async.yml +75 -0
  62. data/lib/pubnub/client.rb +18 -15
  63. data/lib/pubnub/client/events.rb +4 -2
  64. data/lib/pubnub/client/paged_history.rb +1 -1
  65. data/lib/pubnub/constants.rb +19 -18
  66. data/lib/pubnub/event.rb +32 -16
  67. data/lib/pubnub/event/formatter.rb +4 -0
  68. data/lib/pubnub/event/signature.rb +22 -7
  69. data/lib/pubnub/events/add_channels_to_push.rb +29 -13
  70. data/lib/pubnub/events/get_all_channels_metadata.rb +104 -0
  71. data/lib/pubnub/events/get_all_uuid_metadata.rb +104 -0
  72. data/lib/pubnub/events/get_channel_members.rb +120 -0
  73. data/lib/pubnub/events/{update_space.rb → get_channel_metadata.rb} +27 -27
  74. data/lib/pubnub/events/get_memberships.rb +120 -0
  75. data/lib/pubnub/events/{create_space.rb → get_uuid_metadata.rb} +27 -25
  76. data/lib/pubnub/events/grant.rb +10 -1
  77. data/lib/pubnub/events/history.rb +17 -2
  78. data/lib/pubnub/events/list_push_provisions.rb +29 -12
  79. data/lib/pubnub/events/remove_channel_members.rb +137 -0
  80. data/lib/pubnub/events/{delete_space.rb → remove_channel_metadata.rb} +12 -12
  81. data/lib/pubnub/events/remove_channels_from_push.rb +29 -13
  82. data/lib/pubnub/events/remove_device_from_push.rb +30 -14
  83. data/lib/pubnub/events/remove_memberships.rb +137 -0
  84. data/lib/pubnub/events/{delete_user.rb → remove_uuid_metadata.rb} +12 -12
  85. data/lib/pubnub/events/set_channel_members.rb +140 -0
  86. data/lib/pubnub/events/{manage_members.rb → set_channel_metadata.rb} +32 -38
  87. data/lib/pubnub/events/set_memberships.rb +140 -0
  88. data/lib/pubnub/events/{create_user.rb → set_uuid_metadata.rb} +33 -17
  89. data/lib/pubnub/formatter.rb +30 -3
  90. data/lib/pubnub/pam.rb +2 -11
  91. data/lib/pubnub/subscribe_callback.rb +1 -3
  92. data/lib/pubnub/subscribe_event/formatter.rb +26 -17
  93. data/lib/pubnub/subscriber.rb +5 -6
  94. data/lib/pubnub/validators/add_channels_to_push.rb +52 -0
  95. data/lib/pubnub/validators/get_all_channels_metadata.rb +29 -0
  96. data/lib/pubnub/validators/get_all_uuid_metadata.rb +29 -0
  97. data/lib/pubnub/validators/get_channel_members.rb +39 -0
  98. data/lib/pubnub/validators/get_channel_metadata.rb +39 -0
  99. data/lib/pubnub/validators/get_memberships.rb +39 -0
  100. data/lib/pubnub/validators/get_uuid_metadata.rb +39 -0
  101. data/lib/pubnub/validators/grant.rb +37 -2
  102. data/lib/pubnub/validators/list_push_provisions.rb +43 -0
  103. data/lib/pubnub/validators/remove_channel_members.rb +52 -0
  104. data/lib/pubnub/validators/remove_channel_metadata.rb +39 -0
  105. data/lib/pubnub/validators/remove_channels_from_push.rb +52 -0
  106. data/lib/pubnub/validators/remove_device_from_push.rb +43 -0
  107. data/lib/pubnub/validators/remove_memberships.rb +52 -0
  108. data/lib/pubnub/validators/remove_uuid_metadata.rb +39 -0
  109. data/lib/pubnub/validators/set_channel_members.rb +78 -0
  110. data/lib/pubnub/validators/set_channel_metadata.rb +62 -0
  111. data/lib/pubnub/validators/set_memberships.rb +78 -0
  112. data/lib/pubnub/validators/set_uuid_metadata.rb +62 -0
  113. data/lib/pubnub/version.rb +1 -1
  114. data/pubnub.gemspec +1 -1
  115. data/spec/examples/add_channels_to_push_spec.rb +178 -0
  116. data/spec/examples/{grant_examples_spec.rb → grant_examples_1_spec.rb} +0 -8973
  117. data/spec/examples/grant_examples_2_spec.rb +9107 -0
  118. data/spec/examples/history_examples_spec.rb +85 -0
  119. data/spec/examples/list_push_provisions_spec.rb +164 -0
  120. data/spec/examples/presence_examples_spec.rb +222 -186
  121. data/spec/examples/remove_channels_from_push_spec.rb +164 -0
  122. data/spec/examples/remove_device_from_push_spec.rb +164 -0
  123. data/spec/examples/revoke_examples_1_spec.rb +27013 -0
  124. data/spec/examples/revoke_examples_2_spec.rb +27012 -0
  125. data/spec/examples/revoke_examples_3_spec.rb +17967 -0
  126. data/spec/examples/status_request_message_count_exceeded_spec.rb +4 -1
  127. data/spec/examples/subscribe_examples_1_spec.rb +26972 -0
  128. data/spec/examples/subscribe_examples_2_spec.rb +19575 -0
  129. data/spec/lib/connection_callback_spec.rb +4 -3
  130. data/spec/lib/event/formatter_spec.rb +22 -0
  131. data/spec/lib/events/channel_metadata_spec.rb +58 -0
  132. data/spec/lib/events/grant_spec.rb +3 -2
  133. data/spec/lib/events/membership_spec.rb +51 -21
  134. data/spec/lib/events/presence_delta_spec.rb +9 -6
  135. data/spec/lib/events/presence_spec.rb +13 -7
  136. data/spec/lib/events/subscribe_spec.rb +102 -65
  137. data/spec/lib/events/uuid_metadata_spec.rb +86 -0
  138. data/spec/lib/subscribe_event/formatter_spec.rb +22 -0
  139. data/spec/lib/super_admin_spec.rb +8 -4
  140. data/spec/spec_helper.rb +24 -8
  141. metadata +124 -79
  142. data/fixtures/vcr_cassettes/lib/events/create_space.yml +0 -40
  143. data/fixtures/vcr_cassettes/lib/events/create_user.yml +0 -40
  144. data/fixtures/vcr_cassettes/lib/events/delete_user.yml +0 -38
  145. data/fixtures/vcr_cassettes/lib/events/get_members.yml +0 -38
  146. data/fixtures/vcr_cassettes/lib/events/get_space.yml +0 -38
  147. data/fixtures/vcr_cassettes/lib/events/get_space_memberships.yml +0 -38
  148. data/fixtures/vcr_cassettes/lib/events/get_spaces.yml +0 -40
  149. data/fixtures/vcr_cassettes/lib/events/get_user.yml +0 -38
  150. data/fixtures/vcr_cassettes/lib/events/get_users.yml +0 -40
  151. data/fixtures/vcr_cassettes/lib/events/manage_members_remove.yml +0 -83
  152. data/fixtures/vcr_cassettes/lib/events/subscribe-member-add-async.yml +0 -77
  153. data/fixtures/vcr_cassettes/lib/events/subscribe-membership-add-async.yml +0 -77
  154. data/fixtures/vcr_cassettes/lib/events/subscribe-space-update-async.yml +0 -77
  155. data/fixtures/vcr_cassettes/lib/events/update_space.yml +0 -40
  156. data/fixtures/vcr_cassettes/lib/events/update_user.yml +0 -40
  157. data/lib/pubnub/events/get_members.rb +0 -93
  158. data/lib/pubnub/events/get_space.rb +0 -74
  159. data/lib/pubnub/events/get_space_memberships.rb +0 -93
  160. data/lib/pubnub/events/get_spaces.rb +0 -90
  161. data/lib/pubnub/events/get_user.rb +0 -74
  162. data/lib/pubnub/events/get_users.rb +0 -90
  163. data/lib/pubnub/events/manage_memberships.rb +0 -105
  164. data/lib/pubnub/events/update_user.rb +0 -86
  165. data/lib/pubnub/validators/create_space.rb +0 -44
  166. data/lib/pubnub/validators/create_user.rb +0 -44
  167. data/lib/pubnub/validators/delete_space.rb +0 -32
  168. data/lib/pubnub/validators/delete_user.rb +0 -32
  169. data/lib/pubnub/validators/get_members.rb +0 -32
  170. data/lib/pubnub/validators/get_space.rb +0 -32
  171. data/lib/pubnub/validators/get_space_memberships.rb +0 -32
  172. data/lib/pubnub/validators/get_spaces.rb +0 -16
  173. data/lib/pubnub/validators/get_user.rb +0 -32
  174. data/lib/pubnub/validators/get_users.rb +0 -16
  175. data/lib/pubnub/validators/manage_members.rb +0 -45
  176. data/lib/pubnub/validators/manage_memberships.rb +0 -45
  177. data/lib/pubnub/validators/push.rb +0 -43
  178. data/lib/pubnub/validators/update_space.rb +0 -45
  179. data/lib/pubnub/validators/update_user.rb +0 -45
  180. data/spec/examples/revoke_examples_spec.rb +0 -71950
  181. data/spec/examples/subscribe_examples_spec.rb +0 -45184
  182. data/spec/lib/events/space_spec.rb +0 -75
  183. data/spec/lib/events/user_spec.rb +0 -75
@@ -18,6 +18,91 @@ describe Pubnub::History do
18
18
  example.run_with_retry retry: 10
19
19
  end
20
20
 
21
+ it "__channel___demo___count__10___start__nil___end__nil___reverse__false___http_sync__true___callback__nil___include_meta__true_" do
22
+ VCR.use_cassette("examples/history/100", :record => :none) do
23
+ envelope = @pubnub.history(channel: :rubytest, include_meta: true, http_sync: true)
24
+ expect(envelope.is_a?(Pubnub::Envelope)).to eq true
25
+ expect(envelope.error?).to eq false
26
+
27
+ expect(envelope.status[:code]).to eq(200)
28
+ expect(envelope.status[:category]).to eq(:ack)
29
+ 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"})
30
+
31
+ expect(envelope.result[:code]).to eq(200)
32
+ expect(envelope.result[:operation]).to eq(:history)
33
+ expect(envelope.result[:data]).to eq({:messages => [{"message" => {"message"=>"text"}, "meta" => {"metaKey"=>"metaValue"}, "timetoken" => 15965666789169854}], :end => 15965666789169854, :start => 15965666789169854})
34
+ end
35
+ end
36
+
37
+ it "__channel___demo___count__10___start__nil___end__nil___reverse__false___http_sync__true___callback__nil___encrypted__true_" do
38
+ @pubnub = Pubnub.new(
39
+ publish_key: "pub-a-mock-key",
40
+ subscribe_key: "sub-a-mock-key",
41
+ uuid: "ruby-test-uuid-client-one",
42
+ auth_key: "ruby-test-auth-client-one",
43
+ cipher_key: "super-secret-cipher-key",
44
+ )
45
+ VCR.use_cassette("examples/history/no_includes__encrypted", :record => :none) do
46
+ envelope = @pubnub.history(channel: :rubytest, count: 10, http_sync: true)
47
+ expect(envelope.is_a?(Pubnub::Envelope)).to eq true
48
+ expect(envelope.error?).to eq false
49
+
50
+ expect(envelope.status[:code]).to eq(200)
51
+ expect(envelope.status[:category]).to eq(:ack)
52
+ 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"})
53
+
54
+ expect(envelope.result[:code]).to eq(200)
55
+ expect(envelope.result[:operation]).to eq(:history)
56
+ expect(envelope.result[:data]).to eq({:messages => [100], :end => 15965666789169854, :start => 15965666789169854})
57
+ end
58
+ end
59
+
60
+ it "__channel___demo___count__10___start__nil___end__nil___reverse__false___http_sync__true___callback__nil___include_meta__true___encrypted__true_" do
61
+ @pubnub = Pubnub.new(
62
+ publish_key: "pub-a-mock-key",
63
+ subscribe_key: "sub-a-mock-key",
64
+ uuid: "ruby-test-uuid-client-one",
65
+ auth_key: "ruby-test-auth-client-one",
66
+ cipher_key: "super-secret-cipher-key",
67
+ )
68
+ VCR.use_cassette("examples/history/include_meta__encrypted", :record => :none) do
69
+ envelope = @pubnub.history(channel: :rubytest, count: 10, include_meta: true, http_sync: true)
70
+ expect(envelope.is_a?(Pubnub::Envelope)).to eq true
71
+ expect(envelope.error?).to eq false
72
+
73
+ expect(envelope.status[:code]).to eq(200)
74
+ expect(envelope.status[:category]).to eq(:ack)
75
+ 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"})
76
+
77
+ expect(envelope.result[:code]).to eq(200)
78
+ expect(envelope.result[:operation]).to eq(:history)
79
+ expect(envelope.result[:data]).to eq({:messages => [{"message" => 100, "meta" => "", "timetoken" => 15965666789169854}], :end => 15965666789169854, :start => 15965666789169854})
80
+ end
81
+ end
82
+
83
+ it "__channel___demo___count__10___start__nil___end__nil___reverse__false___http_sync__true___callback__nil___include_token__true___encrypted__true_" do
84
+ @pubnub = Pubnub.new(
85
+ publish_key: "pub-a-mock-key",
86
+ subscribe_key: "sub-a-mock-key",
87
+ uuid: "ruby-test-uuid-client-one",
88
+ auth_key: "ruby-test-auth-client-one",
89
+ cipher_key: "super-secret-cipher-key",
90
+ )
91
+ VCR.use_cassette("examples/history/include_token__encrypted", :record => :none) do
92
+ envelope = @pubnub.history(channel: :rubytest, count: 10, include_token: true, http_sync: true)
93
+ expect(envelope.is_a?(Pubnub::Envelope)).to eq true
94
+ expect(envelope.error?).to eq false
95
+
96
+ expect(envelope.status[:code]).to eq(200)
97
+ expect(envelope.status[:category]).to eq(:ack)
98
+ 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"})
99
+
100
+ expect(envelope.result[:code]).to eq(200)
101
+ expect(envelope.result[:operation]).to eq(:history)
102
+ expect(envelope.result[:data]).to eq({:messages => [{"message" => 100, "timetoken" => 15965666789169854}], :end => 15965666789169854, :start => 15965666789169854})
103
+ end
104
+ end
105
+
21
106
  it "__channel___demo___count__10___start__nil___end__nil___reverse__true___http_sync__true___callback__nil_" do
22
107
  VCR.use_cassette("examples/history/53", record: :none) do
23
108
  envelope = @pubnub.history(channel: :demo, count: 10, reverse: true, http_sync: true)
@@ -0,0 +1,164 @@
1
+ require "spec_helper"
2
+
3
+ describe Pubnub::ListPushProvisions 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
+ subscribe_key: 'sub-a-mock-key',
13
+ uuid: "ruby-test-uuid-client-one",
14
+ auth_key: "ruby-test-auth-client-one"
15
+ )
16
+
17
+ @device_token = '815ee724ccb0a6a84dc303be8ccbaa00d1c84dde6bcae6721b08f92100951113'
18
+
19
+ example.run_with_retry retry: 1
20
+ end
21
+
22
+ it "001_push_gateway___apns___push_token__valid___http_sync__true___callback__nil_" do
23
+ VCR.use_cassette("examples/list_push_provisions/001", record: :once) do
24
+ envelope = @pubnub.list_push_provisions(push_token: @device_token, push_gateway: 'apns', http_sync: true)
25
+
26
+ expect(envelope.is_a?(Pubnub::Envelope)).to eq true
27
+ expect(envelope.error?).to eq false
28
+
29
+ expect(envelope.status[:code]).to eq(200)
30
+ expect(envelope.status[:operation]).to eq(:list_push_provisions)
31
+ expect(envelope.status[:category]).to eq(:ack)
32
+ 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"})
33
+
34
+ expect(envelope.result[:code]).to eq(200)
35
+ expect(envelope.result[:operation]).to eq(:list_push_provisions)
36
+ end
37
+ end
38
+
39
+ it "001_push_gateway___apns___push_token__valid___http_sync__true___callback___block_" do
40
+ VCR.use_cassette("examples/list_push_provisions/001", record: :once) do
41
+ envelope = @pubnub.list_push_provisions(push_token: @device_token, push_gateway: 'apns', http_sync: true, &@callback)
42
+
43
+ expect(@fired).to eq true
44
+ expect(envelope.is_a?(Pubnub::Envelope)).to eq true
45
+ expect(envelope.error?).to eq false
46
+
47
+ expect(envelope.status[:code]).to eq(200)
48
+ expect(envelope.status[:operation]).to eq(:list_push_provisions)
49
+ expect(envelope.status[:category]).to eq(:ack)
50
+ 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"})
51
+
52
+ expect(envelope.result[:code]).to eq(200)
53
+ expect(envelope.result[:operation]).to eq(:list_push_provisions)
54
+ end
55
+ end
56
+
57
+ it "001_push_gateway___apns___push_token__valid___http_sync__true___callback___lambda_" do
58
+ VCR.use_cassette("examples/list_push_provisions/001", record: :once) do
59
+ envelope = @pubnub.list_push_provisions(push_token: @device_token, push_gateway: 'apns', http_sync: true, callback: @callback)
60
+
61
+ expect(@fired).to eq true
62
+ expect(envelope.is_a?(Pubnub::Envelope)).to eq true
63
+ expect(envelope.error?).to eq false
64
+
65
+ expect(envelope.status[:code]).to eq(200)
66
+ expect(envelope.status[:operation]).to eq(:list_push_provisions)
67
+ expect(envelope.status[:category]).to eq(:ack)
68
+ 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"})
69
+
70
+ expect(envelope.result[:code]).to eq(200)
71
+ expect(envelope.result[:operation]).to eq(:list_push_provisions)
72
+ end
73
+ end
74
+
75
+ it "001_push_gateway___apns___push_token__valid___http_sync__false___callback__nil_" do
76
+ VCR.use_cassette("examples/list_push_provisions/001", record: :once) do
77
+ envelope = @pubnub.list_push_provisions(push_token: @device_token, push_gateway: 'apns', http_sync: false)
78
+ envelope = envelope.value
79
+
80
+ expect(envelope.is_a?(Pubnub::Envelope)).to eq true
81
+ expect(envelope.error?).to eq false
82
+
83
+ expect(envelope.status[:code]).to eq(200)
84
+ expect(envelope.status[:operation]).to eq(:list_push_provisions)
85
+ expect(envelope.status[:category]).to eq(:ack)
86
+ 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"})
87
+
88
+ expect(envelope.result[:code]).to eq(200)
89
+ expect(envelope.result[:operation]).to eq(:list_push_provisions)
90
+ end
91
+ end
92
+
93
+ it "001_push_gateway___apns___push_token__valid___http_sync__false___callback___block_" do
94
+ VCR.use_cassette("examples/list_push_provisions/001", record: :once) do
95
+ envelope = @pubnub.list_push_provisions(push_token: @device_token, push_gateway: 'apns', http_sync: false, &@callback)
96
+ envelope = envelope.value
97
+
98
+ expect(@fired).to eq true
99
+ expect(envelope.is_a?(Pubnub::Envelope)).to eq true
100
+ expect(envelope.error?).to eq false
101
+
102
+ expect(envelope.status[:code]).to eq(200)
103
+ expect(envelope.status[:operation]).to eq(:list_push_provisions)
104
+ expect(envelope.status[:category]).to eq(:ack)
105
+ 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"})
106
+
107
+ expect(envelope.result[:code]).to eq(200)
108
+ expect(envelope.result[:operation]).to eq(:list_push_provisions)
109
+ end
110
+ end
111
+
112
+ it "001_push_gateway___apns___push_token__valid___http_sync__false___callback___lambda_" do
113
+ VCR.use_cassette("examples/list_push_provisions/001", record: :once) do
114
+ envelope = @pubnub.list_push_provisions(push_token: @device_token, push_gateway: 'apns', http_sync: false, callback: @callback)
115
+ envelope = envelope.value
116
+
117
+ expect(@fired).to eq true
118
+ expect(envelope.is_a?(Pubnub::Envelope)).to eq true
119
+ expect(envelope.error?).to eq false
120
+
121
+ expect(envelope.status[:code]).to eq(200)
122
+ expect(envelope.status[:operation]).to eq(:list_push_provisions)
123
+ expect(envelope.status[:category]).to eq(:ack)
124
+ 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"})
125
+
126
+ expect(envelope.result[:code]).to eq(200)
127
+ expect(envelope.result[:operation]).to eq(:list_push_provisions)
128
+ end
129
+ end
130
+
131
+ it "002_push_gateway___apns2___push_token__valid___topic__ruby_test___environment__default___http_sync__true___callback__nil_" do
132
+ VCR.use_cassette("examples/list_push_provisions/002", record: :once) do
133
+ envelope = @pubnub.list_push_provisions(push_token: @device_token, push_gateway: 'apns2', topic: 'ruby_test', http_sync: true)
134
+
135
+ expect(envelope.is_a?(Pubnub::Envelope)).to eq true
136
+ expect(envelope.error?).to eq false
137
+
138
+ expect(envelope.status[:code]).to eq(200)
139
+ expect(envelope.status[:operation]).to eq(:list_push_provisions)
140
+ expect(envelope.status[:category]).to eq(:ack)
141
+ 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"})
142
+
143
+ expect(envelope.result[:code]).to eq(200)
144
+ expect(envelope.result[:operation]).to eq(:list_push_provisions)
145
+ end
146
+ end
147
+
148
+ it "003_push_gateway___apns2___push_token__valid___topic__ruby_test___environment__production___http_sync__true___callback__nil_" do
149
+ VCR.use_cassette("examples/list_push_provisions/003", record: :once) do
150
+ envelope = @pubnub.list_push_provisions(push_token: @device_token, push_gateway: 'apns2', topic: 'ruby_test', environment: 'production', http_sync: true)
151
+
152
+ expect(envelope.is_a?(Pubnub::Envelope)).to eq true
153
+ expect(envelope.error?).to eq false
154
+
155
+ expect(envelope.status[:code]).to eq(200)
156
+ expect(envelope.status[:operation]).to eq(:list_push_provisions)
157
+ expect(envelope.status[:category]).to eq(:ack)
158
+ 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"})
159
+
160
+ expect(envelope.result[:code]).to eq(200)
161
+ expect(envelope.result[:operation]).to eq(:list_push_provisions)
162
+ end
163
+ end
164
+ end
@@ -110,14 +110,17 @@ describe Pubnub::Presence do
110
110
  end
111
111
 
112
112
  eventually do
113
- expect(@status_envelopes[0].status[:category]).to eq(:timeout)
114
- expect(@status_envelopes[0].status[:error]).to eq(true)
115
- expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
116
- expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
117
- expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
118
- expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres"])
119
- expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
120
- 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"})
113
+ if @status_envelopes.length > 0
114
+ expect(@status_envelopes[0].status[:category]).to eq(:timeout)
115
+ expect(@status_envelopes[0].status[:error]).to eq(true)
116
+ expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
117
+ expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
118
+ expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
119
+ expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres"])
120
+ expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
121
+ 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"})
122
+ true
123
+ end
121
124
  end
122
125
  end
123
126
 
@@ -137,23 +140,26 @@ describe Pubnub::Presence do
137
140
  end
138
141
 
139
142
  eventually do
140
- expect(@status_envelopes[0].status[:category]).to eq(:timeout)
141
- expect(@status_envelopes[0].status[:error]).to eq(true)
142
- expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
143
- expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
144
- expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
145
- expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres"])
146
- expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
147
- 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"})
148
-
149
- expect(@status_envelopes[1].status[:category]).to eq(:timeout)
150
- expect(@status_envelopes[1].status[:error]).to eq(true)
151
- expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
152
- expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
153
- expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
154
- expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo-pnpres"])
155
- expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
156
- expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
143
+ if @status_envelopes.length >= 1
144
+ expect(@status_envelopes[0].status[:category]).to eq(:timeout)
145
+ expect(@status_envelopes[0].status[:error]).to eq(true)
146
+ expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
147
+ expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
148
+ expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
149
+ expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres"])
150
+ expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
151
+ 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"})
152
+
153
+ expect(@status_envelopes[1].status[:category]).to eq(:timeout)
154
+ expect(@status_envelopes[1].status[:error]).to eq(true)
155
+ expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
156
+ expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
157
+ expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
158
+ expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo-pnpres"])
159
+ expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
160
+ expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
161
+ true
162
+ end
157
163
  end
158
164
  end
159
165
 
@@ -173,23 +179,26 @@ describe Pubnub::Presence do
173
179
  end
174
180
 
175
181
  eventually do
176
- expect(@status_envelopes[0].status[:category]).to eq(:timeout)
177
- expect(@status_envelopes[0].status[:error]).to eq(true)
178
- expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
179
- expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
180
- expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
181
- expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres"])
182
- expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
183
- 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"})
184
-
185
- expect(@status_envelopes[1].status[:category]).to eq(:timeout)
186
- expect(@status_envelopes[1].status[:error]).to eq(true)
187
- expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
188
- expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
189
- expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
190
- expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo-pnpres"])
191
- expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
192
- expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
182
+ if @status_envelopes.length >= 1
183
+ expect(@status_envelopes[0].status[:category]).to eq(:timeout)
184
+ expect(@status_envelopes[0].status[:error]).to eq(true)
185
+ expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
186
+ expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
187
+ expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
188
+ expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres"])
189
+ expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
190
+ 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"})
191
+
192
+ expect(@status_envelopes[1].status[:category]).to eq(:timeout)
193
+ expect(@status_envelopes[1].status[:error]).to eq(true)
194
+ expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
195
+ expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
196
+ expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
197
+ expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo-pnpres"])
198
+ expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
199
+ expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
200
+ true
201
+ end
193
202
  end
194
203
  end
195
204
 
@@ -284,14 +293,17 @@ describe Pubnub::Presence do
284
293
  end
285
294
 
286
295
  eventually do
287
- expect(@status_envelopes[0].status[:category]).to eq(:timeout)
288
- expect(@status_envelopes[0].status[:error]).to eq(true)
289
- expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
290
- expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
291
- expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
292
- expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo.*-pnpres"])
293
- expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
294
- 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"})
296
+ if @status_envelopes.length > 0
297
+ expect(@status_envelopes[0].status[:category]).to eq(:timeout)
298
+ expect(@status_envelopes[0].status[:error]).to eq(true)
299
+ expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
300
+ expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
301
+ expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
302
+ expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo.*-pnpres"])
303
+ expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
304
+ 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"})
305
+ true
306
+ end
295
307
  end
296
308
  end
297
309
 
@@ -311,23 +323,26 @@ describe Pubnub::Presence do
311
323
  end
312
324
 
313
325
  eventually do
314
- expect(@status_envelopes[0].status[:category]).to eq(:timeout)
315
- expect(@status_envelopes[0].status[:error]).to eq(true)
316
- expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
317
- expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
318
- expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
319
- expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo.*-pnpres"])
320
- expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
321
- 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"})
322
-
323
- expect(@status_envelopes[1].status[:category]).to eq(:timeout)
324
- expect(@status_envelopes[1].status[:error]).to eq(true)
325
- expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
326
- expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
327
- expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
328
- expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo.*-pnpres"])
329
- expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
330
- expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
326
+ if @status_envelopes.length >= 1
327
+ expect(@status_envelopes[0].status[:category]).to eq(:timeout)
328
+ expect(@status_envelopes[0].status[:error]).to eq(true)
329
+ expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
330
+ expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
331
+ expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
332
+ expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo.*-pnpres"])
333
+ expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
334
+ 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"})
335
+
336
+ expect(@status_envelopes[1].status[:category]).to eq(:timeout)
337
+ expect(@status_envelopes[1].status[:error]).to eq(true)
338
+ expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
339
+ expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
340
+ expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
341
+ expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo.*-pnpres"])
342
+ expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
343
+ expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
344
+ true
345
+ end
331
346
  end
332
347
  end
333
348
 
@@ -347,23 +362,26 @@ describe Pubnub::Presence do
347
362
  end
348
363
 
349
364
  eventually do
350
- expect(@status_envelopes[0].status[:category]).to eq(:timeout)
351
- expect(@status_envelopes[0].status[:error]).to eq(true)
352
- expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
353
- expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
354
- expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
355
- expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo.*-pnpres"])
356
- expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
357
- 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"})
358
-
359
- expect(@status_envelopes[1].status[:category]).to eq(:timeout)
360
- expect(@status_envelopes[1].status[:error]).to eq(true)
361
- expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
362
- expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
363
- expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
364
- expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo.*-pnpres"])
365
- expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
366
- expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
365
+ if @status_envelopes.length >= 1
366
+ expect(@status_envelopes[0].status[:category]).to eq(:timeout)
367
+ expect(@status_envelopes[0].status[:error]).to eq(true)
368
+ expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
369
+ expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
370
+ expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
371
+ expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo.*-pnpres"])
372
+ expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
373
+ 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"})
374
+
375
+ expect(@status_envelopes[1].status[:category]).to eq(:timeout)
376
+ expect(@status_envelopes[1].status[:error]).to eq(true)
377
+ expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
378
+ expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
379
+ expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
380
+ expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo.*-pnpres"])
381
+ expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
382
+ expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
383
+ true
384
+ end
367
385
  end
368
386
  end
369
387
 
@@ -458,14 +476,17 @@ describe Pubnub::Presence do
458
476
  end
459
477
 
460
478
  eventually do
461
- expect(@status_envelopes[0].status[:category]).to eq(:timeout)
462
- expect(@status_envelopes[0].status[:error]).to eq(true)
463
- expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
464
- expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
465
- expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
466
- expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres"])
467
- expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
468
- 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"})
479
+ if @status_envelopes.length > 0
480
+ expect(@status_envelopes[0].status[:category]).to eq(:timeout)
481
+ expect(@status_envelopes[0].status[:error]).to eq(true)
482
+ expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
483
+ expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
484
+ expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
485
+ expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres"])
486
+ expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
487
+ 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"})
488
+ true
489
+ end
469
490
  end
470
491
  end
471
492
 
@@ -485,23 +506,26 @@ describe Pubnub::Presence do
485
506
  end
486
507
 
487
508
  eventually do
488
- expect(@status_envelopes[0].status[:category]).to eq(:timeout)
489
- expect(@status_envelopes[0].status[:error]).to eq(true)
490
- expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
491
- expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
492
- expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
493
- expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres"])
494
- expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
495
- 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"})
496
-
497
- expect(@status_envelopes[1].status[:category]).to eq(:timeout)
498
- expect(@status_envelopes[1].status[:error]).to eq(true)
499
- expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
500
- expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
501
- expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
502
- expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo-pnpres"])
503
- expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
504
- expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
509
+ if @status_envelopes.length >= 1
510
+ expect(@status_envelopes[0].status[:category]).to eq(:timeout)
511
+ expect(@status_envelopes[0].status[:error]).to eq(true)
512
+ expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
513
+ expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
514
+ expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
515
+ expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres"])
516
+ expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
517
+ 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"})
518
+
519
+ expect(@status_envelopes[1].status[:category]).to eq(:timeout)
520
+ expect(@status_envelopes[1].status[:error]).to eq(true)
521
+ expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
522
+ expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
523
+ expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
524
+ expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo-pnpres"])
525
+ expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
526
+ expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
527
+ true
528
+ end
505
529
  end
506
530
  end
507
531
 
@@ -521,23 +545,26 @@ describe Pubnub::Presence do
521
545
  end
522
546
 
523
547
  eventually do
524
- expect(@status_envelopes[0].status[:category]).to eq(:timeout)
525
- expect(@status_envelopes[0].status[:error]).to eq(true)
526
- expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
527
- expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
528
- expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
529
- expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres"])
530
- expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
531
- 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"})
532
-
533
- expect(@status_envelopes[1].status[:category]).to eq(:timeout)
534
- expect(@status_envelopes[1].status[:error]).to eq(true)
535
- expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
536
- expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
537
- expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
538
- expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo-pnpres"])
539
- expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
540
- expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
548
+ if @status_envelopes.length >= 1
549
+ expect(@status_envelopes[0].status[:category]).to eq(:timeout)
550
+ expect(@status_envelopes[0].status[:error]).to eq(true)
551
+ expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
552
+ expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
553
+ expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
554
+ expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres"])
555
+ expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
556
+ 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"})
557
+
558
+ expect(@status_envelopes[1].status[:category]).to eq(:timeout)
559
+ expect(@status_envelopes[1].status[:error]).to eq(true)
560
+ expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
561
+ expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
562
+ expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
563
+ expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo-pnpres"])
564
+ expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
565
+ expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
566
+ true
567
+ end
541
568
  end
542
569
  end
543
570
 
@@ -632,14 +659,17 @@ describe Pubnub::Presence do
632
659
  end
633
660
 
634
661
  eventually do
635
- expect(@status_envelopes[0].status[:category]).to eq(:timeout)
636
- expect(@status_envelopes[0].status[:error]).to eq(true)
637
- expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
638
- expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
639
- expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
640
- expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
641
- expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
642
- 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"})
662
+ if @status_envelopes.length > 0
663
+ expect(@status_envelopes[0].status[:category]).to eq(:timeout)
664
+ expect(@status_envelopes[0].status[:error]).to eq(true)
665
+ expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
666
+ expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
667
+ expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
668
+ expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
669
+ expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
670
+ 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"})
671
+ true
672
+ end
643
673
  end
644
674
  end
645
675
 
@@ -659,32 +689,35 @@ describe Pubnub::Presence do
659
689
  end
660
690
 
661
691
  eventually do
662
- expect(@status_envelopes[0].status[:category]).to eq(:timeout)
663
- expect(@status_envelopes[0].status[:error]).to eq(true)
664
- expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
665
- expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
666
- expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
667
- expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
668
- expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
669
- 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"})
670
-
671
- expect(@status_envelopes[1].status[:category]).to eq(:timeout)
672
- expect(@status_envelopes[1].status[:error]).to eq(true)
673
- expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
674
- expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
675
- expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
676
- expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
677
- expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
678
- expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
679
-
680
- expect(@status_envelopes[2].status[:category]).to eq(:timeout)
681
- expect(@status_envelopes[2].status[:error]).to eq(true)
682
- expect(@status_envelopes[2].status[:auto_retried]).to eq(true)
683
- expect(@status_envelopes[2].status[:current_timetoken]).to eq(0)
684
- expect(@status_envelopes[2].status[:last_timetoken]).to eq(0)
685
- expect(@status_envelopes[2].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
686
- expect(@status_envelopes[2].status[:subscribed_channel_groups]).to eq([])
687
- expect(@status_envelopes[2].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
692
+ if @status_envelopes.length >= 3
693
+ expect(@status_envelopes[0].status[:category]).to eq(:timeout)
694
+ expect(@status_envelopes[0].status[:error]).to eq(true)
695
+ expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
696
+ expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
697
+ expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
698
+ expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
699
+ expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
700
+ 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"})
701
+
702
+ expect(@status_envelopes[1].status[:category]).to eq(:timeout)
703
+ expect(@status_envelopes[1].status[:error]).to eq(true)
704
+ expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
705
+ expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
706
+ expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
707
+ expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
708
+ expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
709
+ expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
710
+
711
+ expect(@status_envelopes[2].status[:category]).to eq(:timeout)
712
+ expect(@status_envelopes[2].status[:error]).to eq(true)
713
+ expect(@status_envelopes[2].status[:auto_retried]).to eq(true)
714
+ expect(@status_envelopes[2].status[:current_timetoken]).to eq(0)
715
+ expect(@status_envelopes[2].status[:last_timetoken]).to eq(0)
716
+ expect(@status_envelopes[2].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
717
+ expect(@status_envelopes[2].status[:subscribed_channel_groups]).to eq([])
718
+ expect(@status_envelopes[2].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
719
+ true
720
+ end
688
721
  end
689
722
  end
690
723
 
@@ -704,32 +737,35 @@ describe Pubnub::Presence do
704
737
  end
705
738
 
706
739
  eventually do
707
- expect(@status_envelopes[0].status[:category]).to eq(:timeout)
708
- expect(@status_envelopes[0].status[:error]).to eq(true)
709
- expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
710
- expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
711
- expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
712
- expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
713
- expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
714
- 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"})
715
-
716
- expect(@status_envelopes[1].status[:category]).to eq(:timeout)
717
- expect(@status_envelopes[1].status[:error]).to eq(true)
718
- expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
719
- expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
720
- expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
721
- expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
722
- expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
723
- expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
724
-
725
- expect(@status_envelopes[2].status[:category]).to eq(:timeout)
726
- expect(@status_envelopes[2].status[:error]).to eq(true)
727
- expect(@status_envelopes[2].status[:auto_retried]).to eq(true)
728
- expect(@status_envelopes[2].status[:current_timetoken]).to eq(0)
729
- expect(@status_envelopes[2].status[:last_timetoken]).to eq(0)
730
- expect(@status_envelopes[2].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
731
- expect(@status_envelopes[2].status[:subscribed_channel_groups]).to eq([])
732
- expect(@status_envelopes[2].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
740
+ if @status_envelopes.length >= 3
741
+ expect(@status_envelopes[0].status[:category]).to eq(:timeout)
742
+ expect(@status_envelopes[0].status[:error]).to eq(true)
743
+ expect(@status_envelopes[0].status[:auto_retried]).to eq(true)
744
+ expect(@status_envelopes[0].status[:current_timetoken]).to eq(0)
745
+ expect(@status_envelopes[0].status[:last_timetoken]).to eq(0)
746
+ expect(@status_envelopes[0].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
747
+ expect(@status_envelopes[0].status[:subscribed_channel_groups]).to eq([])
748
+ 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"})
749
+
750
+ expect(@status_envelopes[1].status[:category]).to eq(:timeout)
751
+ expect(@status_envelopes[1].status[:error]).to eq(true)
752
+ expect(@status_envelopes[1].status[:auto_retried]).to eq(true)
753
+ expect(@status_envelopes[1].status[:current_timetoken]).to eq(0)
754
+ expect(@status_envelopes[1].status[:last_timetoken]).to eq(0)
755
+ expect(@status_envelopes[1].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
756
+ expect(@status_envelopes[1].status[:subscribed_channel_groups]).to eq([])
757
+ expect(@status_envelopes[1].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
758
+
759
+ expect(@status_envelopes[2].status[:category]).to eq(:timeout)
760
+ expect(@status_envelopes[2].status[:error]).to eq(true)
761
+ expect(@status_envelopes[2].status[:auto_retried]).to eq(true)
762
+ expect(@status_envelopes[2].status[:current_timetoken]).to eq(0)
763
+ expect(@status_envelopes[2].status[:last_timetoken]).to eq(0)
764
+ expect(@status_envelopes[2].status[:subscribed_channels]).to eq(["demo-pnpres", "demo.*-pnpres"])
765
+ expect(@status_envelopes[2].status[:subscribed_channel_groups]).to eq([])
766
+ expect(@status_envelopes[2].status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"})
767
+ true
768
+ end
733
769
  end
734
770
  end
735
771
  end