pubnub 3.4.1 → 3.5.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pubnub might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG +5 -3
- data/README.md +267 -41
- data/VERSION +1 -1
- data/examples/demo_console.rb +191 -32
- data/examples/demo_console.rb~ +307 -0
- data/examples/pubnub_livestream/Gemfile +1 -1
- data/examples/pubnub_livestream/Gemfile.lock +43 -74
- data/examples/serial_publish.rb +2 -6
- data/fixtures/vcr_cassettes/audit-nonssl-block-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/audit-nonssl-block-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/audit-nonssl-block-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/audit-nonssl-block-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/audit-nonssl-block-valid-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/audit-nonssl-block-valid-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/audit-nonssl-block-valid-non-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/audit-nonssl-block-valid-non-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/audit-nonssl-parameter-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/audit-nonssl-parameter-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/audit-nonssl-parameter-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/audit-nonssl-parameter-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/audit-nonssl-parameter-valid-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/audit-nonssl-parameter-valid-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/audit-nonssl-parameter-valid-non-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/audit-nonssl-parameter-valid-non-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/audit-ssl-block-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/audit-ssl-block-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/audit-ssl-block-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/audit-ssl-block-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/audit-ssl-block-valid-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/audit-ssl-block-valid-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/audit-ssl-block-valid-non-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/audit-ssl-block-valid-non-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/audit-ssl-parameter-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/audit-ssl-parameter-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/audit-ssl-parameter-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/audit-ssl-parameter-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/audit-ssl-parameter-valid-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/audit-ssl-parameter-valid-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/audit-ssl-parameter-valid-non-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/audit-ssl-parameter-valid-non-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-array.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-hash.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-integer.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-mix.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-multi-mix.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-many-channels-string.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-one-channel-array.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-one-channel-hash.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-one-channel-integer.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-one-channel-mix.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-cipherkey-one-channel-string.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-many-channels-array.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-many-channels-hash.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-many-channels-integer.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-many-channels-mix.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-many-channels-multi-mix.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-many-channels-string.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-one-channel-array.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-one-channel-hash.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-one-channel-integer.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-one-channel-mix.yml +89 -0
- data/fixtures/vcr_cassettes/formatting-envelope-subscribe-without-cipherkey-one-channel-string.yml +89 -0
- data/fixtures/vcr_cassettes/grant-nonssl-block-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/grant-nonssl-block-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/grant-nonssl-block-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/grant-nonssl-block-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/grant-nonssl-block-valid-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/grant-nonssl-block-valid-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/grant-nonssl-block-valid-non-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/grant-nonssl-block-valid-non-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/grant-nonssl-parameter-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/grant-nonssl-parameter-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/grant-nonssl-parameter-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/grant-nonssl-parameter-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/grant-nonssl-parameter-valid-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/grant-nonssl-parameter-valid-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/grant-nonssl-parameter-valid-non-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/grant-nonssl-parameter-valid-non-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/grant-ssl-block-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/grant-ssl-block-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/grant-ssl-block-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/grant-ssl-block-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/grant-ssl-block-valid-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/grant-ssl-block-valid-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/grant-ssl-block-valid-non-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/grant-ssl-block-valid-non-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/grant-ssl-parameter-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/grant-ssl-parameter-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/grant-ssl-parameter-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/grant-ssl-parameter-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/grant-ssl-parameter-valid-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/grant-ssl-parameter-valid-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/grant-ssl-parameter-valid-non-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/grant-ssl-parameter-valid-non-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-block-invalid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-block-invalid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-block-invalid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-block-invalid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-block-valid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-block-valid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-block-valid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-block-valid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-parameter-invalid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-parameter-invalid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-parameter-invalid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-parameter-invalid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-parameter-valid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-parameter-valid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-parameter-valid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-nonssl-parameter-valid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-block-invalid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-block-invalid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-block-invalid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-block-invalid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-block-valid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-block-valid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-block-valid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-block-valid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-parameter-invalid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-parameter-invalid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-parameter-invalid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-parameter-invalid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-parameter-valid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-parameter-valid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-parameter-valid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/here_now-ssl-parameter-valid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-block-invalid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-block-invalid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-block-invalid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-block-invalid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-block-valid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-block-valid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-block-valid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-block-valid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-parameter-invalid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-parameter-invalid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-parameter-invalid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-parameter-invalid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-parameter-valid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-parameter-valid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-parameter-valid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-nonssl-parameter-valid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-block-invalid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-block-invalid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-block-invalid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-block-invalid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-block-valid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-block-valid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-block-valid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-block-valid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-parameter-invalid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-parameter-invalid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-parameter-invalid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-parameter-invalid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-parameter-valid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-parameter-valid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-parameter-valid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/history-ssl-parameter-valid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-block-invalid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-block-invalid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-block-invalid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-block-invalid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-block-valid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-block-valid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-block-valid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-block-valid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-parameter-invalid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-parameter-invalid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-parameter-invalid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-parameter-invalid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-parameter-valid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-parameter-valid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-parameter-valid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-nonssl-parameter-valid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-block-invalid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-block-invalid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-block-invalid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-block-invalid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-block-valid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-block-valid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-block-valid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-block-valid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-parameter-invalid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-parameter-invalid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-parameter-invalid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-parameter-invalid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-parameter-valid-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-parameter-valid-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-parameter-valid-non-200-async.yml +48 -0
- data/fixtures/vcr_cassettes/leave-ssl-parameter-valid-non-200-sync.yml +48 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-array-of-hashes.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-auth_key-200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-auth_key-200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-auth_key-non200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-auth_key-non200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-non200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-http-non200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-https-200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-https-200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-https-auth_key-200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-https-auth_key-200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-https-auth_key-non200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-https-auth_key-non200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-https-non200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-encrypted-https-non200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-http-200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-http-200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-http-auth_key-200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-http-auth_key-200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-http-auth_key-non200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-http-auth_key-non200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-http-non200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-http-non200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-https-200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-https-200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-https-auth_key-200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-https-auth_key-200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-https-auth_key-non200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-https-auth_key-non200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-https-non200-invalid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-https-non200-valid.yml +42 -0
- data/fixtures/vcr_cassettes/new_ones/publish/publish-plain-array-of-hashes.yml +42 -0
- data/fixtures/vcr_cassettes/pam1.yml +35 -0
- data/fixtures/vcr_cassettes/pam10.yml +35 -0
- data/fixtures/vcr_cassettes/pam11.yml +35 -0
- data/fixtures/vcr_cassettes/pam12.yml +35 -0
- data/fixtures/vcr_cassettes/pam13.yml +35 -0
- data/fixtures/vcr_cassettes/pam14.yml +35 -0
- data/fixtures/vcr_cassettes/pam15.yml +35 -0
- data/fixtures/vcr_cassettes/pam17.yml +35 -0
- data/fixtures/vcr_cassettes/pam2.yml +35 -0
- data/fixtures/vcr_cassettes/pam20.yml +35 -0
- data/fixtures/vcr_cassettes/pam21.yml +35 -0
- data/fixtures/vcr_cassettes/pam22.yml +97 -0
- data/fixtures/vcr_cassettes/pam4.yml +35 -0
- data/fixtures/vcr_cassettes/pam5.yml +66 -0
- data/fixtures/vcr_cassettes/pam6.yml +96 -0
- data/fixtures/vcr_cassettes/presence-nonssl-block-invalid-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/presence-nonssl-block-invalid-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/presence-nonssl-block-invalid-non-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/presence-nonssl-block-invalid-non-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/presence-nonssl-block-valid-200-async.yml +87 -0
- data/fixtures/vcr_cassettes/presence-nonssl-block-valid-200-sync.yml +87 -0
- data/fixtures/vcr_cassettes/presence-nonssl-block-valid-non-200-async.yml +87 -0
- data/fixtures/vcr_cassettes/presence-nonssl-block-valid-non-200-sync.yml +87 -0
- data/fixtures/vcr_cassettes/presence-nonssl-parameter-invalid-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/presence-nonssl-parameter-invalid-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/presence-nonssl-parameter-invalid-non-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/presence-nonssl-parameter-invalid-non-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/presence-nonssl-parameter-valid-200-async.yml +87 -0
- data/fixtures/vcr_cassettes/presence-nonssl-parameter-valid-200-sync.yml +87 -0
- data/fixtures/vcr_cassettes/presence-nonssl-parameter-valid-non-200-async.yml +87 -0
- data/fixtures/vcr_cassettes/presence-nonssl-parameter-valid-non-200-sync.yml +87 -0
- data/fixtures/vcr_cassettes/presence-ssl-block-invalid-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/presence-ssl-block-invalid-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/presence-ssl-block-invalid-non-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/presence-ssl-block-invalid-non-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/presence-ssl-block-valid-200-async.yml +87 -0
- data/fixtures/vcr_cassettes/presence-ssl-block-valid-200-sync-new.yml +81 -0
- data/fixtures/vcr_cassettes/presence-ssl-block-valid-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/presence-ssl-block-valid-non-200-async.yml +87 -0
- data/fixtures/vcr_cassettes/presence-ssl-block-valid-non-200-sync.yml +87 -0
- data/fixtures/vcr_cassettes/presence-ssl-parameter-invalid-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/presence-ssl-parameter-invalid-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/presence-ssl-parameter-invalid-non-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/presence-ssl-parameter-invalid-non-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/presence-ssl-parameter-valid-200-async.yml +87 -0
- data/fixtures/vcr_cassettes/presence-ssl-parameter-valid-200-sync.yml +87 -0
- data/fixtures/vcr_cassettes/presence-ssl-parameter-valid-non-200-async.yml +87 -0
- data/fixtures/vcr_cassettes/presence-ssl-parameter-valid-non-200-sync.yml +87 -0
- data/fixtures/vcr_cassettes/publish-nonssl-block-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-block-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-block-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-block-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-block-valid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-block-valid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-block-valid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-block-valid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-parameter-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-parameter-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-parameter-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-parameter-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-parameter-valid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-parameter-valid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-parameter-valid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-nonssl-parameter-valid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-block-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-block-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-block-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-block-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-block-valid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-block-valid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-block-valid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-block-valid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-parameter-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-parameter-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-parameter-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-parameter-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-parameter-valid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-parameter-valid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-parameter-valid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/publish-ssl-parameter-valid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-block-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-block-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-block-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-block-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-block-valid-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-block-valid-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-block-valid-non-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-block-valid-non-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-parameter-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-parameter-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-parameter-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-parameter-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-parameter-valid-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-parameter-valid-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-parameter-valid-non-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-nonssl-parameter-valid-non-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-ssl-block-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-ssl-block-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-ssl-block-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-ssl-block-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-ssl-block-valid-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-ssl-block-valid-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-ssl-block-valid-non-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-ssl-block-valid-non-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-ssl-parameter-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-ssl-parameter-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-ssl-parameter-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-ssl-parameter-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/revoke-ssl-parameter-valid-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-ssl-parameter-valid-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-ssl-parameter-valid-non-200-async.yml +45 -0
- data/fixtures/vcr_cassettes/revoke-ssl-parameter-valid-non-200-sync.yml +45 -0
- data/fixtures/vcr_cassettes/single-event-invalid-json.yml +208 -0
- data/fixtures/vcr_cassettes/single-event-non200.yml +44 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-block-invalid-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-block-invalid-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-block-invalid-non-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-block-invalid-non-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-block-valid-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-block-valid-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-block-valid-non-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-block-valid-non-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-parameter-invalid-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-parameter-invalid-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-parameter-invalid-non-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-parameter-invalid-non-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-parameter-valid-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-parameter-valid-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-parameter-valid-non-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-nonssl-parameter-valid-non-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-block-invalid-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-block-invalid-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-block-invalid-non-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-block-invalid-non-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-block-valid-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-block-valid-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-block-valid-non-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-block-valid-non-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-parameter-invalid-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-parameter-invalid-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-parameter-invalid-non-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-parameter-invalid-non-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-parameter-valid-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-parameter-valid-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-parameter-valid-non-200-async.yml +85 -0
- data/fixtures/vcr_cassettes/subscribe-ssl-parameter-valid-non-200-sync.yml +85 -0
- data/fixtures/vcr_cassettes/subscription-event-invalid-json.yml +454 -0
- data/fixtures/vcr_cassettes/subscription-event-non200.yml +208 -0
- data/fixtures/vcr_cassettes/time-nonssl-block-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-block-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-block-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-block-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-block-valid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-block-valid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-block-valid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-block-valid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-parameter-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-parameter-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-parameter-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-parameter-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-parameter-valid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-parameter-valid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-parameter-valid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-nonssl-parameter-valid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-block-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-block-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-block-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-block-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-block-valid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-block-valid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-block-valid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-block-valid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-parameter-invalid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-parameter-invalid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-parameter-invalid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-parameter-invalid-non-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-parameter-valid-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-parameter-valid-200-sync.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-parameter-valid-non-200-async.yml +44 -0
- data/fixtures/vcr_cassettes/time-ssl-parameter-valid-non-200-sync.yml +44 -0
- data/lib/pubnub.rb +7 -15
- data/lib/pubnub/client.rb +189 -468
- data/lib/pubnub/configuration.rb +27 -20
- data/lib/pubnub/crypto.rb +11 -4
- data/lib/pubnub/envelope.rb +45 -0
- data/lib/pubnub/event.rb +470 -0
- data/lib/pubnub/events/audit.rb +38 -0
- data/lib/pubnub/events/grant.rb +59 -0
- data/lib/pubnub/events/here_now.rb +55 -0
- data/lib/pubnub/events/history.rb +110 -0
- data/lib/pubnub/events/leave.rb +73 -0
- data/lib/pubnub/events/presence.rb +35 -0
- data/lib/pubnub/events/publish.rb +71 -0
- data/lib/pubnub/events/revoke.rb +56 -0
- data/lib/pubnub/events/subscribe.rb +34 -0
- data/lib/pubnub/events/time.rb +52 -0
- data/lib/pubnub/exceptions.rb +50 -0
- data/lib/pubnub/formatter.rb +45 -0
- data/lib/pubnub/pam.rb +59 -0
- data/lib/pubnub/parser.rb +21 -0
- data/lib/pubnub/validator.rb +29 -0
- data/lib/version.rb +3 -0
- data/pubnub.gemspec +3 -5
- data/spec/lib/client_spec.rb +27 -325
- data/spec/lib/encoder_spec.rb +51 -0
- data/spec/lib/formatting_envelope_spec.rb +304 -0
- data/spec/lib/integration/audit_spec.rb +544 -0
- data/spec/lib/integration/grant_spec.rb +544 -0
- data/spec/lib/integration/here_now_spec.rb +543 -0
- data/spec/lib/integration/history_spec.rb +541 -0
- data/spec/lib/integration/leave_spec.rb +540 -0
- data/spec/lib/integration/presence_spec.rb +557 -0
- data/spec/lib/integration/publish_spec.rb +541 -0
- data/spec/lib/integration/revoke_spec.rb +544 -0
- data/spec/lib/integration/subscribe_spec.rb +564 -0
- data/spec/lib/integration/time_spec.rb +541 -0
- data/spec/lib/new_integration/publish_spec.rb +1867 -0
- data/spec/lib/retry_logic_spec.rb +53 -0
- data/spec/spec_helper.rb +28 -2
- data/spec/tools/pam-test-generator.rb +367 -0
- data/spec/tools/test-generator.rb +310 -0
- metadata +434 -50
- data/.yardoc/checksums +0 -13
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/lib/pubnub/error.rb +0 -23
- data/lib/pubnub/request.rb +0 -288
- data/lib/pubnub/response.rb +0 -126
- data/lib/pubnub/subscription.rb +0 -24
- data/lib/pubnub/version.rb +0 -3
- data/lib/tasks/examples.rake +0 -39
- data/spec/lib/crypto_spec.rb +0 -89
- data/spec/lib/history_integration_spec.rb +0 -0
- data/spec/lib/presence_integration_spec.rb +0 -16
- data/spec/lib/publish_integration_spec.rb +0 -994
- data/spec/lib/pubnub_spec.rb +0 -12
- data/spec/lib/request_spec.rb +0 -151
- data/spec/lib/subscribe_integration_spec.rb +0 -944
- data/spec/lib/subscribe_timeout_spec.rb +0 -65
- data/spec/lib/time_integration_spec.rb +0 -0
data/spec/lib/pubnub_spec.rb
DELETED
data/spec/lib/request_spec.rb
DELETED
@@ -1,151 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'rr'
|
3
|
-
require 'vcr'
|
4
|
-
|
5
|
-
describe Pubnub::Request do
|
6
|
-
before do
|
7
|
-
@pubnub_request = Pubnub::Request.new(
|
8
|
-
:subscribe_key => 'subscribe_key',
|
9
|
-
:origin => 'pubsub.pubnub.com'
|
10
|
-
)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe 'origin' do
|
14
|
-
context 'port' do
|
15
|
-
it 'set port to 80 and http when ssl isn\'t set' do
|
16
|
-
@pubnub_request.ssl = false
|
17
|
-
@pubnub_request.port.should eq 80
|
18
|
-
@pubnub_request.origin[0..4].should eq 'http:'
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'set port to 443 and http when ssl isn\'t set' do
|
22
|
-
@pubnub_request.ssl = true
|
23
|
-
@pubnub_request.port.should eq 443
|
24
|
-
@pubnub_request.origin[0..4].should eq 'https'
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe 'created path' do
|
30
|
-
context 'when operation' do
|
31
|
-
context 'is publish' do
|
32
|
-
context 'and it\'s not encrypted' do
|
33
|
-
it 'is valid' do
|
34
|
-
@pubnub_request = Pubnub::Request.new(
|
35
|
-
:operation => 'publish',
|
36
|
-
:channel => 'channel',
|
37
|
-
:subscribe_key => 'subscribe_key',
|
38
|
-
:origin => 'pubsub.pubnub.com',
|
39
|
-
:publish_key => 'publish_key',
|
40
|
-
:message => 'test_message'
|
41
|
-
)
|
42
|
-
|
43
|
-
@pubnub_request.path.should eq '/publish/publish_key/subscribe_key/0/channel/0/%22test_message%22'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
context 'and it\'s encrypted' do
|
47
|
-
it 'is valid' do
|
48
|
-
@pubnub_request = Pubnub::Request.new(
|
49
|
-
:operation => 'publish',
|
50
|
-
:channel => 'channel',
|
51
|
-
:subscribe_key => 'subscribe_key',
|
52
|
-
:origin => 'pubsub.pubnub.com',
|
53
|
-
:publish_key => 'publish_key',
|
54
|
-
:message => 'test_message',
|
55
|
-
:cipher_key => 'so_secret_key'
|
56
|
-
)
|
57
|
-
|
58
|
-
@pubnub_request.path.should eq '/publish/publish_key/subscribe_key/0/channel/0/%22OfUPhgfENucj3lsbSef1qg==%22'
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context 'is subscribe' do
|
64
|
-
it 'is valid' do
|
65
|
-
@pubnub_request = Pubnub::Request.new(
|
66
|
-
:operation => 'subscribe',
|
67
|
-
:channel => 'channel',
|
68
|
-
:subscribe_key => 'subscribe_key',
|
69
|
-
:origin => 'pubsub.pubnub.com',
|
70
|
-
:publish_key => 'publish_key'
|
71
|
-
)
|
72
|
-
|
73
|
-
@pubnub_request.path.should eq '/subscribe/subscribe_key/channel/0/0'
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
context 'is history' do
|
78
|
-
it 'is valid' do
|
79
|
-
@pubnub_request = Pubnub::Request.new(
|
80
|
-
:operation => 'history',
|
81
|
-
:channel => 'channel',
|
82
|
-
:subscribe_key => 'subscribe_key',
|
83
|
-
:origin => 'pubsub.pubnub.com',
|
84
|
-
:publish_key => 'publish_key'
|
85
|
-
)
|
86
|
-
|
87
|
-
@pubnub_request.path.should eq '/v2/history/sub-key/subscribe_key/channel/channel'
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
91
|
-
|
92
|
-
context 'is presence' do
|
93
|
-
it 'is valid' do
|
94
|
-
@pubnub_request = Pubnub::Request.new(
|
95
|
-
:operation => 'presence',
|
96
|
-
:channel => 'channel',
|
97
|
-
:subscribe_key => 'subscribe_key',
|
98
|
-
:origin => 'pubsub.pubnub.com',
|
99
|
-
:publish_key => 'publish_key'
|
100
|
-
)
|
101
|
-
|
102
|
-
@pubnub_request.path.should eq '/subscribe/subscribe_key/channel-pnpres/0/0'
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
context 'is here_now' do
|
107
|
-
it 'is valid' do
|
108
|
-
@pubnub_request = Pubnub::Request.new(
|
109
|
-
:operation => 'here_now',
|
110
|
-
:channel => 'channel',
|
111
|
-
:subscribe_key => 'subscribe_key',
|
112
|
-
:origin => 'pubsub.pubnub.com',
|
113
|
-
:publish_key => 'publish_key'
|
114
|
-
)
|
115
|
-
|
116
|
-
@pubnub_request.path.should eq '/v2/presence/sub-key/subscribe_key/channel/channel'
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
context 'is time' do
|
121
|
-
it 'is valid' do
|
122
|
-
@pubnub_request = Pubnub::Request.new(
|
123
|
-
:operation => 'time',
|
124
|
-
:channel => 'channel',
|
125
|
-
:subscribe_key => 'subscribe_key',
|
126
|
-
:origin => 'pubsub.pubnub.com',
|
127
|
-
:publish_key => 'publish_key'
|
128
|
-
)
|
129
|
-
|
130
|
-
@pubnub_request.path.should eq '/time/0'
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
describe 'created query' do
|
137
|
-
it 'fits to passed parameters' do
|
138
|
-
params = { :uuid => '123-123-123', :some_val => 'value' }
|
139
|
-
@pubnub_request = Pubnub::Request.new(
|
140
|
-
:operation => 'time',
|
141
|
-
:channel => 'channel',
|
142
|
-
:subscribe_key => 'subscribe_key',
|
143
|
-
:origin => 'pubsub.pubnub.com',
|
144
|
-
:publish_key => 'publish_key',
|
145
|
-
:params => params
|
146
|
-
)
|
147
|
-
|
148
|
-
@pubnub_request.query.should eq 'some_val=value&uuid=123-123-123'
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
@@ -1,944 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe '#subscribe' do
|
4
|
-
before do
|
5
|
-
EM.stop if EM.reactor_running?
|
6
|
-
stub_request(:get, 'http://pubsub.pubnub.com/v2/presence/sub-key/demo/channel/demo/leave').
|
7
|
-
to_return(
|
8
|
-
{
|
9
|
-
:body => '{"action": "leave"}',
|
10
|
-
:status => 200,
|
11
|
-
:headers => {
|
12
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
13
|
-
}
|
14
|
-
}
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'when it gets server error' do
|
19
|
-
|
20
|
-
before(:each) do
|
21
|
-
@after_callback = false
|
22
|
-
@output = StringIO.new
|
23
|
-
@error_output = StringIO.new
|
24
|
-
@msg_output = StringIO.new
|
25
|
-
|
26
|
-
@callback = lambda { |envelope|
|
27
|
-
$log.debug 'FIRE CALLBACK'
|
28
|
-
@after_callback = true
|
29
|
-
@output.write envelope.response
|
30
|
-
@msg_output.write envelope.msg
|
31
|
-
EM.stop if EM.reactor_running?
|
32
|
-
}
|
33
|
-
|
34
|
-
@error_callback = lambda { |envelope|
|
35
|
-
$log.error envelope.response
|
36
|
-
@error_output.write envelope.response
|
37
|
-
@after_error_callback = true
|
38
|
-
}
|
39
|
-
|
40
|
-
@pn = Pubnub.new(:publish_key => :demo, :subscribe_key => :demo, :error_callback => @error_callback)
|
41
|
-
@pn.session_uuid = nil
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'via http' do
|
45
|
-
context 'and response message is usable' do
|
46
|
-
before(:each) do
|
47
|
-
@counter = 0
|
48
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/subscribe\/demo\/demo\/0\/\d+/).
|
49
|
-
to_return(lambda { |request|
|
50
|
-
@counter += 1
|
51
|
-
if @counter < 10
|
52
|
-
{
|
53
|
-
:body => [500, 'Error msg'].to_json,
|
54
|
-
:status => 500,
|
55
|
-
:headers => {
|
56
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
57
|
-
}
|
58
|
-
}
|
59
|
-
else
|
60
|
-
{
|
61
|
-
:body => [[{"text" => "hey"}],"#{/\d+$/.match(request.uri.path).to_s.to_i + 1}"].to_json,
|
62
|
-
:status => 200,
|
63
|
-
:headers => {
|
64
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
65
|
-
}
|
66
|
-
}
|
67
|
-
end
|
68
|
-
}
|
69
|
-
)
|
70
|
-
|
71
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/time\/0/).
|
72
|
-
to_return(
|
73
|
-
{
|
74
|
-
:body => '[13804562752311765]',
|
75
|
-
:status => 200,
|
76
|
-
:headers => {
|
77
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
78
|
-
}
|
79
|
-
}
|
80
|
-
)
|
81
|
-
end
|
82
|
-
|
83
|
-
context 'and it\'s synchronous' do
|
84
|
-
before(:each) do
|
85
|
-
@http_sync = true
|
86
|
-
end
|
87
|
-
it 'fires given callback on response envelope and retry' do
|
88
|
-
response_regex = /text.*hey\D*\d*/
|
89
|
-
|
90
|
-
$log.debug 'START #SUBSCRIBE SPEC #7'
|
91
|
-
|
92
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
93
|
-
|
94
|
-
@output.seek(0)
|
95
|
-
|
96
|
-
@output.read.should match response_regex
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'fires given block on response envelope and retry' do
|
100
|
-
response_regex = /text.*hey\D*\d*/
|
101
|
-
|
102
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
103
|
-
|
104
|
-
@output.seek(0)
|
105
|
-
|
106
|
-
@output.read.should match response_regex
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
context 'and it\'s asynchronous' do
|
111
|
-
before(:each) do
|
112
|
-
@http_sync = false
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'fires given callback on response envelope and retry' do
|
116
|
-
response_regex = /text.*hey\D*\d*/
|
117
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
118
|
-
until @after_callback do end
|
119
|
-
@output.seek(0)
|
120
|
-
@output.read.should match response_regex
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'fires given block on response envelope and retry' do
|
124
|
-
response_regex = /text.*hey\D*\d*/
|
125
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
126
|
-
until @after_callback do end
|
127
|
-
@output.seek(0)
|
128
|
-
@output.read.should match response_regex
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
context 'and response message is not usable' do
|
134
|
-
before(:each) do
|
135
|
-
@counter = 0
|
136
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/subscribe\/demo\/demo\/0\/\d+/).
|
137
|
-
to_return(lambda { |request|
|
138
|
-
@counter += 1
|
139
|
-
if @counter < 10
|
140
|
-
{
|
141
|
-
:body => '2132131asad@!EASD#!',
|
142
|
-
:status => 500,
|
143
|
-
:headers => {
|
144
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
145
|
-
}
|
146
|
-
}
|
147
|
-
else
|
148
|
-
@counter = 0
|
149
|
-
{
|
150
|
-
:body => [[{"text" => "hey"}],"#{/\d+$/.match(request.uri.path).to_s.to_i + 1}"].to_json,
|
151
|
-
:status => 200,
|
152
|
-
:headers => {
|
153
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
154
|
-
}
|
155
|
-
}
|
156
|
-
end
|
157
|
-
}
|
158
|
-
)
|
159
|
-
|
160
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/time\/0/).
|
161
|
-
to_return(
|
162
|
-
{
|
163
|
-
:body => '[13804562752311765]',
|
164
|
-
:status => 200,
|
165
|
-
:headers => {
|
166
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
167
|
-
}
|
168
|
-
}
|
169
|
-
)
|
170
|
-
end
|
171
|
-
context 'and it\'s synchronous' do
|
172
|
-
before(:each) do
|
173
|
-
@http_sync = true
|
174
|
-
end
|
175
|
-
it 'fires given callback on response envelope and retry' do
|
176
|
-
response_regex = /text.*hey\D*\d*/
|
177
|
-
|
178
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
179
|
-
|
180
|
-
@output.seek(0)
|
181
|
-
|
182
|
-
@output.read.should match response_regex
|
183
|
-
end
|
184
|
-
|
185
|
-
it 'fires given block on response envelope and retry' do
|
186
|
-
response_regex = /text.*hey\D*\d*/
|
187
|
-
|
188
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
189
|
-
|
190
|
-
@output.seek(0)
|
191
|
-
|
192
|
-
@output.read.should match response_regex
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
context 'and it\'s asynchronous' do
|
197
|
-
before(:each) do
|
198
|
-
@http_sync = false
|
199
|
-
end
|
200
|
-
|
201
|
-
it 'fires given callback on response envelope and retry' do
|
202
|
-
response_regex = /text.*hey\D*\d*/
|
203
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
204
|
-
until @after_callback do end
|
205
|
-
@output.seek(0)
|
206
|
-
@output.read.should match response_regex
|
207
|
-
end
|
208
|
-
|
209
|
-
it 'fires given block on response envelope and retry' do
|
210
|
-
response_regex = /text.*hey\D*\d*/
|
211
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
212
|
-
until @after_callback do end
|
213
|
-
@output.seek(0)
|
214
|
-
@output.read.should match response_regex
|
215
|
-
end
|
216
|
-
end
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
context 'via https' do
|
221
|
-
before do
|
222
|
-
@pn.ssl = true
|
223
|
-
end
|
224
|
-
context 'and response message is usable' do
|
225
|
-
before(:each) do
|
226
|
-
@counter = 0
|
227
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/subscribe\/demo\/demo\/0\/\d+/).
|
228
|
-
to_return(lambda { |request|
|
229
|
-
@counter += 1
|
230
|
-
if @counter < 10
|
231
|
-
{
|
232
|
-
:body => [500, 'Error msg'].to_json,
|
233
|
-
:status => 500,
|
234
|
-
:headers => {
|
235
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
236
|
-
}
|
237
|
-
}
|
238
|
-
else
|
239
|
-
{
|
240
|
-
:body => [[{"text" => "hey"}],"#{/\d+$/.match(request.uri.path).to_s.to_i + 1}"].to_json,
|
241
|
-
:status => 200,
|
242
|
-
:headers => {
|
243
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
244
|
-
}
|
245
|
-
}
|
246
|
-
end
|
247
|
-
}
|
248
|
-
)
|
249
|
-
|
250
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/time\/0/).
|
251
|
-
to_return(
|
252
|
-
{
|
253
|
-
:body => '[13804562752311765]',
|
254
|
-
:status => 200,
|
255
|
-
:headers => {
|
256
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
257
|
-
}
|
258
|
-
}
|
259
|
-
)
|
260
|
-
end
|
261
|
-
|
262
|
-
context 'and it\'s synchronous' do
|
263
|
-
before(:each) do
|
264
|
-
@http_sync = true
|
265
|
-
end
|
266
|
-
it 'fires given callback on response envelope and retry' do
|
267
|
-
response_regex = /text.*hey\D*\d*/
|
268
|
-
|
269
|
-
$log.debug 'START #SUBSCRIBE SPEC #7'
|
270
|
-
|
271
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
272
|
-
|
273
|
-
@output.seek(0)
|
274
|
-
|
275
|
-
@output.read.should match response_regex
|
276
|
-
end
|
277
|
-
|
278
|
-
it 'fires given block on response envelope and retry' do
|
279
|
-
response_regex = /text.*hey\D*\d*/
|
280
|
-
|
281
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
282
|
-
|
283
|
-
@output.seek(0)
|
284
|
-
|
285
|
-
@output.read.should match response_regex
|
286
|
-
end
|
287
|
-
end
|
288
|
-
|
289
|
-
context 'and it\'s asynchronous' do
|
290
|
-
before(:each) do
|
291
|
-
@http_sync = false
|
292
|
-
end
|
293
|
-
|
294
|
-
it 'fires given callback on response envelope and retry' do
|
295
|
-
response_regex = /text.*hey\D*\d*/
|
296
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
297
|
-
until @after_callback do end
|
298
|
-
@output.seek(0)
|
299
|
-
@output.read.should match response_regex
|
300
|
-
end
|
301
|
-
|
302
|
-
it 'fires given block on response envelope and retry' do
|
303
|
-
response_regex = /text.*hey\D*\d*/
|
304
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
305
|
-
until @after_callback do end
|
306
|
-
@output.seek(0)
|
307
|
-
@output.read.should match response_regex
|
308
|
-
end
|
309
|
-
end
|
310
|
-
end
|
311
|
-
|
312
|
-
context 'and response message is not usable' do
|
313
|
-
before(:each) do
|
314
|
-
@counter = 0
|
315
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/subscribe\/demo\/demo\/0\/\d+/).
|
316
|
-
to_return(lambda { |request|
|
317
|
-
@counter += 1
|
318
|
-
if @counter < 10
|
319
|
-
{
|
320
|
-
:body => '2132131asad@!EASD#!',
|
321
|
-
:status => 500,
|
322
|
-
:headers => {
|
323
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
324
|
-
}
|
325
|
-
}
|
326
|
-
else
|
327
|
-
@counter = 0
|
328
|
-
{
|
329
|
-
:body => [[{"text" => "hey"}],"#{/\d+$/.match(request.uri.path).to_s.to_i + 1}"].to_json,
|
330
|
-
:status => 200,
|
331
|
-
:headers => {
|
332
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
333
|
-
}
|
334
|
-
}
|
335
|
-
end
|
336
|
-
}
|
337
|
-
)
|
338
|
-
|
339
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/time\/0/).
|
340
|
-
to_return(
|
341
|
-
{
|
342
|
-
:body => '[13804562752311765]',
|
343
|
-
:status => 200,
|
344
|
-
:headers => {
|
345
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
346
|
-
}
|
347
|
-
}
|
348
|
-
)
|
349
|
-
end
|
350
|
-
context 'and it\'s synchronous' do
|
351
|
-
before(:each) do
|
352
|
-
@http_sync = true
|
353
|
-
end
|
354
|
-
it 'fires given callback on response envelope and retry' do
|
355
|
-
response_regex = /text.*hey\D*\d*/
|
356
|
-
|
357
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
358
|
-
|
359
|
-
@output.seek(0)
|
360
|
-
|
361
|
-
@output.read.should match response_regex
|
362
|
-
end
|
363
|
-
|
364
|
-
it 'fires given block on response envelope and retry' do
|
365
|
-
response_regex = /text.*hey\D*\d*/
|
366
|
-
|
367
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
368
|
-
|
369
|
-
@output.seek(0)
|
370
|
-
|
371
|
-
@output.read.should match response_regex
|
372
|
-
end
|
373
|
-
end
|
374
|
-
|
375
|
-
context 'and it\'s asynchronous' do
|
376
|
-
before(:each) do
|
377
|
-
@http_sync = false
|
378
|
-
end
|
379
|
-
|
380
|
-
it 'fires given callback on response envelope and retry' do
|
381
|
-
response_regex = /text.*hey\D*\d*/
|
382
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
383
|
-
until @after_callback do end
|
384
|
-
@output.seek(0)
|
385
|
-
@output.read.should match response_regex
|
386
|
-
end
|
387
|
-
|
388
|
-
it 'fires given block on response envelope and retry' do
|
389
|
-
response_regex = /text.*hey\D*\d*/
|
390
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
391
|
-
until @after_callback do end
|
392
|
-
@output.seek(0)
|
393
|
-
@output.read.should match response_regex
|
394
|
-
end
|
395
|
-
end
|
396
|
-
end
|
397
|
-
end
|
398
|
-
end
|
399
|
-
|
400
|
-
context 'it gets correct single message' do
|
401
|
-
|
402
|
-
before(:each) do
|
403
|
-
@after_callback = false
|
404
|
-
@output = StringIO.new
|
405
|
-
@error_output = StringIO.new
|
406
|
-
@msg_output = StringIO.new
|
407
|
-
|
408
|
-
@callback = lambda { |envelope|
|
409
|
-
$log.debug 'FIRE CALLBACK'
|
410
|
-
@after_callback = true
|
411
|
-
@output.write envelope.response
|
412
|
-
@msg_output.write envelope.msg
|
413
|
-
EM.stop if EM.reactor_running?
|
414
|
-
}
|
415
|
-
|
416
|
-
@error_callback = lambda { |envelope|
|
417
|
-
$log.error envelope.response
|
418
|
-
@error_output.write envelope.response
|
419
|
-
@after_error_callback = true
|
420
|
-
}
|
421
|
-
|
422
|
-
@pn = Pubnub.new(:publish_key => :demo, :subscribe_key => :demo, :error_callback => @error_callback)
|
423
|
-
@pn.session_uuid = nil
|
424
|
-
end
|
425
|
-
|
426
|
-
before(:each) do
|
427
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/subscribe\/demo\/demo\/0\/\d+/).
|
428
|
-
to_return(lambda { |request|
|
429
|
-
{
|
430
|
-
:body => [[{"text" => "hey"}],"#{/\d+$/.match(request.uri.path).to_s.to_i + 1}"].to_json,
|
431
|
-
:status => 200,
|
432
|
-
:headers => {
|
433
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
434
|
-
}
|
435
|
-
}
|
436
|
-
}
|
437
|
-
)
|
438
|
-
|
439
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/time\/0/).
|
440
|
-
to_return(
|
441
|
-
{
|
442
|
-
:body => '[13804562752311765]',
|
443
|
-
:status => 200,
|
444
|
-
:headers => {
|
445
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
446
|
-
}
|
447
|
-
}
|
448
|
-
)
|
449
|
-
end
|
450
|
-
context 'without secret key' do
|
451
|
-
context 'without cipher_key' do
|
452
|
-
context 'via http' do
|
453
|
-
context 'and it\'s asynchronous' do
|
454
|
-
before(:each) do
|
455
|
-
@http_sync = false
|
456
|
-
end
|
457
|
-
it 'fires given callback on response envelope and retry' do
|
458
|
-
response_regex = /text.*hey\D*\d*/
|
459
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
460
|
-
until @after_callback do end
|
461
|
-
@output.seek(0)
|
462
|
-
@output.read.should match response_regex
|
463
|
-
end
|
464
|
-
|
465
|
-
it 'fires given block on response envelope and retry' do
|
466
|
-
response_regex = /text.*hey\D*\d*/
|
467
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
468
|
-
until @after_callback do end
|
469
|
-
@output.seek(0)
|
470
|
-
@output.read.should match response_regex
|
471
|
-
end
|
472
|
-
end
|
473
|
-
|
474
|
-
context 'and it\'s synchronous' do
|
475
|
-
before(:each) do
|
476
|
-
@http_sync = true
|
477
|
-
end
|
478
|
-
it 'fires given callback on response envelope and retry' do
|
479
|
-
response_regex = /text.*hey\D*\d*/
|
480
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
481
|
-
until @after_callback do end
|
482
|
-
@output.seek(0)
|
483
|
-
@output.read.should match response_regex
|
484
|
-
end
|
485
|
-
|
486
|
-
it 'fires given block on response envelope and retry' do
|
487
|
-
response_regex = /text.*hey\D*\d*/
|
488
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
489
|
-
until @after_callback do end
|
490
|
-
@output.seek(0)
|
491
|
-
@output.read.should match response_regex
|
492
|
-
end
|
493
|
-
end
|
494
|
-
end
|
495
|
-
|
496
|
-
context 'via https' do
|
497
|
-
before do
|
498
|
-
@pn.ssl = true
|
499
|
-
end
|
500
|
-
context 'and it\'s asynchronous' do
|
501
|
-
before(:each) do
|
502
|
-
@http_sync = false
|
503
|
-
end
|
504
|
-
context 'and it\'s asynchronous' do
|
505
|
-
before(:each) do
|
506
|
-
@http_sync = false
|
507
|
-
end
|
508
|
-
it 'fires given callback on response envelope and retry' do
|
509
|
-
response_regex = /text.*hey\D*\d*/
|
510
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
511
|
-
until @after_callback do end
|
512
|
-
@output.seek(0)
|
513
|
-
@output.read.should match response_regex
|
514
|
-
end
|
515
|
-
|
516
|
-
it 'fires given block on response envelope and retry' do
|
517
|
-
response_regex = /text.*hey\D*\d*/
|
518
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
519
|
-
until @after_callback do end
|
520
|
-
@output.seek(0)
|
521
|
-
@output.read.should match response_regex
|
522
|
-
end
|
523
|
-
end
|
524
|
-
|
525
|
-
context 'and it\'s synchronous' do
|
526
|
-
before(:each) do
|
527
|
-
@http_sync = true
|
528
|
-
end
|
529
|
-
it 'fires given callback on response envelope and retry' do
|
530
|
-
response_regex = /text.*hey\D*\d*/
|
531
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
532
|
-
until @after_callback do end
|
533
|
-
@output.seek(0)
|
534
|
-
@output.read.should match response_regex
|
535
|
-
end
|
536
|
-
|
537
|
-
it 'fires given block on response envelope and retry' do
|
538
|
-
response_regex = /text.*hey\D*\d*/
|
539
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
540
|
-
until @after_callback do end
|
541
|
-
@output.seek(0)
|
542
|
-
@output.read.should match response_regex
|
543
|
-
end
|
544
|
-
end
|
545
|
-
end
|
546
|
-
end
|
547
|
-
end
|
548
|
-
|
549
|
-
context 'using cipher_key' do
|
550
|
-
before do
|
551
|
-
@pn.cipher_key = 'enigma'
|
552
|
-
|
553
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/subscribe\/demo\/demo\/0\/\d+/).
|
554
|
-
to_return(lambda { |request|
|
555
|
-
{
|
556
|
-
:body => ["E8VOcbfrYqLyHMtoVGv9UQ==","#{/\d+$/.match(request.uri.path).to_s.to_i + 1}"].to_json,
|
557
|
-
:status => 200,
|
558
|
-
:headers => {
|
559
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
560
|
-
}
|
561
|
-
}
|
562
|
-
}
|
563
|
-
)
|
564
|
-
|
565
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/time\/0/).
|
566
|
-
to_return(
|
567
|
-
{
|
568
|
-
:body => '[13804562752311765]',
|
569
|
-
:status => 200,
|
570
|
-
:headers => {
|
571
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
572
|
-
}
|
573
|
-
}
|
574
|
-
)
|
575
|
-
end
|
576
|
-
context 'via http' do
|
577
|
-
context 'and it\'s synchronous' do
|
578
|
-
before(:each) do
|
579
|
-
@http_sync = true
|
580
|
-
end
|
581
|
-
it 'fires given callback on response envelope and retry' do
|
582
|
-
response_regex = /text.*hey\D*\d*/
|
583
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
584
|
-
until @after_callback do end
|
585
|
-
@msg_output.seek(0)
|
586
|
-
@msg_output.read.should match response_regex
|
587
|
-
end
|
588
|
-
|
589
|
-
it 'fires given block on response envelope and retry' do
|
590
|
-
response_regex = /text.*hey\D*\d*/
|
591
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
592
|
-
until @after_callback do end
|
593
|
-
@msg_output.seek(0)
|
594
|
-
@msg_output.read.should match response_regex
|
595
|
-
end
|
596
|
-
end
|
597
|
-
|
598
|
-
context 'and it\'s asynchronous' do
|
599
|
-
before(:each) do
|
600
|
-
@http_sync = false
|
601
|
-
end
|
602
|
-
it 'fires given callback on response envelope and retry' do
|
603
|
-
response_regex = /text.*hey\D*\d*/
|
604
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
605
|
-
until @after_callback do end
|
606
|
-
@msg_output.seek(0)
|
607
|
-
@msg_output.read.should match response_regex
|
608
|
-
end
|
609
|
-
|
610
|
-
it 'fires given block on response envelope and retry' do
|
611
|
-
response_regex = /text.*hey\D*\d*/
|
612
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
613
|
-
until @after_callback do end
|
614
|
-
@msg_output.seek(0)
|
615
|
-
@msg_output.read.should match response_regex
|
616
|
-
end
|
617
|
-
end
|
618
|
-
end
|
619
|
-
|
620
|
-
context 'via https' do
|
621
|
-
before do
|
622
|
-
@pn.ssl = true
|
623
|
-
end
|
624
|
-
context 'and it\'s asynchronous' do
|
625
|
-
before(:each) do
|
626
|
-
@http_sync = false
|
627
|
-
end
|
628
|
-
it 'fires given callback on response envelope and retry' do
|
629
|
-
response_regex = /text.*hey\D*\d*/
|
630
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
631
|
-
until @after_callback do end
|
632
|
-
@msg_output.seek(0)
|
633
|
-
@msg_output.read.should match response_regex
|
634
|
-
end
|
635
|
-
|
636
|
-
it 'fires given block on response envelope and retry' do
|
637
|
-
response_regex = /text.*hey\D*\d*/
|
638
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
639
|
-
until @after_callback do end
|
640
|
-
@msg_output.seek(0)
|
641
|
-
@msg_output.read.should match response_regex
|
642
|
-
end
|
643
|
-
end
|
644
|
-
|
645
|
-
context 'and it\'s synchronous' do
|
646
|
-
before(:each) do
|
647
|
-
@http_sync = true
|
648
|
-
end
|
649
|
-
it 'fires given callback on response envelope and retry' do
|
650
|
-
response_regex = /text.*hey\D*\d*/
|
651
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
652
|
-
until @after_callback do end
|
653
|
-
@msg_output.seek(0)
|
654
|
-
@msg_output.read.should match response_regex
|
655
|
-
end
|
656
|
-
|
657
|
-
it 'fires given block on response envelope and retry' do
|
658
|
-
response_regex = /text.*hey\D*\d*/
|
659
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
660
|
-
until @after_callback do end
|
661
|
-
@msg_output.seek(0)
|
662
|
-
@msg_output.read.should match response_regex
|
663
|
-
end
|
664
|
-
end
|
665
|
-
end
|
666
|
-
end
|
667
|
-
end
|
668
|
-
end
|
669
|
-
|
670
|
-
context 'it gets correct multiple message' do
|
671
|
-
|
672
|
-
before(:each) do
|
673
|
-
@after_callback = false
|
674
|
-
@output = StringIO.new
|
675
|
-
@error_output = StringIO.new
|
676
|
-
@msg_output = StringIO.new
|
677
|
-
@first_callback_done = false
|
678
|
-
|
679
|
-
@callback = lambda { |envelope|
|
680
|
-
$log.debug 'FIRE CALLBACK'
|
681
|
-
@output.write envelope.response
|
682
|
-
@msg_output.write envelope.msg
|
683
|
-
if @first_callback_done
|
684
|
-
EM.stop if EM.reactor_running?
|
685
|
-
@after_callback = true
|
686
|
-
else
|
687
|
-
@first_callback_done = true
|
688
|
-
end
|
689
|
-
}
|
690
|
-
|
691
|
-
@error_callback = lambda { |envelope|
|
692
|
-
$log.error envelope.response
|
693
|
-
@error_output.write envelope.response
|
694
|
-
@after_error_callback = true
|
695
|
-
}
|
696
|
-
|
697
|
-
@pn = Pubnub.new(:publish_key => :demo, :subscribe_key => :demo, :error_callback => @error_callback)
|
698
|
-
@pn.session_uuid = nil
|
699
|
-
end
|
700
|
-
|
701
|
-
before(:each) do
|
702
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/subscribe\/demo\/demo\/0\/\d+/).
|
703
|
-
to_return(lambda { |request|
|
704
|
-
{
|
705
|
-
:body => [[{"text" => "hey"},{"text" => "hey"}],"#{/\d+$/.match(request.uri.path).to_s.to_i + 1}"].to_json,
|
706
|
-
:status => 200,
|
707
|
-
:headers => {
|
708
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
709
|
-
}
|
710
|
-
}
|
711
|
-
}
|
712
|
-
)
|
713
|
-
|
714
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/time\/0/).
|
715
|
-
to_return(
|
716
|
-
{
|
717
|
-
:body => '[13804562752311765]',
|
718
|
-
:status => 200,
|
719
|
-
:headers => {
|
720
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
721
|
-
}
|
722
|
-
}
|
723
|
-
)
|
724
|
-
end
|
725
|
-
context 'without secret key' do
|
726
|
-
context 'without cipher_key' do
|
727
|
-
context 'via http' do
|
728
|
-
context 'and it\'s asynchronous' do
|
729
|
-
before(:each) do
|
730
|
-
@http_sync = false
|
731
|
-
end
|
732
|
-
it 'fires given callback on response envelope and retry' do
|
733
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
734
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
735
|
-
until @after_callback do end
|
736
|
-
@output.seek(0)
|
737
|
-
@output.read.should match response_regex
|
738
|
-
end
|
739
|
-
|
740
|
-
it 'fires given block on response envelope and retry' do
|
741
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
742
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
743
|
-
until @after_callback do end
|
744
|
-
@output.seek(0)
|
745
|
-
@output.read.should match response_regex
|
746
|
-
end
|
747
|
-
end
|
748
|
-
|
749
|
-
context 'and it\'s synchronous' do
|
750
|
-
before(:each) do
|
751
|
-
@http_sync = true
|
752
|
-
end
|
753
|
-
it 'fires given callback on response envelope and retry' do
|
754
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
755
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
756
|
-
until @after_callback do end
|
757
|
-
@output.seek(0)
|
758
|
-
@output.read.should match response_regex
|
759
|
-
end
|
760
|
-
|
761
|
-
it 'fires given block on response envelope and retry' do
|
762
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
763
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
764
|
-
until @after_callback do end
|
765
|
-
@output.seek(0)
|
766
|
-
@output.read.should match response_regex
|
767
|
-
end
|
768
|
-
end
|
769
|
-
end
|
770
|
-
|
771
|
-
context 'via https' do
|
772
|
-
before do
|
773
|
-
@pn.ssl = true
|
774
|
-
end
|
775
|
-
context 'and it\'s asynchronous' do
|
776
|
-
before(:each) do
|
777
|
-
@http_sync = false
|
778
|
-
end
|
779
|
-
context 'and it\'s asynchronous' do
|
780
|
-
before(:each) do
|
781
|
-
@http_sync = false
|
782
|
-
end
|
783
|
-
it 'fires given callback on response envelope and retry' do
|
784
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
785
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
786
|
-
until @after_callback do end
|
787
|
-
@output.seek(0)
|
788
|
-
@output.read.should match response_regex
|
789
|
-
end
|
790
|
-
|
791
|
-
it 'fires given block on response envelope and retry' do
|
792
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
793
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
794
|
-
until @after_callback do end
|
795
|
-
@output.seek(0)
|
796
|
-
@output.read.should match response_regex
|
797
|
-
end
|
798
|
-
end
|
799
|
-
|
800
|
-
context 'and it\'s synchronous' do
|
801
|
-
before(:each) do
|
802
|
-
@http_sync = true
|
803
|
-
end
|
804
|
-
it 'fires given callback on response envelope and retry' do
|
805
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
806
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
807
|
-
until @after_callback do end
|
808
|
-
@output.seek(0)
|
809
|
-
@output.read.should match response_regex
|
810
|
-
end
|
811
|
-
|
812
|
-
it 'fires given block on response envelope and retry' do
|
813
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
814
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
815
|
-
until @after_callback do end
|
816
|
-
@output.seek(0)
|
817
|
-
@output.read.should match response_regex
|
818
|
-
end
|
819
|
-
end
|
820
|
-
end
|
821
|
-
end
|
822
|
-
end
|
823
|
-
|
824
|
-
context 'using cipher_key' do
|
825
|
-
before do
|
826
|
-
@pn.cipher_key = 'enigma'
|
827
|
-
|
828
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/subscribe\/demo\/demo\/0\/\d+/).
|
829
|
-
to_return(lambda { |request|
|
830
|
-
{
|
831
|
-
:body => [["E8VOcbfrYqLyHMtoVGv9UQ==","E8VOcbfrYqLyHMtoVGv9UQ=="],"#{/\d+$/.match(request.uri.path).to_s.to_i + 1}"].to_json,
|
832
|
-
:status => 200,
|
833
|
-
:headers => {
|
834
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
835
|
-
}
|
836
|
-
}
|
837
|
-
}
|
838
|
-
)
|
839
|
-
|
840
|
-
stub_request(:get, /http[s]?:\/\/pubsub.pubnub.com\/time\/0/).
|
841
|
-
to_return(
|
842
|
-
{
|
843
|
-
:body => '[13804562752311765]',
|
844
|
-
:status => 200,
|
845
|
-
:headers => {
|
846
|
-
'Content-Type' => 'text/javascript; charset="UTF-8"'
|
847
|
-
}
|
848
|
-
}
|
849
|
-
)
|
850
|
-
end
|
851
|
-
context 'via http' do
|
852
|
-
context 'and it\'s synchronous' do
|
853
|
-
before(:each) do
|
854
|
-
@http_sync = true
|
855
|
-
end
|
856
|
-
it 'fires given callback on response envelope and retry' do
|
857
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
858
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
859
|
-
until @after_callback do end
|
860
|
-
@msg_output.seek(0)
|
861
|
-
@msg_output.read.should match response_regex
|
862
|
-
end
|
863
|
-
|
864
|
-
it 'fires given block on response envelope and retry' do
|
865
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
866
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
867
|
-
until @after_callback do end
|
868
|
-
@msg_output.seek(0)
|
869
|
-
@msg_output.read.should match response_regex
|
870
|
-
end
|
871
|
-
end
|
872
|
-
|
873
|
-
context 'and it\'s asynchronous' do
|
874
|
-
before(:each) do
|
875
|
-
@http_sync = false
|
876
|
-
end
|
877
|
-
it 'fires given callback on response envelope and retry' do
|
878
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
879
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
880
|
-
until @after_callback do end
|
881
|
-
@msg_output.seek(0)
|
882
|
-
@msg_output.read.should match response_regex
|
883
|
-
end
|
884
|
-
|
885
|
-
it 'fires given block on response envelope and retry' do
|
886
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
887
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
888
|
-
until @after_callback do end
|
889
|
-
@msg_output.seek(0)
|
890
|
-
@msg_output.read.should match response_regex
|
891
|
-
end
|
892
|
-
end
|
893
|
-
end
|
894
|
-
|
895
|
-
context 'via https' do
|
896
|
-
before do
|
897
|
-
@pn.ssl = true
|
898
|
-
end
|
899
|
-
context 'and it\'s asynchronous' do
|
900
|
-
before(:each) do
|
901
|
-
@http_sync = false
|
902
|
-
end
|
903
|
-
it 'fires given callback on response envelope and retry' do
|
904
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
905
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
906
|
-
until @after_callback do end
|
907
|
-
@msg_output.seek(0)
|
908
|
-
@msg_output.read.should match response_regex
|
909
|
-
end
|
910
|
-
|
911
|
-
it 'fires given block on response envelope and retry' do
|
912
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
913
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
914
|
-
until @after_callback do end
|
915
|
-
@msg_output.seek(0)
|
916
|
-
@msg_output.read.should match response_regex
|
917
|
-
end
|
918
|
-
end
|
919
|
-
|
920
|
-
context 'and it\'s synchronous' do
|
921
|
-
before(:each) do
|
922
|
-
@http_sync = true
|
923
|
-
end
|
924
|
-
it 'fires given callback on response envelope and retry' do
|
925
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
926
|
-
@pn.subscribe(:channel => 'demo', :callback => @callback, :http_sync => @http_sync)
|
927
|
-
until @after_callback do end
|
928
|
-
@msg_output.seek(0)
|
929
|
-
@msg_output.read.should match response_regex
|
930
|
-
end
|
931
|
-
|
932
|
-
it 'fires given block on response envelope and retry' do
|
933
|
-
response_regex = /text\W*hey\W*text\W*hey/
|
934
|
-
@pn.subscribe(:channel => 'demo', :http_sync => @http_sync, &@callback)
|
935
|
-
until @after_callback do end
|
936
|
-
@msg_output.seek(0)
|
937
|
-
@msg_output.read.should match response_regex
|
938
|
-
end
|
939
|
-
end
|
940
|
-
end
|
941
|
-
end
|
942
|
-
end
|
943
|
-
end
|
944
|
-
end
|