opentok 3.0.3 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +249 -14
  3. data/lib/opentok/archive.rb +45 -4
  4. data/lib/opentok/archives.rb +62 -5
  5. data/lib/opentok/broadcast.rb +118 -0
  6. data/lib/opentok/broadcasts.rb +149 -0
  7. data/lib/opentok/client.rb +206 -3
  8. data/lib/opentok/connections.rb +28 -0
  9. data/lib/opentok/exceptions.rb +6 -0
  10. data/lib/opentok/opentok.rb +40 -8
  11. data/lib/opentok/session.rb +5 -0
  12. data/lib/opentok/signals.rb +47 -0
  13. data/lib/opentok/sip.rb +35 -0
  14. data/lib/opentok/stream.rb +46 -0
  15. data/lib/opentok/stream_list.rb +18 -0
  16. data/lib/opentok/streams.rb +79 -0
  17. data/lib/opentok/version.rb +1 -1
  18. data/spec/cassettes/OpenTok_Archives/calls_layout_on_archive_object.yml +45 -0
  19. data/spec/cassettes/OpenTok_Archives/changes_the_layout_of_an_archive.yml +36 -0
  20. data/spec/cassettes/OpenTok_Archives/should_create_hd_archives.yml +52 -0
  21. data/spec/cassettes/OpenTok_Broadcasts/calls_layout_on_broadcast_object.yml +55 -0
  22. data/spec/cassettes/OpenTok_Broadcasts/changes_the_layout_of_a_broadcast.yml +36 -0
  23. data/spec/cassettes/OpenTok_Broadcasts/fetches_a_hls_broadcast_url.yml +50 -0
  24. data/spec/cassettes/OpenTok_Broadcasts/finds_a_broadcast.yml +55 -0
  25. data/spec/cassettes/OpenTok_Broadcasts/starts_a_rtmp_broadcast.yml +59 -0
  26. data/spec/cassettes/OpenTok_Broadcasts/stops_a_broadcast.yml +45 -0
  27. data/spec/cassettes/OpenTok_Connections/forces_a_connection_to_be_terminated.yml +36 -0
  28. data/spec/cassettes/OpenTok_Signals/receives_a_valid_response_for_a_connection.yml +37 -0
  29. data/spec/cassettes/OpenTok_Signals/receives_a_valid_response_for_all_connections.yml +37 -0
  30. data/spec/cassettes/OpenTok_Streams/get_all_streams_information.yml +53 -0
  31. data/spec/cassettes/OpenTok_Streams/get_specific_stream_information.yml +42 -0
  32. data/spec/cassettes/OpenTok_Streams/layout_working_on_two_stream_list.yml +36 -0
  33. data/spec/opentok/archives_spec.rb +73 -0
  34. data/spec/opentok/broadcasts_spec.rb +171 -0
  35. data/spec/opentok/connection_spec.rb +38 -0
  36. data/spec/opentok/signal_spec.rb +50 -0
  37. data/spec/opentok/streams_spec.rb +75 -0
  38. metadata +48 -3
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://api.opentok.com/v2/project/123456/archive/30b3ebf1-ba36-4f5b-8def-6f70d9986fe9/layout
6
+ body:
7
+ encoding: US-ASCII
8
+ string: '{"type":"pip"}'
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImlzdCI6InByb2plY3QifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.Oh_JHhtEUKK1pPV4s6neXJj_RXI8EcEpJRRpG_2c9U0
14
+ Content-Type:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Wed, 26 Sep 2018 18:22:36 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Connection:
28
+ - keep-alive
29
+ Content-Length:
30
+ - '73'
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"code":-1,"message":"Issuer not found","description":"Issuer not found"}'
34
+ http_version:
35
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
36
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/v2/project/123456/archive
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"sessionId":"SESSIONID","outputMode":"composed","resolution":"1280x720"}'
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImlzdCI6InByb2plY3QifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.Oh_JHhtEUKK1pPV4s6neXJj_RXI8EcEpJRRpG_2c9U0
14
+ Content-Type:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Fri, 21 Sep 2018 16:54:25 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: |-
34
+ {
35
+ "createdAt" : 1395193762293,
36
+ "duration" : 0,
37
+ "id" : "d7f4d2a3-da74-414d-868a-190532a835bc",
38
+ "name" : "ARCHIVE NAME",
39
+ "partnerId" : 123456,
40
+ "reason" : "",
41
+ "sessionId" : "SESSIONID",
42
+ "size" : 0,
43
+ "status" : "started",
44
+ "url" : null,
45
+ "hasAudio" : true,
46
+ "hasVideo" : false,
47
+ "outputMode": "composed",
48
+ "resolution": "1280x720"
49
+ }
50
+ http_version:
51
+ recorded_at: Fri, 21 Sep 2018 16:54:25 GMT
52
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.opentok.com/v2/project/123456/broadcast/13dbcc23-af92-4862-9184-74b21815a814
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImlzdCI6InByb2plY3QifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.Oh_JHhtEUKK1pPV4s6neXJj_RXI8EcEpJRRpG_2c9U0
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - nginx
21
+ Date:
22
+ - Fri, 28 Sep 2018 20:45:36 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Connection:
26
+ - keep-alive
27
+ body:
28
+ encoding: UTF-8
29
+ string: |-
30
+ {
31
+ "id":"13dbcc23-af92-4862-9184-74b21815a814",
32
+ "sessionId":"SESSIONID",
33
+ "projectId":123456,
34
+ "createdAt":1538160235541,
35
+ "broadcastUrls":{
36
+ "rtmp":[
37
+ {
38
+ "status":"live",
39
+ "id":"rubyTestStream",
40
+ "serverUrl":"rtmp://x.rtmp.youtube.com/live2",
41
+ "streamName":"66c9-jwuh-pquf-9x18"
42
+ }
43
+ ],
44
+ "hls":"https://cdn-broadcast001-pdx.tokbox.com/14935/14935_77e4e8e8-0c8b-4cea-b579-0560875f7123.smil/playlist.m3u8"
45
+ },
46
+ "updatedAt":1538160235541,
47
+ "status":"started",
48
+ "maxDuration":7200,
49
+ "resolution":"640x480",
50
+ "partnerId":123456,
51
+ "event":"broadcast"
52
+ }
53
+ http_version:
54
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
55
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://api.opentok.com/v2/project/123456/broadcast/13dbcc23-af92-4862-9184-74b21815a814/layout
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"verticalPresentation"}'
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImlzdCI6InByb2plY3QifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.Oh_JHhtEUKK1pPV4s6neXJj_RXI8EcEpJRRpG_2c9U0
14
+ Content-Type:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Fri, 28 Sep 2018 20:40:56 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Connection:
28
+ - keep-alive
29
+ Content-Length:
30
+ - '73'
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"code":-1,"message":"Issuer not found","description":"Issuer not found"}'
34
+ http_version:
35
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
36
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/v2/project/123456/broadcast
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"sessionId":"SESSIONID","outputs":{"hls":{}}}'
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImlzdCI6InByb2plY3QifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.Oh_JHhtEUKK1pPV4s6neXJj_RXI8EcEpJRRpG_2c9U0
14
+ Content-Type:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Thu, 27 Sep 2018 22:34:34 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Connection:
28
+ - keep-alive
29
+ body:
30
+ encoding: UTF-8
31
+ string: |-
32
+ {
33
+ "id":"BROADCASTID",
34
+ "sessionId":"SESSIONID",
35
+ "projectId":123456,
36
+ "createdAt":1538086900154,
37
+ "broadcastUrls":
38
+ {
39
+ "hls":"https://cdn-broadcast001-pdx.tokbox.com/14787/14787_b930bf08-1c9f-4c55-ab04-7d192578c057.smil/playlist.m3u8"
40
+ },
41
+ "updatedAt":1538086900489,
42
+ "status":"started",
43
+ "maxDuration":7200,
44
+ "resolution":"640x480",
45
+ "partnerId":100,
46
+ "event":"broadcast"
47
+ }
48
+ http_version:
49
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
50
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.opentok.com/v2/project/123456/broadcast/13dbcc23-af92-4862-9184-74b21815a814
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImlzdCI6InByb2plY3QifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.Oh_JHhtEUKK1pPV4s6neXJj_RXI8EcEpJRRpG_2c9U0
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - nginx
21
+ Date:
22
+ - Fri, 28 Sep 2018 18:46:21 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Connection:
26
+ - keep-alive
27
+ body:
28
+ encoding: UTF-8
29
+ string: |-
30
+ {
31
+ "id":"13dbcc23-af92-4862-9184-74b21815a814",
32
+ "sessionId":"SESSIONID",
33
+ "projectId":123456,
34
+ "createdAt":1538160235541,
35
+ "broadcastUrls":{
36
+ "rtmp":[
37
+ {
38
+ "status":"live",
39
+ "id":"rubyTestStream",
40
+ "serverUrl":"rtmp://x.rtmp.youtube.com/live2",
41
+ "streamName":"66c9-jwuh-pquf-9x18"
42
+ }
43
+ ],
44
+ "hls":"https://cdn-broadcast001-pdx.tokbox.com/14935/14935_77e4e8e8-0c8b-4cea-b579-0560875f7123.smil/playlist.m3u8"
45
+ },
46
+ "updatedAt":1538160235541,
47
+ "status":"started",
48
+ "maxDuration":7200,
49
+ "resolution":"640x480",
50
+ "partnerId":123456,
51
+ "event":"broadcast"
52
+ }
53
+ http_version:
54
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
55
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/v2/project/123456/broadcast
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"sessionId":"SESSIONID","outputs":{"hls":{},"rtmp":[{"id":"rubyTestStream","serverUrl":"rtmp://x.rtmp.youtube.com/live2","streamName":"66c9-jwuh-pquf-9x18"}]}}'
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImlzdCI6InByb2plY3QifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.Oh_JHhtEUKK1pPV4s6neXJj_RXI8EcEpJRRpG_2c9U0
14
+ Content-Type:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Thu, 27 Sep 2018 23:10:28 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Connection:
28
+ - keep-alive
29
+ body:
30
+ encoding: UTF-8
31
+ string: |-
32
+ {
33
+ "id":"BROADCASTID",
34
+ "sessionId":"SESSIONID",
35
+ "projectId":123456,
36
+ "createdAt":1538086900154,
37
+ "broadcastUrls":
38
+ {
39
+ "hls":"https://cdn-broadcast001-pdx.tokbox.com/14787/14787_b930bf08-1c9f-4c55-ab04-7d192578c057.smil/playlist.m3u8",
40
+ "rtmp":
41
+ [
42
+ {
43
+ "status":"connecting",
44
+ "id":"rubyTestStream",
45
+ "serverUrl":"rtmp://x.rtmp.youtube.com/live2",
46
+ "streamName":"66c9-jwuh-pquf-9x18"
47
+ }
48
+ ]
49
+ },
50
+ "updatedAt":1538086900489,
51
+ "status":"started",
52
+ "maxDuration":7200,
53
+ "resolution":"640x480",
54
+ "partnerId":100,
55
+ "event":"broadcast"
56
+ }
57
+ http_version:
58
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
59
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,45 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/v2/project/123456/broadcast/13dbcc23-af92-4862-9184-74b21815a814/stop
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImlzdCI6InByb2plY3QifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.Oh_JHhtEUKK1pPV4s6neXJj_RXI8EcEpJRRpG_2c9U0
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - nginx
21
+ Date:
22
+ - Fri, 28 Sep 2018 19:23:21 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Connection:
26
+ - keep-alive
27
+ body:
28
+ encoding: UTF-8
29
+ string: |-
30
+ {
31
+ "id":"13dbcc23-af92-4862-9184-74b21815a814",
32
+ "sessionId":"SESSIONID",
33
+ "projectId":123456,
34
+ "createdAt":1538162113387,
35
+ "broadcastUrls":null,
36
+ "updatedAt":1538162113387,
37
+ "status":"stopped",
38
+ "maxDuration":7200,
39
+ "resolution":"640x480",
40
+ "event":"broadcast",
41
+ "partnerId":123456
42
+ }
43
+ http_version:
44
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
45
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: https://api.opentok.com/v2/project/123456/session/SESSIONID/connection/CONNID
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImlzdCI6InByb2plY3QifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.Oh_JHhtEUKK1pPV4s6neXJj_RXI8EcEpJRRpG_2c9U0
14
+ Content-Type:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 204
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Wed, 29 Aug 2018 19:41:26 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Connection:
28
+ - keep-alive
29
+ Content-Length:
30
+ - '73'
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"code":-1,"message":"Issuer not found","description":"Issuer not found"}'
34
+ http_version:
35
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
36
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/v2/project/123456/session/SESSIONID/connection/CONNID/signal
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"chat","data":"Hello"}'
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImlzdCI6InByb2plY3QifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.Oh_JHhtEUKK1pPV4s6neXJj_RXI8EcEpJRRpG_2c9U0
14
+ Content-Type:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 204
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Tue, 28 Aug 2018 22:01:54 GMT
25
+ Content-Type:
26
+ - application/xml
27
+ Connection:
28
+ - keep-alive
29
+ Content-Length:
30
+ - '177'
31
+ body:
32
+ encoding: UTF-8
33
+ string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><errorPayload><code>-1</code><message>Issuer
34
+ not found</message><description>Issuer not found</description></errorPayload>
35
+ http_version:
36
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
37
+ recorded_with: VCR 2.8.0