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/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.5.1
|
data/examples/demo_console.rb
CHANGED
@@ -1,40 +1,108 @@
|
|
1
1
|
require 'pubnub'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
keys_option = nil
|
4
|
+
|
5
|
+
puts 'How do you want to set up app keys?'
|
6
|
+
puts 'd. Default [D]EMO keys (default)'
|
7
|
+
puts 'p. Default [p]am keys'
|
8
|
+
puts 'c. want to enter [c]ustom keys'
|
9
|
+
puts 'Enter your choice:'
|
10
|
+
|
11
|
+
keys_option = gets.chomp!.downcase
|
12
|
+
keys_option = 'd' if keys_option.blank? || !%w(d p c).include?(keys_option)
|
13
|
+
|
14
|
+
|
15
|
+
case keys_option
|
16
|
+
when 'd'
|
17
|
+
origin = 'demo.pubnub.com'
|
18
|
+
sub_key = 'demo'
|
19
|
+
pub_key = 'demo'
|
20
|
+
sec_key = nil
|
21
|
+
|
22
|
+
when 'p'
|
23
|
+
origin = 'pubsub.pubnub.com'
|
24
|
+
sub_key = 'sub-c-a478dd2a-c33d-11e2-883f-02ee2ddab7fe'
|
25
|
+
pub_key = 'pub-c-a2650a22-deb1-44f5-aa87-1517049411d5'
|
26
|
+
sec_key = 'sec-c-YjFmNzYzMGMtYmI3NC00NzJkLTlkYzYtY2MwMzI4YTJhNDVh'
|
27
|
+
|
28
|
+
|
29
|
+
when 'c'
|
30
|
+
puts 'Provide origin [demo.pubnub.com]:'
|
31
|
+
origin = gets.chomp!.downcase
|
32
|
+
origin = 'demo.pubnub.com' if origin.blank?
|
33
|
+
puts 'Provide subscribe key [demo]:'
|
34
|
+
sub_key = gets.chomp!
|
35
|
+
sub_key = 'demo' if sub_key.blank?
|
36
|
+
|
37
|
+
puts 'Provide publish key [demo]:'
|
38
|
+
pub_key = gets.chomp!
|
39
|
+
pub_key = 'demo' if pub_key.blank?
|
40
|
+
|
41
|
+
puts 'Provide secret key (optional):'
|
42
|
+
sec_key = gets.chomp!
|
43
|
+
sec_key = nil if sec_key.blank?
|
44
|
+
end
|
45
|
+
|
46
|
+
puts 'Provide auth key or skip? (default: skip)'
|
47
|
+
auth_key = gets.chomp!
|
48
|
+
|
49
|
+
puts 'Do you want your connection to be ssl? [y/N]'
|
50
|
+
ssl = gets.chomp!.upcase
|
51
|
+
ssl = 'N' if ssl != 'Y'
|
52
|
+
ssl = ssl == 'Y' ? true : false
|
53
|
+
|
54
|
+
puts "\nUsing following keys:"
|
55
|
+
puts "Subscribe key: #{sub_key}"
|
56
|
+
puts "Publish key: #{pub_key}"
|
57
|
+
puts "Secret key: #{sec_key}" if sec_key
|
58
|
+
puts "Auth key: #{auth_key}" if auth_key
|
59
|
+
|
6
60
|
|
7
61
|
p = Pubnub.new(
|
8
|
-
:
|
9
|
-
:
|
62
|
+
:ssl => ssl,
|
63
|
+
:subscribe_key => sub_key,
|
64
|
+
:secret_key => sec_key,
|
65
|
+
:publish_key => pub_key,
|
66
|
+
:auth_key => auth_key,
|
10
67
|
:origin => origin,
|
11
68
|
:error_callback => lambda { |msg|
|
12
|
-
puts "
|
69
|
+
puts "Error callback says: #{msg.inspect}"
|
13
70
|
},
|
14
71
|
:connect_callback => lambda { |msg|
|
15
|
-
puts "
|
72
|
+
puts "Connect callback says: #{msg.inspect}"
|
16
73
|
}
|
17
74
|
)
|
18
|
-
default_cb = lambda { |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
19
75
|
|
20
|
-
|
76
|
+
puts("\nUse PubNub AES encryption? Leave blank for now, else enter your cipher key.")
|
77
|
+
aes = gets.chomp!
|
21
78
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
79
|
+
unless aes.blank?
|
80
|
+
p.cipher_key = aes
|
81
|
+
end
|
82
|
+
|
83
|
+
default_cb = lambda { |envelope|
|
84
|
+
puts "\n/------------------"
|
85
|
+
puts "#{envelope.inspect}"
|
86
|
+
puts "channel: #{envelope.channel}"
|
87
|
+
puts "msg: #{envelope.message}"
|
88
|
+
puts "payload: #{envelope.payload}" if envelope.payload
|
89
|
+
puts '------------------/'
|
90
|
+
}
|
91
|
+
|
92
|
+
while(true)
|
27
93
|
|
28
94
|
sync_or_async = false
|
29
95
|
while !%w(S A).include? sync_or_async
|
30
96
|
puts('Should next operation be [S]ync or [A]sync?')
|
31
|
-
sync_or_async = gets.chomp
|
97
|
+
sync_or_async = gets.chomp!.upcase
|
98
|
+
sync_or_async = 'A' if sync_or_async.blank?
|
32
99
|
end
|
33
100
|
|
34
101
|
block_or_parameter = false
|
35
102
|
while !%w(B P).include? block_or_parameter
|
36
103
|
puts('Do you want pass callback as [B]lock or [P]arameter?')
|
37
|
-
block_or_parameter = gets.chomp
|
104
|
+
block_or_parameter = gets.chomp!.upcase
|
105
|
+
block_or_parameter = 'B' if block_or_parameter.blank?
|
38
106
|
end
|
39
107
|
|
40
108
|
puts('1. subscribe')
|
@@ -44,6 +112,9 @@ while(true)
|
|
44
112
|
puts('5. presence')
|
45
113
|
puts('6. here_now')
|
46
114
|
puts('7. time')
|
115
|
+
puts('8. audit') if sec_key
|
116
|
+
puts('9. grant') if sec_key
|
117
|
+
puts('10. revoke') if sec_key
|
47
118
|
puts("\n\n")
|
48
119
|
puts('Enter a selection')
|
49
120
|
choice = gets.chomp!
|
@@ -57,11 +128,11 @@ while(true)
|
|
57
128
|
if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
|
58
129
|
p.subscribe(:channel => channel, :callback => default_cb, :http_sync => false, :ssl => ssl)
|
59
130
|
elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
|
60
|
-
p.subscribe(:channel => channel, :http_sync => false, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
131
|
+
p.subscribe(:channel => channel, :http_sync => false, :ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
61
132
|
elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
|
62
133
|
p.subscribe(:channel => channel, :callback => default_cb, :http_sync => true, :ssl => ssl)
|
63
134
|
elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
|
64
|
-
p.subscribe(:channel => channel, :http_sync => true, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
135
|
+
p.subscribe(:channel => channel, :http_sync => true, :ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
65
136
|
end
|
66
137
|
|
67
138
|
|
@@ -73,11 +144,11 @@ while(true)
|
|
73
144
|
if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
|
74
145
|
p.unsubscribe(:channel => channel, :callback => default_cb, :http_sync => false, :ssl => ssl)
|
75
146
|
elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
|
76
|
-
p.unsubscribe(:channel => channel, :http_sync => false, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
147
|
+
p.unsubscribe(:channel => channel, :http_sync => false, :ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
77
148
|
elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
|
78
149
|
p.unsubscribe(:channel => channel, :callback => default_cb, :http_sync => true, :ssl => ssl)
|
79
150
|
elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
|
80
|
-
p.unsubscribe(:channel => channel, :http_sync => true, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
151
|
+
p.unsubscribe(:channel => channel, :http_sync => true, :ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
81
152
|
end
|
82
153
|
|
83
154
|
when '3' #PUBLISH
|
@@ -91,11 +162,11 @@ while(true)
|
|
91
162
|
if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
|
92
163
|
p.publish(:message => message, :channel => channel, :callback => default_cb, :http_sync => false, :ssl => ssl)
|
93
164
|
elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
|
94
|
-
p.publish(:message => message, :channel => channel, :http_sync => false, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
165
|
+
p.publish(:message => message, :channel => channel, :http_sync => false, :ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
95
166
|
elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
|
96
167
|
p.publish(:message => message, :channel => channel, :callback => default_cb, :http_sync => true, :ssl => ssl)
|
97
168
|
elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
|
98
|
-
p.publish(:message => message, :channel => channel, :http_sync => true, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
169
|
+
p.publish(:message => message, :channel => channel, :http_sync => true, :ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
99
170
|
end
|
100
171
|
|
101
172
|
when '4' #HISTORY
|
@@ -134,7 +205,7 @@ while(true)
|
|
134
205
|
:end => history_end,
|
135
206
|
:reverse => reverse,
|
136
207
|
:http_sync => false,
|
137
|
-
:ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
208
|
+
:ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
138
209
|
elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
|
139
210
|
p.history(:channel => channel,
|
140
211
|
:count => count,
|
@@ -143,7 +214,7 @@ while(true)
|
|
143
214
|
:reverse => reverse,
|
144
215
|
:callback => default_cb,
|
145
216
|
:http_sync => true,
|
146
|
-
:ssl => ssl) do |envelope| puts(envelope.inspect) end
|
217
|
+
:ssl => ssl, &default_cb)# do |envelope| puts(envelope.inspect) end
|
147
218
|
elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
|
148
219
|
p.history(:channel => channel,
|
149
220
|
:count => count,
|
@@ -151,7 +222,7 @@ while(true)
|
|
151
222
|
:end => history_end,
|
152
223
|
:reverse => true,
|
153
224
|
:http_sync => false,
|
154
|
-
:ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
225
|
+
:ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
155
226
|
end
|
156
227
|
|
157
228
|
when '5' #PRESENCE
|
@@ -161,11 +232,11 @@ while(true)
|
|
161
232
|
if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
|
162
233
|
p.presence(:channel => channel, :callback => default_cb, :http_sync => false, :ssl => ssl)
|
163
234
|
elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
|
164
|
-
p.presence(:channel => channel, :http_sync => false, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
235
|
+
p.presence(:channel => channel, :http_sync => false, :ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
165
236
|
elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
|
166
237
|
p.presence(:channel => channel, :callback => default_cb, :http_sync => true, :ssl => ssl)
|
167
238
|
elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
|
168
|
-
p.presence(:channel => channel, :http_sync => true, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
239
|
+
p.presence(:channel => channel, :http_sync => true, :ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
169
240
|
end
|
170
241
|
|
171
242
|
when '6' #HERE_NOW
|
@@ -175,11 +246,11 @@ while(true)
|
|
175
246
|
if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
|
176
247
|
p.here_now(:channel => channel, :callback => default_cb, :http_sync => false, :ssl => ssl)
|
177
248
|
elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
|
178
|
-
p.here_now(:channel => channel, :http_sync => false, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
249
|
+
p.here_now(:channel => channel, :http_sync => false, :ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
179
250
|
elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
|
180
251
|
p.here_now(:channel => channel, :callback => default_cb, :http_sync => true, :ssl => ssl)
|
181
252
|
elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
|
182
|
-
p.here_now(:channel => channel, :http_sync => true, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
253
|
+
p.here_now(:channel => channel, :http_sync => true, :ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
183
254
|
end
|
184
255
|
|
185
256
|
|
@@ -187,12 +258,100 @@ while(true)
|
|
187
258
|
if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
|
188
259
|
p.time(:callback => default_cb, :http_sync => false, :ssl => ssl)
|
189
260
|
elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
|
190
|
-
p.time(:http_sync => false, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
261
|
+
p.time(:http_sync => false, :ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
191
262
|
elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
|
192
263
|
p.time(:callback => default_cb, :http_sync => true, :ssl => ssl)
|
193
264
|
elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
|
194
|
-
p.time(:http_sync => true, :ssl => ssl){ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
265
|
+
p.time(:http_sync => true, :ssl => ssl, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
266
|
+
end
|
267
|
+
|
268
|
+
when '8' # AUDIT
|
269
|
+
puts 'Enter channel for channel level'
|
270
|
+
channel = gets.chomp!
|
271
|
+
channel = nil if channel.blank?
|
272
|
+
|
273
|
+
puts 'Enter auth key'
|
274
|
+
auth_key = gets.chomp!
|
275
|
+
auth_key = nil if auth_key.blank?
|
276
|
+
|
277
|
+
if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
|
278
|
+
p.audit(:callback => default_cb, :http_sync => false, :ssl => ssl, :channel => channel, :auth_key => auth_key)
|
279
|
+
elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
|
280
|
+
p.audit(:http_sync => false, :ssl => ssl, :channel => channel, :auth_key => auth_key, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
281
|
+
elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
|
282
|
+
p.audit(:callback => default_cb, :http_sync => true, :ssl => ssl, :channel => channel, :auth_key => auth_key)
|
283
|
+
elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
|
284
|
+
p.audit(:http_sync => true, :ssl => ssl, :channel => channel, :auth_key => auth_key, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
195
285
|
end
|
196
286
|
|
287
|
+
when '9' # GRANT
|
288
|
+
puts 'Enter channel for channel level'
|
289
|
+
channel = gets.chomp!
|
290
|
+
channel = nil if channel.blank?
|
291
|
+
|
292
|
+
puts 'Enter auth key'
|
293
|
+
auth_key = gets.chomp!
|
294
|
+
auth_key = nil if auth_key.blank?
|
295
|
+
|
296
|
+
read = nil
|
297
|
+
while !%w(1 0).include? read
|
298
|
+
puts 'Read? [0/1]'
|
299
|
+
read = gets.chomp!
|
300
|
+
end
|
301
|
+
|
302
|
+
write = nil
|
303
|
+
while !%w(1 0).include? write
|
304
|
+
puts 'Write? [0/1]'
|
305
|
+
write = gets.chomp!
|
306
|
+
end
|
307
|
+
|
308
|
+
puts 'TTL [3600]:'
|
309
|
+
ttl = gets.chomp!
|
310
|
+
ttl = 3600 if ttl.blank?
|
311
|
+
|
312
|
+
if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
|
313
|
+
p.grant(:callback => default_cb, :http_sync => false, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key)
|
314
|
+
elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
|
315
|
+
p.grant(:http_sync => false, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
316
|
+
elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
|
317
|
+
p.grant(:callback => default_cb, :http_sync => true, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key)
|
318
|
+
elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
|
319
|
+
p.grant(:http_sync => true, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
320
|
+
end
|
321
|
+
|
322
|
+
when '10' # REVOKE
|
323
|
+
puts 'Enter channel for channel level'
|
324
|
+
channel = gets.chomp!
|
325
|
+
channel = nil if channel.blank?
|
326
|
+
|
327
|
+
puts 'Enter auth key'
|
328
|
+
auth_key = gets.chomp!
|
329
|
+
auth_key = nil if auth_key.blank?
|
330
|
+
|
331
|
+
read = nil
|
332
|
+
while !%w(1 0).include? read
|
333
|
+
puts 'Revoke read? [0/1]'
|
334
|
+
read = gets.chomp!
|
335
|
+
end
|
336
|
+
|
337
|
+
write = nil
|
338
|
+
while !%w(1 0).include? write
|
339
|
+
puts 'Revoke write? [0/1]'
|
340
|
+
write = gets.chomp!
|
341
|
+
end
|
342
|
+
|
343
|
+
puts 'TTL [3600]:'
|
344
|
+
ttl = gets.chomp!
|
345
|
+
ttl = 3600 if ttl.blank?
|
346
|
+
|
347
|
+
if sync_or_async == 'A' && block_or_parameter == 'P' #ASYNC AND CALLBACK AS PASSED AS PARAMETER
|
348
|
+
p.revoke(:callback => default_cb, :http_sync => false, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key)
|
349
|
+
elsif sync_or_async == 'A' && block_or_parameter == 'B' #ASYNC AND CALLBACK AS PASSED AS BLOCK
|
350
|
+
p.revoke(:http_sync => false, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
351
|
+
elsif sync_or_async == 'S' && block_or_parameter == 'P' #SYNC AND CALLBACK AS PASSED AS PARAMETER
|
352
|
+
p.revoke(:callback => default_cb, :http_sync => true, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key)
|
353
|
+
elsif sync_or_async == 'S' && block_or_parameter == 'B' #SYNC AND CALLBACK AS PASSED AS BLOCK
|
354
|
+
p.revoke(:http_sync => true, :ssl => ssl, :channel => channel, :read => read, :write => write, :ttl => ttl, :auth_key => auth_key, &default_cb)#{ |envelope| puts("\nchannel: #{envelope.channel}: \nmsg: #{envelope.message}") }
|
355
|
+
end
|
197
356
|
end
|
198
|
-
end
|
357
|
+
end
|
@@ -0,0 +1,307 @@
|
|
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
|