opentok 0.1.3 → 2.2.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.
- checksums.yaml +4 -4
- data/.gitignore +16 -2
- data/.travis.yml +6 -0
- data/.yardopts +1 -0
- data/CONTRIBUTING.md +47 -0
- data/DEVELOPING.md +91 -0
- data/LICENSE +19 -5
- data/README.md +170 -53
- data/Rakefile +10 -5
- data/doc/OpenTok.html +411 -0
- data/doc/OpenTok/Archive.html +1320 -0
- data/doc/OpenTok/ArchiveList.html +216 -0
- data/doc/OpenTok/Archives.html +1028 -0
- data/doc/OpenTok/Client.html +695 -0
- data/doc/OpenTok/OpenTok.html +1046 -0
- data/doc/OpenTok/OpenTokArchiveError.html +142 -0
- data/doc/OpenTok/OpenTokAuthenticationError.html +143 -0
- data/doc/OpenTok/OpenTokError.html +138 -0
- data/doc/OpenTok/Session.html +665 -0
- data/doc/OpenTok/TokenGenerator.html +204 -0
- data/doc/OpenTok/TokenGenerator/ClassMethods.html +187 -0
- data/doc/README.md +15 -0
- data/doc/_index.html +182 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +87 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +87 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +227 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/opentok.rb +3 -14
- data/lib/opentok/archive.rb +92 -0
- data/lib/opentok/archive_list.rb +17 -0
- data/lib/opentok/archives.rb +120 -0
- data/lib/opentok/client.rb +125 -0
- data/lib/opentok/constants.rb +5 -0
- data/lib/opentok/exceptions.rb +10 -0
- data/lib/opentok/opentok.rb +174 -0
- data/lib/opentok/session.rb +76 -0
- data/lib/opentok/token_generator.rb +101 -0
- data/lib/opentok/version.rb +4 -0
- data/opentok.gemspec +29 -22
- data/sample/Archiving/Gemfile +4 -0
- data/sample/Archiving/README.md +212 -0
- data/sample/Archiving/archiving_sample.rb +80 -0
- data/sample/Archiving/public/css/sample.css +22 -0
- data/sample/Archiving/public/img/archiving-off.png +0 -0
- data/sample/Archiving/public/img/archiving-on-idle.png +0 -0
- data/sample/Archiving/public/img/archiving-on-message.png +0 -0
- data/sample/Archiving/public/js/host.js +37 -0
- data/sample/Archiving/public/js/participant.js +13 -0
- data/sample/Archiving/views/history.erb +65 -0
- data/sample/Archiving/views/host.erb +69 -0
- data/sample/Archiving/views/index.erb +48 -0
- data/sample/Archiving/views/layout.erb +29 -0
- data/sample/Archiving/views/participant.erb +55 -0
- data/sample/HelloWorld/Gemfile +4 -0
- data/sample/HelloWorld/README.md +123 -0
- data/sample/HelloWorld/hello_world.rb +27 -0
- data/sample/HelloWorld/public/js/helloworld.js +32 -0
- data/sample/HelloWorld/views/index.erb +21 -0
- data/spec/cassettes/OpenTok_Archives/should_create_archives.yml +48 -0
- data/spec/cassettes/OpenTok_Archives/should_create_named_archives.yml +49 -0
- data/spec/cassettes/OpenTok_Archives/should_delete_an_archive_by_id.yml +32 -0
- data/spec/cassettes/OpenTok_Archives/should_find_archives_by_id.yml +46 -0
- data/spec/cassettes/OpenTok_Archives/should_stop_archives.yml +48 -0
- data/spec/cassettes/OpenTok_Archives/when_many_archives_are_created/should_return_all_archives.yml +104 -0
- data/spec/cassettes/OpenTok_Archives/when_many_archives_are_created/should_return_archives_with_an_offset.yml +71 -0
- data/spec/cassettes/OpenTok_Archives/when_many_archives_are_created/should_return_count_number_of_archives.yml +60 -0
- data/spec/cassettes/OpenTok_Archives/when_many_archives_are_created/should_return_part_of_the_archives_when_using_offset_and_count.yml +82 -0
- data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_default_sessions.yml +39 -0
- data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_relayed_media_sessions.yml +39 -0
- data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_relayed_media_sessions_with_a_location_hint.yml +39 -0
- data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_routed_media_sessions.yml +39 -0
- data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_routed_media_sessions_for_invalid_media_modes.yml +39 -0
- data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_routed_media_sessions_with_a_location_hint.yml +39 -0
- data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_sessions_with_a_location_hint.yml +39 -0
- data/spec/matchers/token.rb +48 -0
- data/spec/opentok/archives_spec.rb +91 -0
- data/spec/opentok/opentok_spec.rb +144 -0
- data/spec/opentok/session_spec.rb +71 -0
- data/spec/shared/opentok_generates_tokens.rb +62 -0
- data/spec/shared/session_generates_tokens.rb +63 -0
- data/spec/spec_helper.rb +6 -7
- metadata +197 -59
- data/.rspec +0 -3
- data/CHANGES +0 -33
- data/doc/reference.md +0 -122
- data/lib/open_tok/archive.rb +0 -53
- data/lib/open_tok/archive_timeline_event.rb +0 -22
- data/lib/open_tok/archive_video_resource.rb +0 -28
- data/lib/open_tok/exception.rb +0 -50
- data/lib/open_tok/open_tok_sdk.rb +0 -198
- data/lib/open_tok/request.rb +0 -63
- data/lib/open_tok/role_constants.rb +0 -18
- data/lib/open_tok/session.rb +0 -25
- data/lib/open_tok/session_property_constants.rb +0 -30
- data/lib/open_tok/utils.rb +0 -10
- data/lib/open_tok/version.rb +0 -5
- data/sample/sample.rb +0 -26
- data/spec/cassettes/archives.yml +0 -83
- data/spec/cassettes/deleteArchive.yml +0 -91
- data/spec/cassettes/invalidSession.yml +0 -41
- data/spec/cassettes/session.yml +0 -46
- data/spec/cassettes/stitchArchive.yml +0 -42
- data/spec/opentok_exception_spec.rb +0 -38
- data/spec/opentok_spec.rb +0 -135
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.opentok.com/v2/partner/123456/archive?count=2
|
|
6
|
+
body:
|
|
7
|
+
encoding: US-ASCII
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
X-Tb-Partner-Auth:
|
|
11
|
+
- 123456:1234567890abcdef1234567890abcdef1234567890
|
|
12
|
+
User-Agent:
|
|
13
|
+
- OpenTok-Ruby-SDK/<%= version %>
|
|
14
|
+
response:
|
|
15
|
+
status:
|
|
16
|
+
code: 200
|
|
17
|
+
message: OK
|
|
18
|
+
headers:
|
|
19
|
+
Server:
|
|
20
|
+
- nginx
|
|
21
|
+
Date:
|
|
22
|
+
- Wed, 19 Mar 2014 00:54:18 GMT
|
|
23
|
+
Content-Type:
|
|
24
|
+
- application/json
|
|
25
|
+
Transfer-Encoding:
|
|
26
|
+
- chunked
|
|
27
|
+
Connection:
|
|
28
|
+
- keep-alive
|
|
29
|
+
body:
|
|
30
|
+
encoding: UTF-8
|
|
31
|
+
string: |-
|
|
32
|
+
{
|
|
33
|
+
"count" : 6,
|
|
34
|
+
"items" : [ {
|
|
35
|
+
"createdAt" : 1395187930000,
|
|
36
|
+
"duration" : 22,
|
|
37
|
+
"id" : "ef546c5a-4fd7-4e59-ab3d-f1cfb4148d1d",
|
|
38
|
+
"name" : "",
|
|
39
|
+
"partnerId" : 123456,
|
|
40
|
+
"reason" : "",
|
|
41
|
+
"sessionId" : "SESSIONID",
|
|
42
|
+
"size" : 2909274,
|
|
43
|
+
"status" : "available",
|
|
44
|
+
"url" : "http://tokbox.com.archive2.s3.amazonaws.com/123456%2Fef546c5a-4fd7-4e59-ab3d-f1cfb4148d1d%2Farchive.mp4?Expires=1395188695&AWSAccessKeyId=AKIAI6LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
45
|
+
}, {
|
|
46
|
+
"createdAt" : 1395187910000,
|
|
47
|
+
"duration" : 14,
|
|
48
|
+
"id" : "5350f06f-0166-402e-bc27-09ba54948512",
|
|
49
|
+
"name" : "",
|
|
50
|
+
"partnerId" : 123456,
|
|
51
|
+
"reason" : "",
|
|
52
|
+
"sessionId" : "SESSIONID",
|
|
53
|
+
"size" : 1952651,
|
|
54
|
+
"status" : "available",
|
|
55
|
+
"url" : "http://tokbox.com.archive2.s3.amazonaws.com/123456%2F5350f06f-0166-402e-bc27-09ba54948512%2Farchive.mp4?Expires=1395188695&AWSAccessKeyId=AKIAI6LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
56
|
+
} ]
|
|
57
|
+
}
|
|
58
|
+
http_version:
|
|
59
|
+
recorded_at: Wed, 19 Mar 2014 00:54:18 GMT
|
|
60
|
+
recorded_with: VCR 2.8.0
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.opentok.com/v2/partner/123456/archive?count=4&offset=2
|
|
6
|
+
body:
|
|
7
|
+
encoding: US-ASCII
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
X-Tb-Partner-Auth:
|
|
11
|
+
- 123456:1234567890abcdef1234567890abcdef1234567890
|
|
12
|
+
User-Agent:
|
|
13
|
+
- OpenTok-Ruby-SDK/<%= version %>
|
|
14
|
+
response:
|
|
15
|
+
status:
|
|
16
|
+
code: 200
|
|
17
|
+
message: OK
|
|
18
|
+
headers:
|
|
19
|
+
Server:
|
|
20
|
+
- nginx
|
|
21
|
+
Date:
|
|
22
|
+
- Wed, 19 Mar 2014 00:57:50 GMT
|
|
23
|
+
Content-Type:
|
|
24
|
+
- application/json
|
|
25
|
+
Transfer-Encoding:
|
|
26
|
+
- chunked
|
|
27
|
+
Connection:
|
|
28
|
+
- keep-alive
|
|
29
|
+
body:
|
|
30
|
+
encoding: UTF-8
|
|
31
|
+
string: |-
|
|
32
|
+
{
|
|
33
|
+
"count" : 6,
|
|
34
|
+
"items" : [ {
|
|
35
|
+
"createdAt" : 1395187836000,
|
|
36
|
+
"duration" : 62,
|
|
37
|
+
"id" : "f6e7ee58-d6cf-4a59-896b-6d56b158ec71",
|
|
38
|
+
"name" : "",
|
|
39
|
+
"partnerId" : 123456,
|
|
40
|
+
"reason" : "",
|
|
41
|
+
"sessionId" : "SESSIONID",
|
|
42
|
+
"size" : 8347554,
|
|
43
|
+
"status" : "available",
|
|
44
|
+
"url" : "http://tokbox.com.archive2.s3.amazonaws.com/123456%2Ff6e7ee58-d6cf-4a59-896b-6d56b158ec71%2Farchive.mp4?Expires=1395188695&AWSAccessKeyId=AKIAI6LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
45
|
+
}, {
|
|
46
|
+
"createdAt" : 1395183243000,
|
|
47
|
+
"duration" : 544,
|
|
48
|
+
"id" : "30b3ebf1-ba36-4f5b-8def-6f70d9986fe9",
|
|
49
|
+
"name" : "",
|
|
50
|
+
"partnerId" : 123456,
|
|
51
|
+
"reason" : "",
|
|
52
|
+
"sessionId" : "SESSIONID",
|
|
53
|
+
"size" : 78499758,
|
|
54
|
+
"status" : "available",
|
|
55
|
+
"url" : "http://tokbox.com.archive2.s3.amazonaws.com/123456%2F30b3ebf1-ba36-4f5b-8def-6f70d9986fe9%2Farchive.mp4?Expires=1395188695&AWSAccessKeyId=AKIAI6LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
56
|
+
}, {
|
|
57
|
+
"createdAt" : 1394396753000,
|
|
58
|
+
"duration" : 24,
|
|
59
|
+
"id" : "b8f64de1-e218-4091-9544-4cbf369fc238",
|
|
60
|
+
"name" : "showtime again",
|
|
61
|
+
"partnerId" : 123456,
|
|
62
|
+
"reason" : "",
|
|
63
|
+
"sessionId" : "SESSIONID",
|
|
64
|
+
"size" : 2227849,
|
|
65
|
+
"status" : "available",
|
|
66
|
+
"url" : "http://tokbox.com.archive2.s3.amazonaws.com/123456%2Fb8f64de1-e218-4091-9544-4cbf369fc238%2Farchive.mp4?Expires=1395188695&AWSAccessKeyId=AKIAI6LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
67
|
+
}, {
|
|
68
|
+
"createdAt" : 1394321113000,
|
|
69
|
+
"duration" : 1294,
|
|
70
|
+
"id" : "832641bf-5dbf-41a1-ad94-fea213e59a92",
|
|
71
|
+
"name" : "showtime",
|
|
72
|
+
"partnerId" : 123456,
|
|
73
|
+
"reason" : "",
|
|
74
|
+
"sessionId" : "SESSIONID",
|
|
75
|
+
"size" : 42165242,
|
|
76
|
+
"status" : "available",
|
|
77
|
+
"url" : "http://tokbox.com.archive2.s3.amazonaws.com/123456%2F832641bf-5dbf-41a1-ad94-fea213e59a92%2Farchive.mp4?Expires=1395188695&AWSAccessKeyId=AKIAI6LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
78
|
+
} ]
|
|
79
|
+
}
|
|
80
|
+
http_version:
|
|
81
|
+
recorded_at: Wed, 19 Mar 2014 00:57:50 GMT
|
|
82
|
+
recorded_with: VCR 2.8.0
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://api.opentok.com/session/create
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: p2p.preference=disabled
|
|
9
|
+
headers:
|
|
10
|
+
X-Tb-Partner-Auth:
|
|
11
|
+
- 123456:1234567890abcdef1234567890abcdef1234567890
|
|
12
|
+
User-Agent:
|
|
13
|
+
- OpenTok-Ruby-SDK/<%= version %>
|
|
14
|
+
response:
|
|
15
|
+
status:
|
|
16
|
+
code: 200
|
|
17
|
+
message: OK
|
|
18
|
+
headers:
|
|
19
|
+
Server:
|
|
20
|
+
- nginx
|
|
21
|
+
Date:
|
|
22
|
+
- Mon, 17 Mar 2014 07:41:31 GMT
|
|
23
|
+
Content-Type:
|
|
24
|
+
- text/xml
|
|
25
|
+
Connection:
|
|
26
|
+
- keep-alive
|
|
27
|
+
Access-Control-Allow-Origin:
|
|
28
|
+
- '*'
|
|
29
|
+
X-Tb-Host:
|
|
30
|
+
- fms503-nyc.tokbox.com
|
|
31
|
+
Content-Length:
|
|
32
|
+
- '282'
|
|
33
|
+
body:
|
|
34
|
+
encoding: UTF-8
|
|
35
|
+
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><session_id>1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDA6NDE6MzEgUERUIDIwMTR-MC42ODM3ODk1MzQ0OTQyODA4fg</session_id><partner_id>123456</partner_id><create_dt>Mon
|
|
36
|
+
Mar 17 00:41:31 PDT 2014</create_dt></Session></sessions>
|
|
37
|
+
http_version:
|
|
38
|
+
recorded_at: Mon, 17 Mar 2014 07:41:30 GMT
|
|
39
|
+
recorded_with: VCR 2.8.0
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://api.opentok.com/session/create
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: p2p.preference=enabled
|
|
9
|
+
headers:
|
|
10
|
+
X-Tb-Partner-Auth:
|
|
11
|
+
- 123456:1234567890abcdef1234567890abcdef1234567890
|
|
12
|
+
User-Agent:
|
|
13
|
+
- OpenTok-Ruby-SDK/<%= version %>
|
|
14
|
+
response:
|
|
15
|
+
status:
|
|
16
|
+
code: 200
|
|
17
|
+
message: OK
|
|
18
|
+
headers:
|
|
19
|
+
Server:
|
|
20
|
+
- nginx
|
|
21
|
+
Date:
|
|
22
|
+
- Mon, 17 Mar 2014 08:48:55 GMT
|
|
23
|
+
Content-Type:
|
|
24
|
+
- text/xml
|
|
25
|
+
Connection:
|
|
26
|
+
- keep-alive
|
|
27
|
+
Access-Control-Allow-Origin:
|
|
28
|
+
- '*'
|
|
29
|
+
X-Tb-Host:
|
|
30
|
+
- oms504-nyc.tokbox.com
|
|
31
|
+
Content-Length:
|
|
32
|
+
- '282'
|
|
33
|
+
body:
|
|
34
|
+
encoding: UTF-8
|
|
35
|
+
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><session_id>1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDA6NDE6MzEgUERUIDIwMTR-MC42ODM3ODk1MzQ0OTQyODA4fg</session_id><partner_id>123456</partner_id><create_dt>Mon
|
|
36
|
+
Mar 17 01:48:55 PDT 2014</create_dt></Session></sessions>
|
|
37
|
+
http_version:
|
|
38
|
+
recorded_at: Mon, 17 Mar 2014 08:48:54 GMT
|
|
39
|
+
recorded_with: VCR 2.8.0
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://api.opentok.com/session/create
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: location=12.34.56.78&p2p.preference=enabled
|
|
9
|
+
headers:
|
|
10
|
+
X-Tb-Partner-Auth:
|
|
11
|
+
- 123456:1234567890abcdef1234567890abcdef1234567890
|
|
12
|
+
User-Agent:
|
|
13
|
+
- OpenTok-Ruby-SDK/<%= version %>
|
|
14
|
+
response:
|
|
15
|
+
status:
|
|
16
|
+
code: 200
|
|
17
|
+
message: OK
|
|
18
|
+
headers:
|
|
19
|
+
Server:
|
|
20
|
+
- nginx
|
|
21
|
+
Date:
|
|
22
|
+
- Mon, 17 Mar 2014 09:00:07 GMT
|
|
23
|
+
Content-Type:
|
|
24
|
+
- text/xml
|
|
25
|
+
Connection:
|
|
26
|
+
- keep-alive
|
|
27
|
+
Access-Control-Allow-Origin:
|
|
28
|
+
- '*'
|
|
29
|
+
X-Tb-Host:
|
|
30
|
+
- oms506-nyc.tokbox.com
|
|
31
|
+
Content-Length:
|
|
32
|
+
- '298'
|
|
33
|
+
body:
|
|
34
|
+
encoding: UTF-8
|
|
35
|
+
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><session_id>1_MX4xMjM0NTZ-MTIuMzQuNTYuNzh-TW9uIE1hciAxNyAwMjowMDowNyBQRFQgMjAxNH4wLjIxMzUyNTY0ODkyNzMxNjA3fg</session_id><partner_id>123456</partner_id><create_dt>Mon
|
|
36
|
+
Mar 17 02:00:07 PDT 2014</create_dt></Session></sessions>
|
|
37
|
+
http_version:
|
|
38
|
+
recorded_at: Mon, 17 Mar 2014 09:00:06 GMT
|
|
39
|
+
recorded_with: VCR 2.8.0
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://api.opentok.com/session/create
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: p2p.preference=disabled
|
|
9
|
+
headers:
|
|
10
|
+
X-Tb-Partner-Auth:
|
|
11
|
+
- 123456:1234567890abcdef1234567890abcdef1234567890
|
|
12
|
+
User-Agent:
|
|
13
|
+
- OpenTok-Ruby-SDK/<%= version %>
|
|
14
|
+
response:
|
|
15
|
+
status:
|
|
16
|
+
code: 200
|
|
17
|
+
message: OK
|
|
18
|
+
headers:
|
|
19
|
+
Server:
|
|
20
|
+
- nginx
|
|
21
|
+
Date:
|
|
22
|
+
- Mon, 17 Mar 2014 09:00:07 GMT
|
|
23
|
+
Content-Type:
|
|
24
|
+
- text/xml
|
|
25
|
+
Connection:
|
|
26
|
+
- keep-alive
|
|
27
|
+
Access-Control-Allow-Origin:
|
|
28
|
+
- '*'
|
|
29
|
+
X-Tb-Host:
|
|
30
|
+
- fms502-nyc.tokbox.com
|
|
31
|
+
Content-Length:
|
|
32
|
+
- '282'
|
|
33
|
+
body:
|
|
34
|
+
encoding: UTF-8
|
|
35
|
+
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><session_id>1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDI6MDA6MDcgUERUIDIwMTR-MC42MjkyMTk3OTM3MTQ1ODI5fg</session_id><partner_id>123456</partner_id><create_dt>Mon
|
|
36
|
+
Mar 17 02:00:07 PDT 2014</create_dt></Session></sessions>
|
|
37
|
+
http_version:
|
|
38
|
+
recorded_at: Mon, 17 Mar 2014 09:00:06 GMT
|
|
39
|
+
recorded_with: VCR 2.8.0
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://api.opentok.com/session/create
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: p2p.preference=disabled
|
|
9
|
+
headers:
|
|
10
|
+
X-Tb-Partner-Auth:
|
|
11
|
+
- 123456:1234567890abcdef1234567890abcdef1234567890
|
|
12
|
+
User-Agent:
|
|
13
|
+
- OpenTok-Ruby-SDK/<%= version %>
|
|
14
|
+
response:
|
|
15
|
+
status:
|
|
16
|
+
code: 200
|
|
17
|
+
message: OK
|
|
18
|
+
headers:
|
|
19
|
+
Server:
|
|
20
|
+
- nginx
|
|
21
|
+
Date:
|
|
22
|
+
- Mon, 17 Mar 2014 07:41:31 GMT
|
|
23
|
+
Content-Type:
|
|
24
|
+
- text/xml
|
|
25
|
+
Connection:
|
|
26
|
+
- keep-alive
|
|
27
|
+
Access-Control-Allow-Origin:
|
|
28
|
+
- '*'
|
|
29
|
+
X-Tb-Host:
|
|
30
|
+
- fms503-nyc.tokbox.com
|
|
31
|
+
Content-Length:
|
|
32
|
+
- '282'
|
|
33
|
+
body:
|
|
34
|
+
encoding: UTF-8
|
|
35
|
+
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><session_id>1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDA6NDE6MzEgUERUIDIwMTR-MC42ODM3ODk1MzQ0OTQyODA4fg</session_id><partner_id>123456</partner_id><create_dt>Mon
|
|
36
|
+
Mar 17 00:41:31 PDT 2014</create_dt></Session></sessions>
|
|
37
|
+
http_version:
|
|
38
|
+
recorded_at: Mon, 17 Mar 2014 07:41:30 GMT
|
|
39
|
+
recorded_with: VCR 2.8.0
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://api.opentok.com/session/create
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: location=12.34.56.78&p2p.preference=disabled
|
|
9
|
+
headers:
|
|
10
|
+
X-Tb-Partner-Auth:
|
|
11
|
+
- 123456:1234567890abcdef1234567890abcdef1234567890
|
|
12
|
+
User-Agent:
|
|
13
|
+
- OpenTok-Ruby-SDK/<%= version %>
|
|
14
|
+
response:
|
|
15
|
+
status:
|
|
16
|
+
code: 200
|
|
17
|
+
message: OK
|
|
18
|
+
headers:
|
|
19
|
+
Server:
|
|
20
|
+
- nginx
|
|
21
|
+
Date:
|
|
22
|
+
- Mon, 17 Mar 2014 09:00:07 GMT
|
|
23
|
+
Content-Type:
|
|
24
|
+
- text/xml
|
|
25
|
+
Connection:
|
|
26
|
+
- keep-alive
|
|
27
|
+
Access-Control-Allow-Origin:
|
|
28
|
+
- '*'
|
|
29
|
+
X-Tb-Host:
|
|
30
|
+
- mantis504-nyc.tokbox.com
|
|
31
|
+
Content-Length:
|
|
32
|
+
- '298'
|
|
33
|
+
body:
|
|
34
|
+
encoding: UTF-8
|
|
35
|
+
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><session_id>1_MX4xMjM0NTZ-MTIuMzQuNTYuNzh-TW9uIE1hciAxNyAwMjowMDowNyBQRFQgMjAxNH4wLjIxMzUyNTY0ODkyNzMxNjA3fg</session_id><partner_id>123456</partner_id><create_dt>Mon
|
|
36
|
+
Mar 17 02:00:07 PDT 2014</create_dt></Session></sessions>
|
|
37
|
+
http_version:
|
|
38
|
+
recorded_at: Mon, 17 Mar 2014 09:00:06 GMT
|
|
39
|
+
recorded_with: VCR 2.8.0
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://api.opentok.com/session/create
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: location=12.34.56.78&p2p.preference=disabled
|
|
9
|
+
headers:
|
|
10
|
+
X-Tb-Partner-Auth:
|
|
11
|
+
- 123456:1234567890abcdef1234567890abcdef1234567890
|
|
12
|
+
User-Agent:
|
|
13
|
+
- OpenTok-Ruby-SDK/<%= version %>
|
|
14
|
+
response:
|
|
15
|
+
status:
|
|
16
|
+
code: 200
|
|
17
|
+
message: OK
|
|
18
|
+
headers:
|
|
19
|
+
Server:
|
|
20
|
+
- nginx
|
|
21
|
+
Date:
|
|
22
|
+
- Mon, 17 Mar 2014 08:48:55 GMT
|
|
23
|
+
Content-Type:
|
|
24
|
+
- text/xml
|
|
25
|
+
Connection:
|
|
26
|
+
- keep-alive
|
|
27
|
+
Access-Control-Allow-Origin:
|
|
28
|
+
- '*'
|
|
29
|
+
X-Tb-Host:
|
|
30
|
+
- mantis503-nyc.tokbox.com
|
|
31
|
+
Content-Length:
|
|
32
|
+
- '296'
|
|
33
|
+
body:
|
|
34
|
+
encoding: UTF-8
|
|
35
|
+
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><session_id>1_MX4xMjM0NTZ-MTIuMzQuNTYuNzh-TW9uIE1hciAxNyAwMTo0ODo1NSBQRFQgMjAxNH4wLjM0MTM0MzE0MDIyOTU4Mjh-</session_id><partner_id>123456</partner_id><create_dt>Mon
|
|
36
|
+
Mar 17 01:48:55 PDT 2014</create_dt></Session></sessions>
|
|
37
|
+
http_version:
|
|
38
|
+
recorded_at: Mon, 17 Mar 2014 08:48:54 GMT
|
|
39
|
+
recorded_with: VCR 2.8.0
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require "rspec/matchers"
|
|
2
|
+
|
|
3
|
+
require "base64"
|
|
4
|
+
require "digest/hmac"
|
|
5
|
+
require "addressable/uri"
|
|
6
|
+
|
|
7
|
+
RSpec::Matchers.define :carry_token_data do |input_data|
|
|
8
|
+
option_to_token_key = {
|
|
9
|
+
:api_key => :partner_id,
|
|
10
|
+
:data => :connection_data
|
|
11
|
+
}
|
|
12
|
+
match do |token|
|
|
13
|
+
decoded_token = Base64.decode64(token[4..token.length])
|
|
14
|
+
token_data_array = decoded_token.split(':').collect do |token_part|
|
|
15
|
+
token_part_array_array = Addressable::URI.form_unencode(token_part)
|
|
16
|
+
token_part_array = token_part_array_array.map do |array|
|
|
17
|
+
{ array[0].to_sym => array[1] }
|
|
18
|
+
end
|
|
19
|
+
token_part_array.reduce Hash.new, :merge
|
|
20
|
+
end
|
|
21
|
+
token_data = token_data_array.reduce Hash.new, :merge
|
|
22
|
+
check_token_data = lambda { |key, value|
|
|
23
|
+
key = option_to_token_key[key] if option_to_token_key.has_key? key
|
|
24
|
+
if token_data.has_key? key
|
|
25
|
+
unless value.nil?
|
|
26
|
+
return token_data[key] == value.to_s
|
|
27
|
+
end
|
|
28
|
+
return true
|
|
29
|
+
end
|
|
30
|
+
false
|
|
31
|
+
}
|
|
32
|
+
unless input_data.respond_to? :all?
|
|
33
|
+
return check_token_data.call(input_data, nil)
|
|
34
|
+
end
|
|
35
|
+
input_data.all? { |k, v| check_token_data.call(k, v) }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
RSpec::Matchers.define :carry_valid_token_signature do |api_secret|
|
|
40
|
+
match do |token|
|
|
41
|
+
decoded_token = Base64.decode64(token[4..token.length])
|
|
42
|
+
metadata, data_string = decoded_token.split(':')
|
|
43
|
+
# form_unencode returns an array of arrays, annoying so hardcoded lookup
|
|
44
|
+
# expected format: [["partner_id", "..."], ["sig", "..."]]
|
|
45
|
+
signature = Addressable::URI.form_unencode(metadata)[1][1]
|
|
46
|
+
signature == Digest::HMAC.hexdigest(data_string, api_secret, Digest::SHA1)
|
|
47
|
+
end
|
|
48
|
+
end
|