pubnub 3.5.1 → 3.5.3

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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +6 -0
  3. data/README.md +11 -0
  4. data/VERSION +1 -1
  5. data/examples/demo_console.rb +0 -1
  6. data/fixtures/vcr_cassettes/auth_key_flow_auth_publish.yml +45 -0
  7. data/fixtures/vcr_cassettes/auth_key_flow_empty_auth_audit.yml +44 -0
  8. data/fixtures/vcr_cassettes/auth_key_flow_instead_auth_audit.yml +44 -0
  9. data/fixtures/vcr_cassettes/auth_key_flow_no_auth_publish.yml +45 -0
  10. data/fixtures/vcr_cassettes/auth_key_flow_non_auth_audit.yml +44 -0
  11. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-array.yml +2 -2
  12. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-hash.yml +2 -2
  13. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-integer.yml +2 -2
  14. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-mix.yml +2 -2
  15. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-multi-mix.yml +2 -2
  16. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-string.yml +2 -2
  17. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-one-channel-array.yml +2 -2
  18. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-one-channel-hash.yml +2 -2
  19. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-one-channel-integer.yml +2 -2
  20. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-one-channel-mix.yml +2 -2
  21. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-one-channel-string.yml +2 -2
  22. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-many-channels-array.yml +2 -2
  23. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-many-channels-hash.yml +2 -2
  24. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-many-channels-integer.yml +2 -2
  25. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-many-channels-mix.yml +2 -2
  26. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-many-channels-multi-mix.yml +2 -2
  27. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-many-channels-string.yml +2 -2
  28. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-one-channel-array.yml +2 -2
  29. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-one-channel-hash.yml +2 -2
  30. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-one-channel-integer.yml +2 -2
  31. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-one-channel-mix.yml +2 -2
  32. data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-one-channel-string.yml +2 -2
  33. data/fixtures/vcr_cassettes/heartbeat-non200.yml +519 -0
  34. data/fixtures/vcr_cassettes/heartbeat-test.yml +91 -0
  35. data/fixtures/vcr_cassettes/heartbeated-subscribe.yml +136 -0
  36. data/fixtures/vcr_cassettes/here_now_global-nonssl-block-invalid-200-sync.yml +49 -0
  37. data/fixtures/vcr_cassettes/here_now_global-nonssl-block-invalid-non-200-sync.yml +49 -0
  38. data/fixtures/vcr_cassettes/here_now_global-nonssl-block-valid-200-sync.yml +49 -0
  39. data/fixtures/vcr_cassettes/here_now_global-nonssl-block-valid-non-200-sync.yml +49 -0
  40. data/fixtures/vcr_cassettes/here_now_global-nonssl-parameter-invalid-200-sync.yml +49 -0
  41. data/fixtures/vcr_cassettes/here_now_global-nonssl-parameter-invalid-non-200-sync.yml +49 -0
  42. data/fixtures/vcr_cassettes/here_now_global-nonssl-parameter-valid-200-sync.yml +49 -0
  43. data/fixtures/vcr_cassettes/here_now_global-nonssl-parameter-valid-non-200-sync.yml +49 -0
  44. data/fixtures/vcr_cassettes/here_now_global-ssl-block-invalid-200-sync.yml +49 -0
  45. data/fixtures/vcr_cassettes/here_now_global-ssl-block-invalid-non-200-sync.yml +49 -0
  46. data/fixtures/vcr_cassettes/here_now_global-ssl-block-valid-200-async.yml +49 -0
  47. data/fixtures/vcr_cassettes/here_now_global-ssl-block-valid-200-sync.yml +49 -0
  48. data/fixtures/vcr_cassettes/here_now_global-ssl-block-valid-non-200-sync.yml +49 -0
  49. data/fixtures/vcr_cassettes/here_now_global-ssl-parameter-invalid-200-sync.yml +49 -0
  50. data/fixtures/vcr_cassettes/here_now_global-ssl-parameter-invalid-non-200-sync.yml +49 -0
  51. data/fixtures/vcr_cassettes/here_now_global-ssl-parameter-valid-200-sync.yml +49 -0
  52. data/fixtures/vcr_cassettes/here_now_global-ssl-parameter-valid-non-200-sync.yml +49 -0
  53. data/fixtures/vcr_cassettes/new_ones/multiplexed_subscribe.yml +854 -0
  54. data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-array-of-hashes.yml +1 -1
  55. data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-200-invalid.yml +1 -1
  56. data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-200-valid.yml +1 -1
  57. data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-non200-invalid.yml +1 -1
  58. data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-non200-valid.yml +1 -1
  59. data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-https-200-invalid.yml +1 -1
  60. data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-https-200-valid.yml +1 -1
  61. data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-https-non200-invalid.yml +1 -1
  62. data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-https-non200-valid.yml +1 -1
  63. data/fixtures/vcr_cassettes/new_ones/publish/publish-http-200-invalid.yml +1 -1
  64. data/fixtures/vcr_cassettes/new_ones/publish/publish-http-200-valid.yml +1 -1
  65. data/fixtures/vcr_cassettes/new_ones/publish/publish-http-non200-invalid.yml +1 -1
  66. data/fixtures/vcr_cassettes/new_ones/publish/publish-http-non200-valid.yml +1 -1
  67. data/fixtures/vcr_cassettes/new_ones/publish/publish-https-200-invalid.yml +1 -1
  68. data/fixtures/vcr_cassettes/new_ones/publish/publish-https-200-valid.yml +1 -1
  69. data/fixtures/vcr_cassettes/new_ones/publish/publish-https-non200-invalid.yml +1 -1
  70. data/fixtures/vcr_cassettes/new_ones/publish/publish-https-non200-valid.yml +1 -1
  71. data/fixtures/vcr_cassettes/new_ones/publish/publish-plain-array-of-hashes.yml +1 -1
  72. data/fixtures/vcr_cassettes/non-heartbeated-subscribe.yml +44 -0
  73. data/fixtures/vcr_cassettes/pam20.yml +1 -1
  74. data/fixtures/vcr_cassettes/single-event-invalid-json.yml +15 -138
  75. data/fixtures/vcr_cassettes/v3-presence-nonssl-block-invalid-200-async.yml +86 -0
  76. data/fixtures/vcr_cassettes/v3-presence-nonssl-block-invalid-200-sync.yml +86 -0
  77. data/fixtures/vcr_cassettes/v3-presence-nonssl-block-invalid-non-200-async.yml +86 -0
  78. data/fixtures/vcr_cassettes/v3-presence-nonssl-block-invalid-non-200-sync.yml +86 -0
  79. data/fixtures/vcr_cassettes/v3-presence-nonssl-block-valid-200-async.yml +86 -0
  80. data/fixtures/vcr_cassettes/v3-presence-nonssl-block-valid-200-sync.yml +86 -0
  81. data/fixtures/vcr_cassettes/v3-presence-nonssl-block-valid-non-200-async.yml +86 -0
  82. data/fixtures/vcr_cassettes/v3-presence-nonssl-block-valid-non-200-sync.yml +86 -0
  83. data/fixtures/vcr_cassettes/v3-presence-nonssl-parameter-invalid-200-async.yml +86 -0
  84. data/fixtures/vcr_cassettes/v3-presence-nonssl-parameter-invalid-200-sync.yml +86 -0
  85. data/fixtures/vcr_cassettes/v3-presence-nonssl-parameter-invalid-non-200-async.yml +86 -0
  86. data/fixtures/vcr_cassettes/v3-presence-nonssl-parameter-invalid-non-200-sync.yml +86 -0
  87. data/fixtures/vcr_cassettes/v3-presence-nonssl-parameter-valid-200-async.yml +86 -0
  88. data/fixtures/vcr_cassettes/v3-presence-nonssl-parameter-valid-200-sync.yml +86 -0
  89. data/fixtures/vcr_cassettes/v3-presence-nonssl-parameter-valid-non-200-async.yml +86 -0
  90. data/fixtures/vcr_cassettes/v3-presence-nonssl-parameter-valid-non-200-sync.yml +86 -0
  91. data/fixtures/vcr_cassettes/v3-presence-ssl-block-invalid-200-async.yml +86 -0
  92. data/fixtures/vcr_cassettes/v3-presence-ssl-block-invalid-200-sync.yml +86 -0
  93. data/fixtures/vcr_cassettes/v3-presence-ssl-block-invalid-non-200-async.yml +86 -0
  94. data/fixtures/vcr_cassettes/v3-presence-ssl-block-invalid-non-200-sync.yml +86 -0
  95. data/fixtures/vcr_cassettes/v3-presence-ssl-block-valid-200-async.yml +86 -0
  96. data/fixtures/vcr_cassettes/v3-presence-ssl-block-valid-200-sync.yml +86 -0
  97. data/fixtures/vcr_cassettes/v3-presence-ssl-block-valid-non-200-async.yml +86 -0
  98. data/fixtures/vcr_cassettes/v3-presence-ssl-block-valid-non-200-sync.yml +86 -0
  99. data/fixtures/vcr_cassettes/v3-presence-ssl-parameter-invalid-200-async.yml +86 -0
  100. data/fixtures/vcr_cassettes/v3-presence-ssl-parameter-invalid-200-sync.yml +86 -0
  101. data/fixtures/vcr_cassettes/v3-presence-ssl-parameter-invalid-non-200-async.yml +86 -0
  102. data/fixtures/vcr_cassettes/v3-presence-ssl-parameter-invalid-non-200-sync.yml +86 -0
  103. data/fixtures/vcr_cassettes/v3-presence-ssl-parameter-valid-200-async.yml +86 -0
  104. data/fixtures/vcr_cassettes/v3-presence-ssl-parameter-valid-200-sync.yml +86 -0
  105. data/fixtures/vcr_cassettes/v3-presence-ssl-parameter-valid-non-200-async.yml +86 -0
  106. data/fixtures/vcr_cassettes/v3-presence-ssl-parameter-valid-non-200-sync.yml +86 -0
  107. data/lib/pubnub/client.rb +57 -31
  108. data/lib/pubnub/crypto.rb +6 -6
  109. data/lib/pubnub/event.rb +64 -45
  110. data/lib/pubnub/events/heartbeat.rb +59 -0
  111. data/lib/pubnub/events/here_now.rb +19 -10
  112. data/lib/pubnub/events/leave.rb +17 -9
  113. data/lib/pubnub/exceptions.rb +1 -1
  114. data/lib/pubnub/formatter.rb +1 -0
  115. data/lib/pubnub/pam.rb +5 -0
  116. data/lib/version.rb +1 -1
  117. data/pubnub.gemspec +2 -2
  118. data/spec/lib/auth_key_flow_spec.rb +60 -0
  119. data/spec/lib/heartbeat_spec.rb +110 -0
  120. data/spec/lib/integration/global_here_now_spec.rb +541 -0
  121. data/spec/lib/integration/multiplexed_subscribe_flow_spec.rb +44 -0
  122. data/spec/lib/integration/publish_spec.rb +1699 -373
  123. data/spec/lib/integration/publish_spec_old.rb +541 -0
  124. data/spec/lib/integration/v3_presence_spec.rb +557 -0
  125. metadata +68 -4
  126. data/examples/demo_console.rb~ +0 -307
  127. data/spec/lib/new_integration/publish_spec.rb +0 -1867
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubnub
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.1
4
+ version: 3.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - PubNub
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-15 00:00:00.000000000 Z
11
+ date: 2014-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -65,7 +65,6 @@ files:
65
65
  - Rakefile
66
66
  - VERSION
67
67
  - examples/demo_console.rb
68
- - examples/demo_console.rb~
69
68
  - examples/error_server.rb
70
69
  - examples/pubnub_livestream/.gitignore
71
70
  - examples/pubnub_livestream/Gemfile
@@ -197,6 +196,11 @@ files:
197
196
  - fixtures/vcr_cassettes/audit-ssl-parameter-valid-200-sync.yml
198
197
  - fixtures/vcr_cassettes/audit-ssl-parameter-valid-non-200-async.yml
199
198
  - fixtures/vcr_cassettes/audit-ssl-parameter-valid-non-200-sync.yml
199
+ - fixtures/vcr_cassettes/auth_key_flow_auth_publish.yml
200
+ - fixtures/vcr_cassettes/auth_key_flow_empty_auth_audit.yml
201
+ - fixtures/vcr_cassettes/auth_key_flow_instead_auth_audit.yml
202
+ - fixtures/vcr_cassettes/auth_key_flow_no_auth_publish.yml
203
+ - fixtures/vcr_cassettes/auth_key_flow_non_auth_audit.yml
200
204
  - fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-array.yml
201
205
  - fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-hash.yml
202
206
  - fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-integer.yml
@@ -251,6 +255,9 @@ files:
251
255
  - fixtures/vcr_cassettes/grant-ssl-parameter-valid-200-sync.yml
252
256
  - fixtures/vcr_cassettes/grant-ssl-parameter-valid-non-200-async.yml
253
257
  - fixtures/vcr_cassettes/grant-ssl-parameter-valid-non-200-sync.yml
258
+ - fixtures/vcr_cassettes/heartbeat-non200.yml
259
+ - fixtures/vcr_cassettes/heartbeat-test.yml
260
+ - fixtures/vcr_cassettes/heartbeated-subscribe.yml
254
261
  - fixtures/vcr_cassettes/here_now-nonssl-block-invalid-200-async.yml
255
262
  - fixtures/vcr_cassettes/here_now-nonssl-block-invalid-200-sync.yml
256
263
  - fixtures/vcr_cassettes/here_now-nonssl-block-invalid-non-200-async.yml
@@ -283,6 +290,23 @@ files:
283
290
  - fixtures/vcr_cassettes/here_now-ssl-parameter-valid-200-sync.yml
284
291
  - fixtures/vcr_cassettes/here_now-ssl-parameter-valid-non-200-async.yml
285
292
  - fixtures/vcr_cassettes/here_now-ssl-parameter-valid-non-200-sync.yml
293
+ - fixtures/vcr_cassettes/here_now_global-nonssl-block-invalid-200-sync.yml
294
+ - fixtures/vcr_cassettes/here_now_global-nonssl-block-invalid-non-200-sync.yml
295
+ - fixtures/vcr_cassettes/here_now_global-nonssl-block-valid-200-sync.yml
296
+ - fixtures/vcr_cassettes/here_now_global-nonssl-block-valid-non-200-sync.yml
297
+ - fixtures/vcr_cassettes/here_now_global-nonssl-parameter-invalid-200-sync.yml
298
+ - fixtures/vcr_cassettes/here_now_global-nonssl-parameter-invalid-non-200-sync.yml
299
+ - fixtures/vcr_cassettes/here_now_global-nonssl-parameter-valid-200-sync.yml
300
+ - fixtures/vcr_cassettes/here_now_global-nonssl-parameter-valid-non-200-sync.yml
301
+ - fixtures/vcr_cassettes/here_now_global-ssl-block-invalid-200-sync.yml
302
+ - fixtures/vcr_cassettes/here_now_global-ssl-block-invalid-non-200-sync.yml
303
+ - fixtures/vcr_cassettes/here_now_global-ssl-block-valid-200-async.yml
304
+ - fixtures/vcr_cassettes/here_now_global-ssl-block-valid-200-sync.yml
305
+ - fixtures/vcr_cassettes/here_now_global-ssl-block-valid-non-200-sync.yml
306
+ - fixtures/vcr_cassettes/here_now_global-ssl-parameter-invalid-200-sync.yml
307
+ - fixtures/vcr_cassettes/here_now_global-ssl-parameter-invalid-non-200-sync.yml
308
+ - fixtures/vcr_cassettes/here_now_global-ssl-parameter-valid-200-sync.yml
309
+ - fixtures/vcr_cassettes/here_now_global-ssl-parameter-valid-non-200-sync.yml
286
310
  - fixtures/vcr_cassettes/history-nonssl-block-invalid-200-async.yml
287
311
  - fixtures/vcr_cassettes/history-nonssl-block-invalid-200-sync.yml
288
312
  - fixtures/vcr_cassettes/history-nonssl-block-invalid-non-200-async.yml
@@ -347,6 +371,7 @@ files:
347
371
  - fixtures/vcr_cassettes/leave-ssl-parameter-valid-200-sync.yml
348
372
  - fixtures/vcr_cassettes/leave-ssl-parameter-valid-non-200-async.yml
349
373
  - fixtures/vcr_cassettes/leave-ssl-parameter-valid-non-200-sync.yml
374
+ - fixtures/vcr_cassettes/new_ones/multiplexed_subscribe.yml
350
375
  - fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-array-of-hashes.yml
351
376
  - fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-200-invalid.yml
352
377
  - fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-200-valid.yml
@@ -381,6 +406,7 @@ files:
381
406
  - fixtures/vcr_cassettes/new_ones/publish/publish-https-non200-invalid.yml
382
407
  - fixtures/vcr_cassettes/new_ones/publish/publish-https-non200-valid.yml
383
408
  - fixtures/vcr_cassettes/new_ones/publish/publish-plain-array-of-hashes.yml
409
+ - fixtures/vcr_cassettes/non-heartbeated-subscribe.yml
384
410
  - fixtures/vcr_cassettes/pam1.yml
385
411
  - fixtures/vcr_cassettes/pam10.yml
386
412
  - fixtures/vcr_cassettes/pam11.yml
@@ -561,6 +587,38 @@ files:
561
587
  - fixtures/vcr_cassettes/time-ssl-parameter-valid-200-sync.yml
562
588
  - fixtures/vcr_cassettes/time-ssl-parameter-valid-non-200-async.yml
563
589
  - fixtures/vcr_cassettes/time-ssl-parameter-valid-non-200-sync.yml
590
+ - fixtures/vcr_cassettes/v3-presence-nonssl-block-invalid-200-async.yml
591
+ - fixtures/vcr_cassettes/v3-presence-nonssl-block-invalid-200-sync.yml
592
+ - fixtures/vcr_cassettes/v3-presence-nonssl-block-invalid-non-200-async.yml
593
+ - fixtures/vcr_cassettes/v3-presence-nonssl-block-invalid-non-200-sync.yml
594
+ - fixtures/vcr_cassettes/v3-presence-nonssl-block-valid-200-async.yml
595
+ - fixtures/vcr_cassettes/v3-presence-nonssl-block-valid-200-sync.yml
596
+ - fixtures/vcr_cassettes/v3-presence-nonssl-block-valid-non-200-async.yml
597
+ - fixtures/vcr_cassettes/v3-presence-nonssl-block-valid-non-200-sync.yml
598
+ - fixtures/vcr_cassettes/v3-presence-nonssl-parameter-invalid-200-async.yml
599
+ - fixtures/vcr_cassettes/v3-presence-nonssl-parameter-invalid-200-sync.yml
600
+ - fixtures/vcr_cassettes/v3-presence-nonssl-parameter-invalid-non-200-async.yml
601
+ - fixtures/vcr_cassettes/v3-presence-nonssl-parameter-invalid-non-200-sync.yml
602
+ - fixtures/vcr_cassettes/v3-presence-nonssl-parameter-valid-200-async.yml
603
+ - fixtures/vcr_cassettes/v3-presence-nonssl-parameter-valid-200-sync.yml
604
+ - fixtures/vcr_cassettes/v3-presence-nonssl-parameter-valid-non-200-async.yml
605
+ - fixtures/vcr_cassettes/v3-presence-nonssl-parameter-valid-non-200-sync.yml
606
+ - fixtures/vcr_cassettes/v3-presence-ssl-block-invalid-200-async.yml
607
+ - fixtures/vcr_cassettes/v3-presence-ssl-block-invalid-200-sync.yml
608
+ - fixtures/vcr_cassettes/v3-presence-ssl-block-invalid-non-200-async.yml
609
+ - fixtures/vcr_cassettes/v3-presence-ssl-block-invalid-non-200-sync.yml
610
+ - fixtures/vcr_cassettes/v3-presence-ssl-block-valid-200-async.yml
611
+ - fixtures/vcr_cassettes/v3-presence-ssl-block-valid-200-sync.yml
612
+ - fixtures/vcr_cassettes/v3-presence-ssl-block-valid-non-200-async.yml
613
+ - fixtures/vcr_cassettes/v3-presence-ssl-block-valid-non-200-sync.yml
614
+ - fixtures/vcr_cassettes/v3-presence-ssl-parameter-invalid-200-async.yml
615
+ - fixtures/vcr_cassettes/v3-presence-ssl-parameter-invalid-200-sync.yml
616
+ - fixtures/vcr_cassettes/v3-presence-ssl-parameter-invalid-non-200-async.yml
617
+ - fixtures/vcr_cassettes/v3-presence-ssl-parameter-invalid-non-200-sync.yml
618
+ - fixtures/vcr_cassettes/v3-presence-ssl-parameter-valid-200-async.yml
619
+ - fixtures/vcr_cassettes/v3-presence-ssl-parameter-valid-200-sync.yml
620
+ - fixtures/vcr_cassettes/v3-presence-ssl-parameter-valid-non-200-async.yml
621
+ - fixtures/vcr_cassettes/v3-presence-ssl-parameter-valid-non-200-sync.yml
564
622
  - lib/pubnub.rb
565
623
  - lib/pubnub/client.rb
566
624
  - lib/pubnub/configuration.rb
@@ -569,6 +627,7 @@ files:
569
627
  - lib/pubnub/event.rb
570
628
  - lib/pubnub/events/audit.rb
571
629
  - lib/pubnub/events/grant.rb
630
+ - lib/pubnub/events/heartbeat.rb
572
631
  - lib/pubnub/events/here_now.rb
573
632
  - lib/pubnub/events/history.rb
574
633
  - lib/pubnub/events/leave.rb
@@ -585,20 +644,25 @@ files:
585
644
  - lib/pubnub/validator.rb
586
645
  - lib/version.rb
587
646
  - pubnub.gemspec
647
+ - spec/lib/auth_key_flow_spec.rb
588
648
  - spec/lib/client_spec.rb
589
649
  - spec/lib/encoder_spec.rb
590
650
  - spec/lib/formatting_envelope_spec.rb
651
+ - spec/lib/heartbeat_spec.rb
591
652
  - spec/lib/integration/audit_spec.rb
653
+ - spec/lib/integration/global_here_now_spec.rb
592
654
  - spec/lib/integration/grant_spec.rb
593
655
  - spec/lib/integration/here_now_spec.rb
594
656
  - spec/lib/integration/history_spec.rb
595
657
  - spec/lib/integration/leave_spec.rb
658
+ - spec/lib/integration/multiplexed_subscribe_flow_spec.rb
596
659
  - spec/lib/integration/presence_spec.rb
597
660
  - spec/lib/integration/publish_spec.rb
661
+ - spec/lib/integration/publish_spec_old.rb
598
662
  - spec/lib/integration/revoke_spec.rb
599
663
  - spec/lib/integration/subscribe_spec.rb
600
664
  - spec/lib/integration/time_spec.rb
601
- - spec/lib/new_integration/publish_spec.rb
665
+ - spec/lib/integration/v3_presence_spec.rb
602
666
  - spec/lib/retry_logic_spec.rb
603
667
  - spec/spec_helper.rb
604
668
  - spec/tools/pam-test-generator.rb
@@ -1,307 +0,0 @@
1
- require 'pubnub'
2
-
3
- puts 'Provide origin [demo.pubnub.com]:'
4
- origin = gets.chomp!
5
- origin = 'demo.pubnub.com' if origin.blank?
6
- puts 'Provide subscribe key [demo]:'
7
- sub_key = gets.chomp!
8
- sub_key = 'demo' if sub_key.blank?
9
-
10
- puts 'Provide publish key [demo]:'
11
- pub_key = gets.chomp!
12
- pub_key = 'demo' if pub_key.blank?
13
-
14
- puts 'Provide secret key (optional):'
15
- sec_key = gets.chomp!
16
- sec_key = nil if sec_key.blank?
17
-
18
- p = Pubnub.new(
19
- :subscribe_key => sub_key,
20
- :secret_key => sec_key,
21
- :publish_key => pub_key,
22
- :origin => origin,
23
- :error_callback => lambda { |msg|
24
- puts "SOMETHING TERRIBLE HAPPENED HERE: #{msg.inspect}"
25
- },
26
- :connect_callback => lambda { |msg|
27
- puts "CONNECTED: #{msg.inspect}"
28
- }
29
- )
30
-
31
- default_cb = lambda { |envelope|
32
- puts "\nchannel: #{envelope.channel}"
33
- puts "msg: #{envelope.message}"
34
- puts "payload: #{envelope.payload}" if envelope.payload
35
- }
36
-
37
- while(true)
38
-
39
- ssl = false
40
- while !%w(Y N).include? ssl
41
- puts('Should next operation be ssl [y/N]?')
42
- ssl = gets.chomp!
43
- ssl = 'N' if ssl.blank?
44
- end
45
-
46
- sync_or_async = false
47
- while !%w(S A).include? sync_or_async
48
- puts('Should next operation be [S]ync or [A]sync?')
49
- sync_or_async = gets.chomp!
50
- end
51
-
52
- block_or_parameter = false
53
- while !%w(B P).include? block_or_parameter
54
- puts('Do you want pass callback as [B]lock or [P]arameter?')
55
- block_or_parameter = gets.chomp!
56
- end
57
-
58
- puts('1. subscribe')
59
- puts('2. unsubscribe (leave)')
60
- puts('3. publish')
61
- puts('4. history')
62
- puts('5. presence')
63
- puts('6. here_now')
64
- puts('7. time')
65
- puts('8. audit')
66
- puts('9. grant')
67
- puts('10. revoke')
68
- puts("\n\n")
69
- puts('Enter a selection')
70
- choice = gets.chomp!
71
-
72
- case choice
73
- when '1' #SUBSCRIBE
74
-
75
- puts('Enter channel')
76
- channel = gets.chomp!
77
-
78
- if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
79
- p.subscribe(:channel => channel, :callback => default_cb, :http_sync => false, :ssl => ssl)
80
- elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
81
- p.subscribe(:channel => channel, :http_sync => false, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
82
- elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
83
- p.subscribe(:channel => channel, :callback => default_cb, :http_sync => true, :ssl => ssl)
84
- elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
85
- p.subscribe(:channel => channel, :http_sync => true, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
86
- end
87
-
88
-
89
- when '2' #UNSUBSCRIBE
90
-
91
- puts('Enter channel')
92
- channel = gets.chomp!
93
-
94
- if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
95
- p.unsubscribe(:channel => channel, :callback => default_cb, :http_sync => false, :ssl => ssl)
96
- elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
97
- p.unsubscribe(:channel => channel, :http_sync => false, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
98
- elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
99
- p.unsubscribe(:channel => channel, :callback => default_cb, :http_sync => true, :ssl => ssl)
100
- elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
101
- p.unsubscribe(:channel => channel, :http_sync => true, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
102
- end
103
-
104
- when '3' #PUBLISH
105
-
106
- puts('Enter channel')
107
- channel = gets.chomp!
108
-
109
- puts('Enter message')
110
- message = gets.chomp!
111
-
112
- if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
113
- p.publish(:message => message, :channel => channel, :callback => default_cb, :http_sync => false, :ssl => ssl)
114
- elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
115
- p.publish(:message => message, :channel => channel, :http_sync => false, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
116
- elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
117
- p.publish(:message => message, :channel => channel, :callback => default_cb, :http_sync => true, :ssl => ssl)
118
- elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
119
- p.publish(:message => message, :channel => channel, :http_sync => true, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
120
- end
121
-
122
- when '4' #HISTORY
123
- puts('Enter channel')
124
- channel = gets.chomp!
125
-
126
- puts('Enter count')
127
- count = gets.chomp!
128
- if (count == '') then count = nil end
129
-
130
- puts('Enter start')
131
- history_start = gets.chomp!
132
- if (history_start == '') then history_start = nil end
133
-
134
- puts('Enter end')
135
- history_end = gets.chomp!
136
- if (history_end == '') then history_end = nil end
137
-
138
- puts('Enter reverse (y/n)')
139
- reverse = gets.chomp!
140
- if (reverse == "" || reverse == "n") then reverse = false else reverse = true end
141
-
142
- if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
143
- p.history(:channel => channel,
144
- :count => count,
145
- :start => history_start,
146
- :end => history_end,
147
- :reverse => reverse,
148
- :callback => default_cb,
149
- :http_sync => false,
150
- :ssl => ssl) do |envelope| puts(envelope.inspect) end
151
- elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
152
- p.history(:channel => channel,
153
- :count => count,
154
- :start => history_start,
155
- :end => history_end,
156
- :reverse => reverse,
157
- :http_sync => false,
158
- :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
159
- elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
160
- p.history(:channel => channel,
161
- :count => count,
162
- :start => history_start,
163
- :end => history_end,
164
- :reverse => reverse,
165
- :callback => default_cb,
166
- :http_sync => true,
167
- :ssl => ssl) do |envelope| puts(envelope.inspect) end
168
- elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
169
- p.history(:channel => channel,
170
- :count => count,
171
- :start => history_start,
172
- :end => history_end,
173
- :reverse => true,
174
- :http_sync => false,
175
- :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
176
- end
177
-
178
- when '5' #PRESENCE
179
- puts('Enter channel')
180
- channel = gets.chomp!
181
-
182
- if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
183
- p.presence(:channel => channel, :callback => default_cb, :http_sync => false, :ssl => ssl)
184
- elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
185
- p.presence(:channel => channel, :http_sync => false, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
186
- elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
187
- p.presence(:channel => channel, :callback => default_cb, :http_sync => true, :ssl => ssl)
188
- elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
189
- p.presence(:channel => channel, :http_sync => true, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
190
- end
191
-
192
- when '6' #HERE_NOW
193
- puts('Enter channel')
194
- channel = gets.chomp!
195
-
196
- if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
197
- p.here_now(:channel => channel, :callback => default_cb, :http_sync => false, :ssl => ssl)
198
- elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
199
- p.here_now(:channel => channel, :http_sync => false, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
200
- elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
201
- p.here_now(:channel => channel, :callback => default_cb, :http_sync => true, :ssl => ssl)
202
- elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
203
- p.here_now(:channel => channel, :http_sync => true, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
204
- end
205
-
206
-
207
- when '7' #TIME
208
- if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
209
- p.time(:callback => default_cb, :http_sync => false, :ssl => ssl)
210
- elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
211
- p.time(:http_sync => false, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
212
- elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
213
- p.time(:callback => default_cb, :http_sync => true, :ssl => ssl)
214
- elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
215
- p.time(:http_sync => true, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
216
- end
217
-
218
- when '8' # AUDIT
219
- puts 'Enter channel for channel level'
220
- channel = gets.chomp!
221
- channel = nil if channel.blank?
222
-
223
- puts 'Enter auth key'
224
- auth_key = gets.chomp!
225
- auth_key = nil if auth_key.blank?
226
-
227
- if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
228
- p.audit(:callback => default_cb, :http_sync => false, :ssl => ssl, :channel => channel, :auth_key => auth_key)
229
- elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
230
- p.audit(:http_sync => false, :ssl => ssl, :channel => channel, :auth_key => auth_key){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
231
- elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
232
- p.audit(:callback => default_cb, :http_sync => true, :ssl => ssl, :channel => channel, :auth_key => auth_key)
233
- elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
234
- p.audit(:http_sync => true, :ssl => ssl, :channel => channel, :auth_key => auth_key){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
235
- end
236
-
237
- when '9' # GRANT
238
- puts 'Enter channel for channel level'
239
- channel = gets.chomp!
240
- channel = nil if channel.blank?
241
-
242
- puts 'Enter auth key'
243
- auth_key = gets.chomp!
244
- auth_key = nil if auth_key.blank?
245
-
246
- read = nil
247
- while !%w(1 0).include? read
248
- puts 'Read? [0/1]'
249
- read = gets.chomp!
250
- end
251
-
252
- write = nil
253
- while !%w(1 0).include? write
254
- puts 'Write? [0/1]'
255
- write = gets.chomp!
256
- end
257
-
258
- puts 'TTL [3600]:'
259
- ttl = gets.chomp!
260
- ttl = 3600 if ttl.blank?
261
-
262
- if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
263
- p.grant(:callback => default_cb, :http_sync => false, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key)
264
- elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
265
- p.grant(:http_sync => false, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
266
- elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
267
- p.grant(:callback => default_cb, :http_sync => true, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key)
268
- elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
269
- p.grant(:http_sync => true, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
270
- end
271
-
272
- when '10' # REVOKE
273
- puts 'Enter channel for channel level'
274
- channel = gets.chomp!
275
- channel = nil if channel.blank?
276
-
277
- puts 'Enter auth key'
278
- auth_key = gets.chomp!
279
- auth_key = nil if auth_key.blank?
280
-
281
- read = nil
282
- while !%w(1 0).include? read
283
- puts 'Revoke read? [0/1]'
284
- read = gets.chomp!
285
- end
286
-
287
- write = nil
288
- while !%w(1 0).include? write
289
- puts 'Revoke write? [0/1]'
290
- write = gets.chomp!
291
- end
292
-
293
- puts 'TTL [3600]:'
294
- ttl = gets.chomp!
295
- ttl = 3600 if ttl.blank?
296
-
297
- if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
298
- p.revoke(:callback => default_cb, :http_sync => false, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key)
299
- elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
300
- p.revoke(:http_sync => false, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
301
- elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
302
- p.revoke(:callback => default_cb, :http_sync => true, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key)
303
- elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
304
- p.revoke(:http_sync => true, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
305
- end
306
- end
307
- end