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.

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