opentok 4.1.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +30 -0
  3. data/.github/workflows/metrics.yml +17 -0
  4. data/CHANGES.md +153 -0
  5. data/README.md +3 -1
  6. data/lib/opentok/archive.rb +50 -3
  7. data/lib/opentok/archives.rb +104 -7
  8. data/lib/opentok/broadcast.rb +44 -1
  9. data/lib/opentok/broadcast_list.rb +14 -0
  10. data/lib/opentok/broadcasts.rb +131 -13
  11. data/lib/opentok/client.rb +161 -0
  12. data/lib/opentok/connections.rb +1 -1
  13. data/lib/opentok/constants.rb +1 -0
  14. data/lib/opentok/opentok.rb +8 -8
  15. data/lib/opentok/sip.rb +40 -2
  16. data/lib/opentok/streams.rb +50 -1
  17. data/lib/opentok/token_generator.rb +1 -0
  18. data/lib/opentok/version.rb +1 -1
  19. data/opentok.gemspec +1 -1
  20. data/sample/Broadcast/README.md +42 -0
  21. data/sample/Broadcast/broadcast_sample.rb +15 -0
  22. data/sample/Broadcast/views/all.erb +46 -0
  23. data/sample/Broadcast/views/index.erb +16 -1
  24. data/spec/cassettes/OpenTok_Archives/adds_a_stream_to_an_archive.yml +37 -0
  25. data/spec/cassettes/OpenTok_Archives/removes_a_stream_from_an_archive.yml +37 -0
  26. data/spec/cassettes/OpenTok_Archives/should_create_layout_archives_with_screenshare_layout_types.yml +50 -0
  27. data/spec/cassettes/OpenTok_Broadcasts/adds_a_stream_to_a_broadcast.yml +37 -0
  28. data/spec/cassettes/OpenTok_Broadcasts/for_many_broadcasts/should_return_all_broadcasts.yml +192 -0
  29. data/spec/cassettes/OpenTok_Broadcasts/for_many_broadcasts/should_return_broadcasts_with_an_offset.yml +117 -0
  30. data/spec/cassettes/OpenTok_Broadcasts/for_many_broadcasts/should_return_count_number_of_broadcasts.yml +92 -0
  31. data/spec/cassettes/OpenTok_Broadcasts/for_many_broadcasts/should_return_part_of_the_broadcasts_when_using_offset_and_count.yml +142 -0
  32. data/spec/cassettes/OpenTok_Broadcasts/for_many_broadcasts/should_return_session_broadcasts.yml +117 -0
  33. data/spec/cassettes/OpenTok_Broadcasts/removes_a_stream_from_a_broadcast.yml +37 -0
  34. data/spec/cassettes/OpenTok_Sip/_play_dtmf_to_connection/returns_a_200_response_code_when_passed_a_valid_dtmf_digit_string.yml +39 -0
  35. data/spec/cassettes/OpenTok_Sip/_play_dtmf_to_session/returns_a_200_response_code_when_passed_a_valid_dtmf_digit_string.yml +39 -0
  36. data/spec/cassettes/OpenTok_Sip/receives_a_valid_response.yml +2 -2
  37. data/spec/cassettes/OpenTok_Streams/disables_the_mute_state_of_a_session.yml +37 -0
  38. data/spec/cassettes/OpenTok_Streams/forces_all_current_and_future_streams_in_a_session_to_be_muted.yml +39 -0
  39. data/spec/cassettes/OpenTok_Streams/forces_all_current_and_future_streams_in_a_session_to_be_muted_except_specified_excluded_streams.yml +39 -0
  40. data/spec/cassettes/OpenTok_Streams/forces_the_specified_stream_to_be_muted.yml +39 -0
  41. data/spec/opentok/archives_spec.rb +40 -0
  42. data/spec/opentok/broadcasts_spec.rb +103 -1
  43. data/spec/opentok/connection_spec.rb +1 -1
  44. data/spec/opentok/opentok_spec.rb +6 -0
  45. data/spec/opentok/sip_spec.rb +32 -1
  46. data/spec/opentok/streams_spec.rb +21 -1
  47. metadata +42 -6
  48. data/.travis.yml +0 -17
@@ -0,0 +1,142 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.opentok.com/v2/project/123456/broadcast?count=4&offset=2
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Fri, 21 Jan 2022 12:05:21 GMT
27
+ Content-Type:
28
+ - application/json
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: |-
36
+ {
37
+ "count" : 4,
38
+ "items" : [ {
39
+ "id" : "ef546c5a-4fd7-4e59-ab3d-f1cfb4148d1d",
40
+ "sessionId" : "SESSIONID",
41
+ "projectId": 123456,
42
+ "createdAt" : 1395187836000,
43
+ "updatedAt": 1395187836000,
44
+ "resolution": "640x480",
45
+ "broadcastUrls": {
46
+ "hls" : "http://tokbox.com.broadcast2.s3.amazonaws.com/123456%2Ff6e7ee58-d6cf-4a59-896b-6d56b158ec71.m3u8",
47
+ "rtmp": {
48
+ "foo": {
49
+ "serverUrl": "rtmps://myfooserver/myfooapp",
50
+ "streamName": "myfoostream3",
51
+ "status": "started"
52
+ },
53
+ "bar": {
54
+ "serverUrl": "rtmp://mybarserver/mybarapp",
55
+ "streamName": "mybarstream3",
56
+ "status": "live"
57
+ }
58
+ }
59
+ },
60
+ "status": "started",
61
+ "streamMode" : "manual",
62
+ "streams" : []
63
+ }, {
64
+ "id" : "30b3ebf1-ba36-4f5b-8def-6f70d9986fe9",
65
+ "sessionId" : "SESSIONID",
66
+ "projectId": 123456,
67
+ "createdAt" : 1395183243000,
68
+ "updatedAt": 1395183243000,
69
+ "resolution": "640x480",
70
+ "broadcastUrls": {
71
+ "hls" : "http://tokbox.com.broadcast2.s3.amazonaws.com/123456%2F30b3ebf1-ba36-4f5b-8def-6f70d9986fe9.m3u8",
72
+ "rtmp": {
73
+ "foo": {
74
+ "serverUrl": "rtmps://myfooserver/myfooapp",
75
+ "streamName": "myfoostream4",
76
+ "status": "started"
77
+ },
78
+ "bar": {
79
+ "serverUrl": "rtmp://mybarserver/mybarapp",
80
+ "streamName": "mybarstream4",
81
+ "status": "live"
82
+ }
83
+ }
84
+ },
85
+ "status": "started",
86
+ "streamMode" : "manual",
87
+ "streams" : []
88
+ }, {
89
+ "id" : "b8f64de1-e218-4091-9544-4cbf369fc238",
90
+ "sessionId" : "SESSIONID",
91
+ "projectId": 123456,
92
+ "createdAt" : 1394396753000,
93
+ "updatedAt": 1394396753000,
94
+ "resolution": "640x480",
95
+ "broadcastUrls": {
96
+ "hls" : "http://tokbox.com.broadcast2.s3.amazonaws.com/123456%2Fb8f64de1-e218-4091-9544-4cbf369fc238.m3u8",
97
+ "rtmp": {
98
+ "foo": {
99
+ "serverUrl": "rtmps://myfooserver/myfooapp",
100
+ "streamName": "myfoostream5",
101
+ "status": "started"
102
+ },
103
+ "bar": {
104
+ "serverUrl": "rtmp://mybarserver/mybarapp",
105
+ "streamName": "mybarstream5",
106
+ "status": "live"
107
+ }
108
+ }
109
+ },
110
+ "status": "started",
111
+ "streamMode" : "manual",
112
+ "streams" : []
113
+ }, {
114
+ "id" : "832641bf-5dbf-41a1-ad94-fea213e59a92",
115
+ "sessionId" : "SESSIONID",
116
+ "projectId": 123456,
117
+ "createdAt" : 1394321113000,
118
+ "updatedAt": 1394321113000,
119
+ "resolution": "640x480",
120
+ "broadcastUrls": {
121
+ "hls" : "http://tokbox.com.broadcast2.s3.amazonaws.com/123456%2F832641bf-5dbf-41a1-ad94-fea213e59a92.m3u8",
122
+ "rtmp": {
123
+ "foo": {
124
+ "serverUrl": "rtmps://myfooserver/myfooapp",
125
+ "streamName": "myfoostream6",
126
+ "status": "started"
127
+ },
128
+ "bar": {
129
+ "serverUrl": "rtmp://mybarserver/mybarapp",
130
+ "streamName": "mybarstream6",
131
+ "status": "live"
132
+ }
133
+ }
134
+ },
135
+ "status": "started",
136
+ "streamMode" : "manual",
137
+ "streams" : []
138
+ } ]
139
+ }
140
+ http_version:
141
+ recorded_at: Fri, 21 Jan 2022 12:05:21 GMT
142
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,117 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.opentok.com/v2/project/123456/broadcast?sessionId=SESSIONID
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Fri, 21 Jan 2022 12:05:21 GMT
27
+ Content-Type:
28
+ - application/json
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: |-
36
+ {
37
+ "count" : 3,
38
+ "items" : [ {
39
+ "id" : "ef546c5a-4fd7-4e59-ab3d-f1cfb4148d1d",
40
+ "sessionId" : "SESSIONID",
41
+ "projectId": 123456,
42
+ "createdAt" : 1395187930000,
43
+ "updatedAt": 1395187930000,
44
+ "resolution": "640x480",
45
+ "broadcastUrls": {
46
+ "hls" : "http://tokbox.com.broadcast2.s3.amazonaws.com/123456%2F5350f06f-0166-402e-bc27-09ba54948512.m3u8",
47
+ "rtmp": {
48
+ "foo": {
49
+ "serverUrl": "rtmps://myfooserver/myfooapp",
50
+ "streamName": "myfoostream1",
51
+ "status": "started"
52
+ },
53
+ "bar": {
54
+ "serverUrl": "rtmp://mybarserver/mybarapp",
55
+ "streamName": "mybarstream1",
56
+ "status": "live"
57
+ }
58
+ }
59
+ },
60
+ "status": "started",
61
+ "streamMode" : "manual",
62
+ "streams" : []
63
+ }, {
64
+ "id" : "f6e7ee58-d6cf-4a59-896b-6d56b158ec71",
65
+ "sessionId" : "SESSIONID",
66
+ "projectId": 123456,
67
+ "createdAt" : 1395187910000,
68
+ "updatedAt": 1395187910000,
69
+ "resolution": "640x480",
70
+ "broadcastUrls": {
71
+ "hls" : "http://tokbox.com.broadcast2.s3.amazonaws.com/123456%2F5350f06f-0166-402e-bc27-09ba54948512.m3u8",
72
+ "rtmp": {
73
+ "foo": {
74
+ "serverUrl": "rtmps://myfooserver/myfooapp",
75
+ "streamName": "myfoostream2",
76
+ "status": "started"
77
+ },
78
+ "bar": {
79
+ "serverUrl": "rtmp://mybarserver/mybarapp",
80
+ "streamName": "mybarstream2",
81
+ "status": "live"
82
+ }
83
+ }
84
+ },
85
+ "status": "started",
86
+ "streamMode" : "manual",
87
+ "streams" : []
88
+ }, {
89
+ "id" : "ef546c5a-4fd7-4e59-ab3d-f1cfb4148d1d",
90
+ "sessionId" : "SESSIONID",
91
+ "projectId": 123456,
92
+ "createdAt" : 1395187836000,
93
+ "updatedAt": 1395187836000,
94
+ "resolution": "640x480",
95
+ "broadcastUrls": {
96
+ "hls" : "http://tokbox.com.broadcast2.s3.amazonaws.com/123456%2Ff6e7ee58-d6cf-4a59-896b-6d56b158ec71.m3u8",
97
+ "rtmp": {
98
+ "foo": {
99
+ "serverUrl": "rtmps://myfooserver/myfooapp",
100
+ "streamName": "myfoostream3",
101
+ "status": "started"
102
+ },
103
+ "bar": {
104
+ "serverUrl": "rtmp://mybarserver/mybarapp",
105
+ "streamName": "mybarstream3",
106
+ "status": "live"
107
+ }
108
+ }
109
+ },
110
+ "status": "started",
111
+ "streamMode" : "manual",
112
+ "streams" : []
113
+ } ]
114
+ }
115
+ http_version:
116
+ recorded_at: Fri, 21 Jan 2022 12:05:21 GMT
117
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: patch
5
+ uri: https://api.opentok.com/v2/project/123456/broadcast/13dbcc23-af92-4862-9184-74b21815a814/streams
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"removeStream":"12312312-3811-4726-b508-e41a0f96c68f"}'
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 204
23
+ message: No Content
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Tue, 23 Nov 2021 20:49:23 GMT
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - AWSALBTG=IVCBek0mkrwLClWNRdLjy1iFNSsOxBPlYS4DBo6ihXHl5qScay403/clceKAPEMdaMxF6eUaou388eSdkjuZ9olWCDF49IGVNCP4gmF8O9Ajvjqhh/cVuzMKL5kOrkjSgjVouTyOyAT3K4NaPfM+U6sBd7UQ0HhTHgND5lsgfSu9Y27EKj8=;
33
+ Expires=Tue, 30 Nov 2021 20:49:22 GMT; Path=/
34
+ - AWSALBTGCORS=IVCBek0mkrwLClWNRdLjy1iFNSsOxBPlYS4DBo6ihXHl5qScay403/clceKAPEMdaMxF6eUaou388eSdkjuZ9olWCDF49IGVNCP4gmF8O9Ajvjqhh/cVuzMKL5kOrkjSgjVouTyOyAT3K4NaPfM+U6sBd7UQ0HhTHgND5lsgfSu9Y27EKj8=;
35
+ Expires=Tue, 30 Nov 2021 20:49:22 GMT; Path=/; SameSite=None; Secure
36
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
37
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/v2/project/123456/session/SESSIONID/connection/CONNID/play-dtmf
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"digits":"0123456789*#p"}'
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Mon, 01 Nov 2021 12:27:19 GMT
29
+ Content-Type:
30
+ - application/xml
31
+ Content-Length:
32
+ - '177'
33
+ Connection:
34
+ - keep-alive
35
+ body:
36
+ encoding: UTF-8
37
+ string: ""
38
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
39
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/v2/project/123456/session/SESSIONID/play-dtmf
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"digits":"0123456789*#p"}'
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Mon, 01 Nov 2021 12:35:08 GMT
29
+ Content-Type:
30
+ - application/xml
31
+ Content-Length:
32
+ - '177'
33
+ Connection:
34
+ - keep-alive
35
+ body:
36
+ encoding: UTF-8
37
+ string: ""
38
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
39
+ recorded_with: VCR 6.0.0
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: https://api.opentok.com/v2/project/123456/dial
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"sessionId":"SESSIONID","token":"TOKENID","sip":{"uri":"sip:+15128675309@acme.pstn.example.com;transport=tls","auth":{"username":"bob","password":"abc123"},"secure":"true"}}'
8
+ string: '{"sessionId":"SESSIONID","token":"TOKENID","sip":{"uri":"sip:+15128675309@acme.pstn.example.com;transport=tls","auth":{"username":"bob","password":"abc123"},"secure":"true","video":"true","observeForceMute":"true"}}'
9
9
  headers:
10
10
  User-Agent:
11
11
  - OpenTok-Ruby-SDK/<%= version %>
@@ -35,6 +35,6 @@ http_interactions:
35
35
  body:
36
36
  encoding: UTF-8
37
37
  string: '{"id":"2299ba24-a6de-417c-88f7-28da54a441cf","projectId":"123456","sessionId":"SESSIONID","connectionId":"833a7182-61a5-49d4-baae-c324b09953af","streamId":"b1963d15-537f-459a-be89-e00fc310b82b","createdAt":1492468803946,"updatedAt":1492468803946}'
38
- http_version:
38
+ http_version:
39
39
  recorded_at: Mon, 17 Apr 2017 22:40:01 GMT
40
40
  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/mute
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"active":"false"}'
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Thu, 13 Jan 2022 15:37:24 GMT
29
+ Content-Length:
30
+ - '0'
31
+ Connection:
32
+ - close
33
+ body:
34
+ encoding: UTF-8
35
+ string: ''
36
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
37
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/v2/project/123456/session/SESSIONID/mute
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"active":"true"}'
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Fri, 29 Oct 2021 11:48:19 GMT
29
+ Content-Type:
30
+ - application/json
31
+ Content-Length:
32
+ - '0'
33
+ Connection:
34
+ - close
35
+ body:
36
+ encoding: UTF-8
37
+ string: ''
38
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
39
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/v2/project/123456/session/SESSIONID/mute
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"excludedStreams":["b1963d15-537f-459a-be89-e00fc310b82b"],"active":"true"}'
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Fri, 29 Oct 2021 12:01:42 GMT
29
+ Content-Type:
30
+ - application/json
31
+ Content-Length:
32
+ - '0'
33
+ Connection:
34
+ - keep-alive
35
+ body:
36
+ encoding: UTF-8
37
+ string: ''
38
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
39
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/v2/project/123456/session/SESSIONID/stream/STREAMID/mute
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Fri, 29 Oct 2021 11:01:54 GMT
29
+ Content-Type:
30
+ - application/json
31
+ Content-Length:
32
+ - '0'
33
+ Connection:
34
+ - keep-alive
35
+ body:
36
+ encoding: UTF-8
37
+ string: ''
38
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
39
+ recorded_with: VCR 6.0.0
@@ -67,6 +67,16 @@ describe OpenTok::Archives do
67
67
  expect(archive.session_id).to eq session_id
68
68
  end
69
69
 
70
+ it "should create layout archives with screenshare layout types", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do
71
+ screenshare_layout = {
72
+ :type => "bestFit",
73
+ :screenshare_type => "verticalPresentation"
74
+ }
75
+ archive = archives.create session_id, :layout => screenshare_layout
76
+ expect(archive).to be_an_instance_of OpenTok::Archive
77
+ expect(archive.session_id).to eq session_id
78
+ end
79
+
70
80
  it "should stop archives", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do
71
81
  archive = archives.stop_by_id started_archive_id
72
82
  expect(archive).to be_an_instance_of OpenTok::Archive
@@ -159,6 +169,25 @@ describe OpenTok::Archives do
159
169
  })
160
170
  }.to raise_error(ArgumentError)
161
171
  end
172
+
173
+ it "raise an error if invalid layout type with screenshare_type" do
174
+ expect {
175
+ archives.layout(started_archive_id, {
176
+ type: "pip",
177
+ screenshare_type: "bestFit"
178
+ })
179
+ }.to raise_error(ArgumentError)
180
+ end
181
+
182
+ it "raise an error if invalid layout screenshare_type" do
183
+ expect {
184
+ archives.layout(started_archive_id, {
185
+ type: "bestFit",
186
+ screenshare_type: "pip1"
187
+ })
188
+ }.to raise_error(ArgumentError)
189
+ end
190
+
162
191
  it "calls layout on archive object", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do
163
192
  archive = archives.find findable_archive_id
164
193
  expect(archive).to be_an_instance_of OpenTok::Archive
@@ -230,4 +259,15 @@ describe OpenTok::Archives do
230
259
  it { should raise_error(OpenTok::OpenTokError) }
231
260
  end
232
261
 
262
+ it "adds a stream to an archive", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do
263
+ opts = {}
264
+ response = archives.add_stream(started_archive_id, '12312312-3811-4726-b508-e41a0f96c68f', opts)
265
+ expect(response.code).to eq(204)
266
+ end
267
+
268
+ it "removes a stream from an archive", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do
269
+ response = archives.remove_stream(started_archive_id, '12312312-3811-4726-b508-e41a0f96c68f')
270
+ expect(response.code).to eq(204)
271
+ end
272
+
233
273
  end