pubnub 3.6.10 → 3.7.0

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

Potentially problematic release.


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

Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.txt +3 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +144 -10
  5. data/examples/demo_console.rb +61 -23
  6. data/fixtures/vcr_cassettes/cg/add-c-as-array.yml +51 -0
  7. data/fixtures/vcr_cassettes/cg/add-c-as-csv.yml +51 -0
  8. data/fixtures/vcr_cassettes/cg/add-c-as-string.yml +51 -0
  9. data/fixtures/vcr_cassettes/cg/add-c-as-symbol.yml +51 -0
  10. data/fixtures/vcr_cassettes/cg/audit-cg.yml +44 -0
  11. data/fixtures/vcr_cassettes/cg/audit-ns.yml +44 -0
  12. data/fixtures/vcr_cassettes/cg/grant-cg.yml +44 -0
  13. data/fixtures/vcr_cassettes/cg/grant-ns.yml +44 -0
  14. data/fixtures/vcr_cassettes/cg/here_now-cg.yml +51 -0
  15. data/fixtures/vcr_cassettes/cg/leave-cg-c.yml +132 -0
  16. data/fixtures/vcr_cassettes/cg/leave-cg.yml +133 -0
  17. data/fixtures/vcr_cassettes/cg/list-all-c-in-in-ns-cg.yml +50 -0
  18. data/fixtures/vcr_cassettes/cg/list-all-c-in-non-ns-cg.yml +51 -0
  19. data/fixtures/vcr_cassettes/cg/list-all-cg-in-ns.yml +51 -0
  20. data/fixtures/vcr_cassettes/cg/list-all-namespaces.yml +50 -0
  21. data/fixtures/vcr_cassettes/cg/list-all-non-namespaced-cg.yml +49 -0
  22. data/fixtures/vcr_cassettes/cg/remove-c-as-array.yml +51 -0
  23. data/fixtures/vcr_cassettes/cg/remove-c-as-csv.yml +51 -0
  24. data/fixtures/vcr_cassettes/cg/remove-c-as-string.yml +51 -0
  25. data/fixtures/vcr_cassettes/cg/remove-c-as-symbol.yml +51 -0
  26. data/fixtures/vcr_cassettes/cg/remove-cg-from-ns-csv.yml +51 -0
  27. data/fixtures/vcr_cassettes/cg/remove-ns-csv.yml +51 -0
  28. data/fixtures/vcr_cassettes/cg/subscribe-cg-and-channel.yml +85 -0
  29. data/fixtures/vcr_cassettes/cg/subscribe-cg-only.yml +85 -0
  30. data/lib/pubnub/client.rb +6 -2
  31. data/lib/pubnub/envelope.rb +1 -0
  32. data/lib/pubnub/event.rb +105 -20
  33. data/lib/pubnub/events/audit.rb +13 -0
  34. data/lib/pubnub/events/channel_registration.rb +132 -0
  35. data/lib/pubnub/events/grant.rb +17 -7
  36. data/lib/pubnub/events/heartbeat.rb +29 -3
  37. data/lib/pubnub/events/here_now.rb +21 -7
  38. data/lib/pubnub/events/leave.rb +27 -3
  39. data/lib/pubnub/events/presence.rb +4 -3
  40. data/lib/pubnub/events/set_state.rb +16 -3
  41. data/lib/pubnub/events/state.rb +15 -9
  42. data/lib/pubnub/events/subscribe.rb +17 -3
  43. data/lib/pubnub/formatter.rb +31 -7
  44. data/lib/pubnub/pam.rb +4 -3
  45. data/lib/pubnub/version.rb +1 -1
  46. data/spec/lib/integration/channel_groups_spec.rb +120 -0
  47. data/spec/lib/integration/channel_registration_spec.rb +317 -0
  48. data/spec/spec_helper.rb +0 -1
  49. metadata +31 -2
@@ -0,0 +1,51 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://pubsub.pubnub.com/v1/channel-registration/sub-key/demo/namespace/foo/channel-group/foo?add=one,two&pnsdk=PubNub-Ruby/3.7.0beta0&uuid=8042ab9b-b24d-4651-b691-c4927f94cd7e
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Connection:
17
+ - keep-alive
18
+ Keep-Alive:
19
+ - 30
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Tue, 04 Nov 2014 13:42:22 GMT
27
+ Content-Type:
28
+ - text/javascript; charset="UTF-8"
29
+ Content-Length:
30
+ - '79'
31
+ Connection:
32
+ - keep-alive
33
+ Cache-Control:
34
+ - no-cache
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ Access-Control-Allow-Methods:
38
+ - GET
39
+ Accept-Ranges:
40
+ - bytes
41
+ Age:
42
+ - '0'
43
+ Server:
44
+ - Pubnub
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"status": 200, "message": "OK", "service": "channel-registry", "error":
48
+ false}'
49
+ http_version:
50
+ recorded_at: Tue, 04 Nov 2014 13:42:22 GMT
51
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,51 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://pubsub.pubnub.com/v1/channel-registration/sub-key/demo/namespace/foo/channel-group/foo?add=one&pnsdk=PubNub-Ruby/3.7.0beta0&uuid=9b60e183-4d0a-4ac5-b8e6-d76d435860fa
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Connection:
17
+ - keep-alive
18
+ Keep-Alive:
19
+ - 30
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Tue, 04 Nov 2014 13:42:22 GMT
27
+ Content-Type:
28
+ - text/javascript; charset="UTF-8"
29
+ Content-Length:
30
+ - '79'
31
+ Connection:
32
+ - keep-alive
33
+ Cache-Control:
34
+ - no-cache
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ Access-Control-Allow-Methods:
38
+ - GET
39
+ Accept-Ranges:
40
+ - bytes
41
+ Age:
42
+ - '0'
43
+ Server:
44
+ - Pubnub
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"status": 200, "message": "OK", "service": "channel-registry", "error":
48
+ false}'
49
+ http_version:
50
+ recorded_at: Tue, 04 Nov 2014 13:42:22 GMT
51
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,51 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://pubsub.pubnub.com/v1/channel-registration/sub-key/demo/namespace/foo/channel-group/foo?add=one&pnsdk=PubNub-Ruby/3.7.0beta0&uuid=e804a04e-0060-4fbb-a1ca-262bffe516cf
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Connection:
17
+ - keep-alive
18
+ Keep-Alive:
19
+ - 30
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Tue, 04 Nov 2014 13:42:21 GMT
27
+ Content-Type:
28
+ - text/javascript; charset="UTF-8"
29
+ Content-Length:
30
+ - '79'
31
+ Connection:
32
+ - keep-alive
33
+ Cache-Control:
34
+ - no-cache
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ Access-Control-Allow-Methods:
38
+ - GET
39
+ Accept-Ranges:
40
+ - bytes
41
+ Age:
42
+ - '0'
43
+ Server:
44
+ - Pubnub
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"status": 200, "message": "OK", "service": "channel-registry", "error":
48
+ false}'
49
+ http_version:
50
+ recorded_at: Tue, 04 Nov 2014 13:42:21 GMT
51
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://pubsub.pubnub.com/v1/auth/audit/sub-key/sub-c-53c3d30a-4135-11e3-9970-02ee2ddab7fe?channel-group=foo:foo&pnsdk=PubNub-Ruby/3.7.0beta0&signature=sig&timestamp=1234567890&uuid=18cad71e-8d61-445f-88f2-7bbe9f3643ed
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Connection:
17
+ - keep-alive
18
+ Keep-Alive:
19
+ - 30
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Wed, 05 Nov 2014 15:33:40 GMT
27
+ Content-Type:
28
+ - text/javascript; charset=UTF-8
29
+ Content-Length:
30
+ - '218'
31
+ Connection:
32
+ - keep-alive
33
+ Cache-Control:
34
+ - no-cache, no-store, must-revalidate
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ Access-Control-Allow-Methods:
38
+ - GET
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"status":200,"service":"Access Manager","message":"Success","payload":{"channel-groups":{"foo:foo":{"r":1,"m":1,"w":1,"ttl":1440}},"subscribe_key":"sub-c-53c3d30a-4135-11e3-9970-02ee2ddab7fe","level":"channel-group"}}'
42
+ http_version:
43
+ recorded_at: Wed, 05 Nov 2014 15:33:40 GMT
44
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://pubsub.pubnub.com/v1/auth/audit/sub-key/sub-c-53c3d30a-4135-11e3-9970-02ee2ddab7fe?channel-group=foo:&pnsdk=PubNub-Ruby/3.7.0beta0&signature=sig=&timestamp=1234567890&uuid=014a9ab2-699c-4a2f-adee-6131321611b2
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Connection:
17
+ - keep-alive
18
+ Keep-Alive:
19
+ - 30
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Wed, 05 Nov 2014 15:33:41 GMT
27
+ Content-Type:
28
+ - text/javascript; charset=UTF-8
29
+ Content-Length:
30
+ - '215'
31
+ Connection:
32
+ - keep-alive
33
+ Cache-Control:
34
+ - no-cache, no-store, must-revalidate
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ Access-Control-Allow-Methods:
38
+ - GET
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"status":200,"service":"Access Manager","message":"Success","payload":{"channel-groups":{"foo:":{"r":1,"m":1,"w":1,"ttl":1440}},"subscribe_key":"sub-c-53c3d30a-4135-11e3-9970-02ee2ddab7fe","level":"channel-group"}}'
42
+ http_version:
43
+ recorded_at: Wed, 05 Nov 2014 15:33:41 GMT
44
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://pubsub.pubnub.com/v1/auth/grant/sub-key/sub-c-53c3d30a-4135-11e3-9970-02ee2ddab7fe?channel-group=foo:foo&m=1&pnsdk=PubNub-Ruby/3.7.0beta0&r=1&signature=sig&timestamp=1234567890&ttl=1440&uuid=3cd777d2-d149-4c6f-be96-db20d67ecc34&w=1
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Connection:
17
+ - keep-alive
18
+ Keep-Alive:
19
+ - 30
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Wed, 05 Nov 2014 15:33:38 GMT
27
+ Content-Type:
28
+ - text/javascript; charset=UTF-8
29
+ Content-Length:
30
+ - '218'
31
+ Connection:
32
+ - keep-alive
33
+ Cache-Control:
34
+ - no-cache, no-store, must-revalidate
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ Access-Control-Allow-Methods:
38
+ - GET
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"status":200,"service":"Access Manager","message":"Success","payload":{"channel-groups":{"foo:foo":{"r":1,"m":1,"w":1}},"subscribe_key":"sub-c-53c3d30a-4135-11e3-9970-02ee2ddab7fe","ttl":1440,"level":"channel-group"}}'
42
+ http_version:
43
+ recorded_at: Wed, 05 Nov 2014 15:33:38 GMT
44
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://pubsub.pubnub.com/v1/auth/grant/sub-key/sub-c-53c3d30a-4135-11e3-9970-02ee2ddab7fe?channel-group=foo:&m=1&pnsdk=PubNub-Ruby/3.7.0beta0&r=1&signature=sig&timestamp=1234567890&ttl=1440&uuid=a22ad367-6b45-419d-ae17-6ae02bfeb59f&w=1
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Connection:
17
+ - keep-alive
18
+ Keep-Alive:
19
+ - 30
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Wed, 05 Nov 2014 15:33:39 GMT
27
+ Content-Type:
28
+ - text/javascript; charset=UTF-8
29
+ Content-Length:
30
+ - '215'
31
+ Connection:
32
+ - keep-alive
33
+ Cache-Control:
34
+ - no-cache, no-store, must-revalidate
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ Access-Control-Allow-Methods:
38
+ - GET
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"status":200,"service":"Access Manager","message":"Success","payload":{"channel-groups":{"foo:":{"r":1,"m":1,"w":1}},"subscribe_key":"sub-c-53c3d30a-4135-11e3-9970-02ee2ddab7fe","ttl":1440,"level":"channel-group"}}'
42
+ http_version:
43
+ recorded_at: Wed, 05 Nov 2014 15:33:39 GMT
44
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,51 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://pubsub.pubnub.com/v2/presence/sub-key/demo/channel/,?channel-group=foo:&pnsdk=PubNub-Ruby/3.7.0beta0&uuid=40d6b349-bd9b-403a-bfd5-1a0956aa722a
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Connection:
17
+ - keep-alive
18
+ Keep-Alive:
19
+ - 30
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Wed, 05 Nov 2014 13:40:51 GMT
27
+ Content-Type:
28
+ - text/javascript; charset="UTF-8"
29
+ Content-Length:
30
+ - '127'
31
+ Connection:
32
+ - keep-alive
33
+ Access-Control-Allow-Origin:
34
+ - "*"
35
+ Access-Control-Allow-Methods:
36
+ - GET
37
+ Cache-Control:
38
+ - no-cache
39
+ Accept-Ranges:
40
+ - bytes
41
+ Age:
42
+ - '0'
43
+ Server:
44
+ - Pubnub Presence
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"status": 200, "message": "OK", "payload": {"channels": {}, "total_channels":
48
+ 0, "total_occupancy": 0}, "service": "Presence"}'
49
+ http_version:
50
+ recorded_at: Wed, 05 Nov 2014 13:40:51 GMT
51
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,132 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://pubsub.pubnub.com/subscribe/demo/,/0/0?channel-group=foo:foo&pnsdk=PubNub-Ruby/3.7.0beta0&uuid=8d85b2a3-6cfb-49a8-8c79-9d9547ef32b3
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Connection:
17
+ - keep-alive
18
+ Keep-Alive:
19
+ - 30
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Wed, 05 Nov 2014 13:49:15 GMT
27
+ Content-Type:
28
+ - text/javascript; charset="UTF-8"
29
+ Content-Length:
30
+ - '24'
31
+ Connection:
32
+ - keep-alive
33
+ Cache-Control:
34
+ - no-cache
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ Access-Control-Allow-Methods:
38
+ - GET
39
+ body:
40
+ encoding: UTF-8
41
+ string: '[[],"14151953545346313"]'
42
+ http_version:
43
+ recorded_at: Wed, 05 Nov 2014 13:49:15 GMT
44
+ - request:
45
+ method: get
46
+ uri: http://pubsub.pubnub.com/subscribe/demo/,/0/14151953545346313?channel-group=foo:foo&pnsdk=PubNub-Ruby/3.7.0beta0&uuid=8d85b2a3-6cfb-49a8-8c79-9d9547ef32b3
47
+ body:
48
+ encoding: US-ASCII
49
+ string: ''
50
+ headers:
51
+ Accept-Encoding:
52
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
53
+ Accept:
54
+ - "*/*"
55
+ User-Agent:
56
+ - Ruby
57
+ Connection:
58
+ - keep-alive
59
+ Keep-Alive:
60
+ - 30
61
+ response:
62
+ status:
63
+ code: 200
64
+ message: OK
65
+ headers:
66
+ Date:
67
+ - Wed, 05 Nov 2014 13:49:15 GMT
68
+ Content-Type:
69
+ - text/javascript; charset="UTF-8"
70
+ Content-Length:
71
+ - '84'
72
+ Connection:
73
+ - keep-alive
74
+ Cache-Control:
75
+ - no-cache
76
+ Access-Control-Allow-Origin:
77
+ - "*"
78
+ Access-Control-Allow-Methods:
79
+ - GET
80
+ body:
81
+ encoding: UTF-8
82
+ string: '[["**************. 9574 - 2014-11-05 05:49:15"],"14151953557143954","foo:foo","bot"]'
83
+ http_version:
84
+ recorded_at: Wed, 05 Nov 2014 13:49:15 GMT
85
+ - request:
86
+ method: get
87
+ uri: http://pubsub.pubnub.com/v2/presence/sub-key/demo/channel/,/leave?channel_group=foo:foo&pnsdk=PubNub-Ruby/3.7.0beta0&uuid=8d85b2a3-6cfb-49a8-8c79-9d9547ef32b3
88
+ body:
89
+ encoding: US-ASCII
90
+ string: ''
91
+ headers:
92
+ Accept-Encoding:
93
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
94
+ Accept:
95
+ - "*/*"
96
+ User-Agent:
97
+ - Ruby
98
+ Connection:
99
+ - keep-alive
100
+ Keep-Alive:
101
+ - 30
102
+ response:
103
+ status:
104
+ code: 200
105
+ message: OK
106
+ headers:
107
+ Date:
108
+ - Wed, 05 Nov 2014 13:49:16 GMT
109
+ Content-Type:
110
+ - text/javascript; charset="UTF-8"
111
+ Content-Length:
112
+ - '74'
113
+ Connection:
114
+ - keep-alive
115
+ Access-Control-Allow-Origin:
116
+ - "*"
117
+ Access-Control-Allow-Methods:
118
+ - GET
119
+ Cache-Control:
120
+ - no-cache
121
+ Accept-Ranges:
122
+ - bytes
123
+ Age:
124
+ - '0'
125
+ Server:
126
+ - Pubnub Presence
127
+ body:
128
+ encoding: UTF-8
129
+ string: '{"status": 200, "action": "leave", "message": "OK", "service": "Presence"}'
130
+ http_version:
131
+ recorded_at: Wed, 05 Nov 2014 13:49:16 GMT
132
+ recorded_with: VCR 2.9.2