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,133 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://pubsub.pubnub.com/subscribe/demo/bot/0/0?channel-group=foo:foo&pnsdk=PubNub-Ruby/3.7.0beta0&uuid=ad98bd19-59e9-4f78-89b6-e34ec1fca7e2
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:13 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: '[[],"14151953532642307"]'
42
+ http_version:
43
+ recorded_at: Wed, 05 Nov 2014 13:49:13 GMT
44
+ - request:
45
+ method: get
46
+ uri: http://pubsub.pubnub.com/subscribe/demo/bot/0/14151953532642307?channel-group=foo:foo&pnsdk=PubNub-Ruby/3.7.0beta0&uuid=ad98bd19-59e9-4f78-89b6-e34ec1fca7e2
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:13 GMT
68
+ Content-Type:
69
+ - text/javascript; charset="UTF-8"
70
+ Content-Length:
71
+ - '141'
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: '[["************... 9572 - 2014-11-05 05:49:13","************... 9572
83
+ - 2014-11-05 05:49:13"],"14151953533623201","foo:foo,foo:foo","bot,bot"]'
84
+ http_version:
85
+ recorded_at: Wed, 05 Nov 2014 13:49:13 GMT
86
+ - request:
87
+ method: get
88
+ uri: http://pubsub.pubnub.com/v2/presence/sub-key/demo/channel/bot/leave?channel_group=foo:foo&pnsdk=PubNub-Ruby/3.7.0beta0&uuid=ad98bd19-59e9-4f78-89b6-e34ec1fca7e2
89
+ body:
90
+ encoding: US-ASCII
91
+ string: ''
92
+ headers:
93
+ Accept-Encoding:
94
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
95
+ Accept:
96
+ - "*/*"
97
+ User-Agent:
98
+ - Ruby
99
+ Connection:
100
+ - keep-alive
101
+ Keep-Alive:
102
+ - 30
103
+ response:
104
+ status:
105
+ code: 200
106
+ message: OK
107
+ headers:
108
+ Date:
109
+ - Wed, 05 Nov 2014 13:49:14 GMT
110
+ Content-Type:
111
+ - text/javascript; charset="UTF-8"
112
+ Content-Length:
113
+ - '74'
114
+ Connection:
115
+ - keep-alive
116
+ Access-Control-Allow-Origin:
117
+ - "*"
118
+ Access-Control-Allow-Methods:
119
+ - GET
120
+ Cache-Control:
121
+ - no-cache
122
+ Accept-Ranges:
123
+ - bytes
124
+ Age:
125
+ - '0'
126
+ Server:
127
+ - Pubnub Presence
128
+ body:
129
+ encoding: UTF-8
130
+ string: '{"status": 200, "action": "leave", "message": "OK", "service": "Presence"}'
131
+ http_version:
132
+ recorded_at: Wed, 05 Nov 2014 13:49:14 GMT
133
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,50 @@
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?pnsdk=PubNub-Ruby/3.7.0beta0&uuid=833d2fcd-eacf-4d39-889e-069622e10be7
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:13:32 GMT
27
+ Content-Type:
28
+ - text/javascript; charset="UTF-8"
29
+ Content-Length:
30
+ - '138'
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, "payload": {"channels": ["aaa", "bbb"], "group": "foo"}, "service": "channel-registry", "error": false}'
48
+ http_version:
49
+ recorded_at: Tue, 04 Nov 2014 13:13:32 GMT
50
+ 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/channel-group/cg?pnsdk=PubNub-Ruby/3.7.0beta0&uuid=05b1b237-954e-4d0f-bf8b-81a89bf1e861
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:19:55 GMT
27
+ Content-Type:
28
+ - text/javascript; charset="UTF-8"
29
+ Content-Length:
30
+ - '124'
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, "payload": {"channels": ["ping_3", "x", "z"], "group":
48
+ "cg"}, "service": "channel-registry", "error": false}'
49
+ http_version:
50
+ recorded_at: Tue, 04 Nov 2014 13:19:55 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?pnsdk=PubNub-Ruby/3.7.0beta0&uuid=8d1ed5e2-b4ea-437e-a9bf-67a5ababf59e
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:08:52 GMT
27
+ Content-Type:
28
+ - text/javascript; charset="UTF-8"
29
+ Content-Length:
30
+ - '127'
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, "payload": {"namespace": "foo", "groups": ["foo", "new_group"]},
48
+ "service": "channel-registry", "error": false}'
49
+ http_version:
50
+ recorded_at: Tue, 04 Nov 2014 13:08:52 GMT
51
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://pubsub.pubnub.com/v1/channel-registration/sub-key/demo/namespace?pnsdk=PubNub-Ruby/3.7.0beta0&uuid=784ee957-890d-4ddf-baec-75fa38b4d013
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 12:36:57 GMT
27
+ Content-Type:
28
+ - text/javascript; charset="UTF-8"
29
+ Transfer-Encoding:
30
+ - chunked
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
+ Age:
40
+ - '0'
41
+ Server:
42
+ - Pubnub
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"status": 200, "payload": {"sub_key": "demo", "namespaces": ["foo",
46
+ "namespace_test"]}, "service":
47
+ "channel-registry", "error": false}'
48
+ http_version:
49
+ recorded_at: Tue, 04 Nov 2014 12:36:57 GMT
50
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://pubsub.pubnub.com/v1/channel-registration/sub-key/demo/channel-group?pnsdk=PubNub-Ruby/3.7.0beta0&uuid=f06359e1-f1ef-4e2c-a53f-c7a5ada822df
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:04:07 GMT
27
+ Content-Type:
28
+ - text/javascript; charset="UTF-8"
29
+ Transfer-Encoding:
30
+ - chunked
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
+ Age:
40
+ - '0'
41
+ Server:
42
+ - Pubnub
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"status": 200, "payload": {"namespace": "", "groups": ["cg", "dk1"]}, "service": "channel-registry", "error":
46
+ false}'
47
+ http_version:
48
+ recorded_at: Tue, 04 Nov 2014 13:04:07 GMT
49
+ 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?pnsdk=PubNub-Ruby/3.7.0beta0&remove=one,two&uuid=494e7d93-cfdf-45da-9e39-a05f08292c92
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 14:19:29 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 14:19:30 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?pnsdk=PubNub-Ruby/3.7.0beta0&remove=one,two&uuid=d23f5a94-093b-41c5-982e-e4370f8a9dc4
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 14:19:30 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 14:19:30 GMT
51
+ recorded_with: VCR 2.9.2