Skip to content

Commit 2c7c370

Browse files
authored
Merge pull request #180 from aiham/fix/update-rest-api-url
Update REST API URL from /partner to /project
2 parents 04299ac + b6cdd93 commit 2c7c370

File tree

15 files changed

+34
-34
lines changed

15 files changed

+34
-34
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
},
3636
"require-dev": {
3737
"phpunit/phpunit": "~4.1",
38-
"phing/phing": "dev-master"
38+
"phing/phing": "~2.15.2"
3939
},
4040
"autoload": {
4141
"psr-4": {

src/OpenTok/Util/Client.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function createSession($options)
7878
public function startArchive($sessionId, $options)
7979
{
8080
// set up the request
81-
$request = $this->post('/v2/partner/'.$this->apiKey.'/archive');
81+
$request = $this->post('/v2/project/'.$this->apiKey.'/archive');
8282
$request->setBody(json_encode(array_merge(array( 'sessionId' => $sessionId ), $options)));
8383
$request->setHeader('Content-Type', 'application/json');
8484

@@ -93,7 +93,7 @@ public function startArchive($sessionId, $options)
9393
public function stopArchive($archiveId)
9494
{
9595
// set up the request
96-
$request = $this->post('/v2/partner/'.$this->apiKey.'/archive/'.$archiveId.'/stop');
96+
$request = $this->post('/v2/project/'.$this->apiKey.'/archive/'.$archiveId.'/stop');
9797
$request->setHeader('Content-Type', 'application/json');
9898

9999
try {
@@ -107,7 +107,7 @@ public function stopArchive($archiveId)
107107

108108
public function getArchive($archiveId)
109109
{
110-
$request = $this->get('/v2/partner/'.$this->apiKey.'/archive/'.$archiveId);
110+
$request = $this->get('/v2/project/'.$this->apiKey.'/archive/'.$archiveId);
111111
try {
112112
$archiveJson = $request->send()->json();
113113
} catch (\Exception $e) {
@@ -119,7 +119,7 @@ public function getArchive($archiveId)
119119

120120
public function deleteArchive($archiveId)
121121
{
122-
$request = $this->delete('/v2/partner/'.$this->apiKey.'/archive/'.$archiveId);
122+
$request = $this->delete('/v2/project/'.$this->apiKey.'/archive/'.$archiveId);
123123
$request->setHeader('Content-Type', 'application/json');
124124
try {
125125
$request->send()->json();
@@ -132,7 +132,7 @@ public function deleteArchive($archiveId)
132132

133133
public function listArchives($offset, $count)
134134
{
135-
$request = $this->get('/v2/partner/'.$this->apiKey.'/archive');
135+
$request = $this->get('/v2/project/'.$this->apiKey.'/archive');
136136
if ($offset != 0) $request->getQuery()->set('offset', $offset);
137137
if (!empty($count)) $request->getQuery()->set('count', $count);
138138
try {
@@ -241,7 +241,7 @@ public function dial($sessionId, $token, $sipUri, $options)
241241
}
242242

243243
// set up the request
244-
$request = $this->post('/v2/partner/'.$this->apiKey.'/call');
244+
$request = $this->post('/v2/project/'.$this->apiKey.'/call');
245245
$request->setBody(json_encode($body));
246246
$request->setHeader('Content-Type', 'application/json');
247247

tests/OpenTok/ArchiveTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function testStopsArchive()
8484
// Arrange
8585
$mock = new MockPlugin();
8686
$response = MockPlugin::getMockFile(
87-
self::$mockBasePath . 'v2/partner/APIKEY/archive/ARCHIVEID/stop'
87+
self::$mockBasePath . 'v2/project/APIKEY/archive/ARCHIVEID/stop'
8888
);
8989
$mock->addResponse($response);
9090
$this->client->addSubscriber($mock);
@@ -98,7 +98,7 @@ public function testStopsArchive()
9898

9999
$request = $requests[0];
100100
$this->assertEquals('POST', strtoupper($request->getMethod()));
101-
$this->assertEquals('/v2/partner/'.$this->API_KEY.'/archive/'.$this->archiveData['id'].'/stop', $request->getPath());
101+
$this->assertEquals('/v2/project/'.$this->API_KEY.'/archive/'.$this->archiveData['id'].'/stop', $request->getPath());
102102
$this->assertEquals('api.opentok.com', $request->getHost());
103103
$this->assertEquals('https', $request->getScheme());
104104

@@ -124,7 +124,7 @@ public function testDeletesArchive()
124124
// Arrange
125125
$mock = new MockPlugin();
126126
$response = MockPlugin::getMockFile(
127-
self::$mockBasePath . 'v2/partner/APIKEY/archive/ARCHIVEID/delete'
127+
self::$mockBasePath . 'v2/project/APIKEY/archive/ARCHIVEID/delete'
128128
);
129129
$mock->addResponse($response);
130130
$this->client->addSubscriber($mock);
@@ -140,7 +140,7 @@ public function testDeletesArchive()
140140

141141
$request = $requests[0];
142142
$this->assertEquals('DELETE', strtoupper($request->getMethod()));
143-
$this->assertEquals('/v2/partner/'.$this->API_KEY.'/archive/'.$this->archiveData['id'], $request->getPath());
143+
$this->assertEquals('/v2/project/'.$this->API_KEY.'/archive/'.$this->archiveData['id'], $request->getPath());
144144
$this->assertEquals('api.opentok.com', $request->getHost());
145145
$this->assertEquals('https', $request->getScheme());
146146

tests/OpenTok/OpenTokTest.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ public function testStartsArchive()
397397
// Arrange
398398
$mock = new MockPlugin();
399399
$response = MockPlugin::getMockFile(
400-
self::$mockBasePath . 'v2/partner/APIKEY/archive/session'
400+
self::$mockBasePath . 'v2/project/APIKEY/archive/session'
401401
);
402402
$mock->addResponse($response);
403403
$this->client->addSubscriber($mock);
@@ -415,7 +415,7 @@ public function testStartsArchive()
415415

416416
$request = $requests[0];
417417
$this->assertEquals('POST', strtoupper($request->getMethod()));
418-
$this->assertEquals('/v2/partner/'.$this->API_KEY.'/archive', $request->getPath());
418+
$this->assertEquals('/v2/project/'.$this->API_KEY.'/archive', $request->getPath());
419419
$this->assertEquals('api.opentok.com', $request->getHost());
420420
$this->assertEquals('https', $request->getScheme());
421421

@@ -447,7 +447,7 @@ public function testStartsArchiveNamed()
447447
// Arrange
448448
$mock = new MockPlugin();
449449
$response = MockPlugin::getMockFile(
450-
self::$mockBasePath . 'v2/partner/APIKEY/archive/session_name-showtime'
450+
self::$mockBasePath . 'v2/project/APIKEY/archive/session_name-showtime'
451451
);
452452
$mock->addResponse($response);
453453
$this->client->addSubscriber($mock);
@@ -465,7 +465,7 @@ public function testStartsArchiveNamed()
465465

466466
$request = $requests[0];
467467
$this->assertEquals('POST', strtoupper($request->getMethod()));
468-
$this->assertEquals('/v2/partner/'.$this->API_KEY.'/archive', $request->getPath());
468+
$this->assertEquals('/v2/project/'.$this->API_KEY.'/archive', $request->getPath());
469469
$this->assertEquals('api.opentok.com', $request->getHost());
470470
$this->assertEquals('https', $request->getScheme());
471471

@@ -495,7 +495,7 @@ public function testStartsArchiveNamedDeprecated()
495495
// Arrange
496496
$mock = new MockPlugin();
497497
$response = MockPlugin::getMockFile(
498-
self::$mockBasePath . 'v2/partner/APIKEY/archive/session_name-showtime'
498+
self::$mockBasePath . 'v2/project/APIKEY/archive/session_name-showtime'
499499
);
500500
$mock->addResponse($response);
501501
$this->client->addSubscriber($mock);
@@ -513,7 +513,7 @@ public function testStartsArchiveNamedDeprecated()
513513

514514
$request = $requests[0];
515515
$this->assertEquals('POST', strtoupper($request->getMethod()));
516-
$this->assertEquals('/v2/partner/'.$this->API_KEY.'/archive', $request->getPath());
516+
$this->assertEquals('/v2/project/'.$this->API_KEY.'/archive', $request->getPath());
517517
$this->assertEquals('api.opentok.com', $request->getHost());
518518
$this->assertEquals('https', $request->getScheme());
519519

@@ -542,7 +542,7 @@ public function testStartsArchiveAudioOnly()
542542
// Arrange
543543
$mock = new MockPlugin();
544544
$response = MockPlugin::getMockFile(
545-
self::$mockBasePath . 'v2/partner/APIKEY/archive/session_hasVideo-false'
545+
self::$mockBasePath . 'v2/project/APIKEY/archive/session_hasVideo-false'
546546
);
547547
$mock->addResponse($response);
548548
$this->client->addSubscriber($mock);
@@ -560,7 +560,7 @@ public function testStartsArchiveAudioOnly()
560560

561561
$request = $requests[0];
562562
$this->assertEquals('POST', strtoupper($request->getMethod()));
563-
$this->assertEquals('/v2/partner/'.$this->API_KEY.'/archive', $request->getPath());
563+
$this->assertEquals('/v2/project/'.$this->API_KEY.'/archive', $request->getPath());
564564
$this->assertEquals('api.opentok.com', $request->getHost());
565565
$this->assertEquals('https', $request->getScheme());
566566

@@ -590,7 +590,7 @@ public function testStartsArchiveIndividualOutput()
590590
// Arrange
591591
$mock = new MockPlugin();
592592
$response = MockPlugin::getMockFile(
593-
self::$mockBasePath . 'v2/partner/APIKEY/archive/session_outputMode-individual'
593+
self::$mockBasePath . 'v2/project/APIKEY/archive/session_outputMode-individual'
594594
);
595595
$mock->addResponse($response);
596596
$this->client->addSubscriber($mock);
@@ -610,7 +610,7 @@ public function testStartsArchiveIndividualOutput()
610610

611611
$request = $requests[0];
612612
$this->assertEquals('POST', strtoupper($request->getMethod()));
613-
$this->assertEquals('/v2/partner/'.$this->API_KEY.'/archive', $request->getPath());
613+
$this->assertEquals('/v2/project/'.$this->API_KEY.'/archive', $request->getPath());
614614
$this->assertEquals('api.opentok.com', $request->getHost());
615615
$this->assertEquals('https', $request->getScheme());
616616

@@ -639,7 +639,7 @@ public function testStopsArchive()
639639
// Arrange
640640
$mock = new MockPlugin();
641641
$response = MockPlugin::getMockFile(
642-
self::$mockBasePath . 'v2/partner/APIKEY/archive/ARCHIVEID/stop'
642+
self::$mockBasePath . 'v2/project/APIKEY/archive/ARCHIVEID/stop'
643643
);
644644
$mock->addResponse($response);
645645
$this->client->addSubscriber($mock);
@@ -655,7 +655,7 @@ public function testStopsArchive()
655655

656656
$request = $requests[0];
657657
$this->assertEquals('POST', strtoupper($request->getMethod()));
658-
$this->assertEquals('/v2/partner/'.$this->API_KEY.'/archive/'.$archiveId.'/stop', $request->getPath());
658+
$this->assertEquals('/v2/project/'.$this->API_KEY.'/archive/'.$archiveId.'/stop', $request->getPath());
659659
$this->assertEquals('api.opentok.com', $request->getHost());
660660
$this->assertEquals('https', $request->getScheme());
661661

@@ -680,7 +680,7 @@ public function testGetsArchive()
680680
// Arrange
681681
$mock = new MockPlugin();
682682
$response = MockPlugin::getMockFile(
683-
self::$mockBasePath . 'v2/partner/APIKEY/archive/ARCHIVEID/get'
683+
self::$mockBasePath . 'v2/project/APIKEY/archive/ARCHIVEID/get'
684684
);
685685
$mock->addResponse($response);
686686
$this->client->addSubscriber($mock);
@@ -696,7 +696,7 @@ public function testGetsArchive()
696696

697697
$request = $requests[0];
698698
$this->assertEquals('GET', strtoupper($request->getMethod()));
699-
$this->assertEquals('/v2/partner/'.$this->API_KEY.'/archive/'.$archiveId, $request->getPath());
699+
$this->assertEquals('/v2/project/'.$this->API_KEY.'/archive/'.$archiveId, $request->getPath());
700700
$this->assertEquals('api.opentok.com', $request->getHost());
701701
$this->assertEquals('https', $request->getScheme());
702702

@@ -719,7 +719,7 @@ public function testDeletesArchive()
719719
// Arrange
720720
$mock = new MockPlugin();
721721
$response = MockPlugin::getMockFile(
722-
self::$mockBasePath . 'v2/partner/APIKEY/archive/ARCHIVEID/delete'
722+
self::$mockBasePath . 'v2/project/APIKEY/archive/ARCHIVEID/delete'
723723
);
724724
$mock->addResponse($response);
725725
$this->client->addSubscriber($mock);
@@ -735,7 +735,7 @@ public function testDeletesArchive()
735735

736736
$request = $requests[0];
737737
$this->assertEquals('DELETE', strtoupper($request->getMethod()));
738-
$this->assertEquals('/v2/partner/'.$this->API_KEY.'/archive/'.$archiveId, $request->getPath());
738+
$this->assertEquals('/v2/project/'.$this->API_KEY.'/archive/'.$archiveId, $request->getPath());
739739
$this->assertEquals('api.opentok.com', $request->getHost());
740740
$this->assertEquals('https', $request->getScheme());
741741

@@ -760,7 +760,7 @@ public function testListsArchives()
760760
// Arrange
761761
$mock = new MockPlugin();
762762
$response = MockPlugin::getMockFile(
763-
self::$mockBasePath . 'v2/partner/APIKEY/archive/get'
763+
self::$mockBasePath . 'v2/project/APIKEY/archive/get'
764764
);
765765
$mock->addResponse($response);
766766
$this->client->addSubscriber($mock);
@@ -774,7 +774,7 @@ public function testListsArchives()
774774

775775
$request = $requests[0];
776776
$this->assertEquals('GET', strtoupper($request->getMethod()));
777-
$this->assertEquals('/v2/partner/'.$this->API_KEY.'/archive', $request->getPath());
777+
$this->assertEquals('/v2/project/'.$this->API_KEY.'/archive', $request->getPath());
778778
$this->assertEquals('api.opentok.com', $request->getHost());
779779
$this->assertEquals('https', $request->getScheme());
780780

@@ -799,7 +799,7 @@ public function testFailsWhenListingArchivesWithTooLargeCount()
799799
// Arrange
800800
$mock = new MockPlugin();
801801
$response = MockPlugin::getMockFile(
802-
self::$mockBasePath . 'v2/partner/APIKEY/archive/get'
802+
self::$mockBasePath . 'v2/project/APIKEY/archive/get'
803803
);
804804
$mock->addResponse($response);
805805
$this->client->addSubscriber($mock);
@@ -818,7 +818,7 @@ public function testGetsExpiredArchive()
818818
// Arrange
819819
$mock = new MockPlugin();
820820
$response = MockPlugin::getMockFile(
821-
self::$mockBasePath . 'v2/partner/APIKEY/archive/ARCHIVEID/get-expired'
821+
self::$mockBasePath . 'v2/project/APIKEY/archive/ARCHIVEID/get-expired'
822822
);
823823
$mock->addResponse($response);
824824
$this->client->addSubscriber($mock);
@@ -1096,7 +1096,7 @@ public function testSipCall()
10961096
// Arrange
10971097
$mock = new MockPlugin();
10981098
$response = MockPlugin::getMockFile(
1099-
self::$mockBasePath . 'v2/partner/APIKEY/dial'
1099+
self::$mockBasePath . 'v2/project/APIKEY/dial'
11001100
);
11011101
$mock->addResponse($response);
11021102
$this->client->addSubscriber($mock);
@@ -1123,7 +1123,7 @@ public function testSipCallWithAuth()
11231123
// Arrange
11241124
$mock = new MockPlugin();
11251125
$response = MockPlugin::getMockFile(
1126-
self::$mockBasePath . 'v2/partner/APIKEY/dial'
1126+
self::$mockBasePath . 'v2/project/APIKEY/dial'
11271127
);
11281128
$mock->addResponse($response);
11291129
$this->client->addSubscriber($mock);
@@ -1165,7 +1165,7 @@ public function testFailedSipCall()
11651165
// Arrange
11661166
$mock = new MockPlugin();
11671167
$response = MockPlugin::getMockFile(
1168-
self::$mockBasePath . 'v2/partner/APIKEY/dial-failed'
1168+
self::$mockBasePath . 'v2/project/APIKEY/dial-failed'
11691169
);
11701170
$mock->addResponse($response);
11711171
$this->client->addSubscriber($mock);

0 commit comments

Comments
 (0)