From 8dc052cdf835dc93e47ccec2d8b2541a40a6234f Mon Sep 17 00:00:00 2001 From: James Seconde Date: Mon, 11 Sep 2023 11:11:15 +0100 Subject: [PATCH] Add v1 to meetings Client --- src/Meetings/ClientFactory.php | 2 +- test/Meetings/ClientTest.php | 60 +++++++++++++++++----------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/Meetings/ClientFactory.php b/src/Meetings/ClientFactory.php index 436c62d8..eca8e738 100644 --- a/src/Meetings/ClientFactory.php +++ b/src/Meetings/ClientFactory.php @@ -15,7 +15,7 @@ public function __invoke(ContainerInterface $container): Client /** @var APIResource $api */ $api = $container->make(APIResource::class); $api - ->setBaseUrl('https://api-eu.vonage.com/meetings/') + ->setBaseUrl('https://api-eu.vonage.com/v1/meetings/') ->setExceptionErrorHandler(new ExceptionErrorHandler()) ->setAuthHandler(new KeypairHandler()); diff --git a/test/Meetings/ClientTest.php b/test/Meetings/ClientTest.php index 68c26b16..fa030a72 100644 --- a/test/Meetings/ClientTest.php +++ b/test/Meetings/ClientTest.php @@ -39,7 +39,7 @@ class ClientTest extends TestCase public function setUp(): void { $this->vonageClient = $this->prophesize(Client::class); - $this->vonageClient->getRestUrl()->willReturn('https://api-eu.vonage.com/meetings'); + $this->vonageClient->getRestUrl()->willReturn('https://api-eu.vonage.com/v1/meetings'); $this->vonageClient->getCredentials()->willReturn( new Client\Credentials\Container(new Client\Credentials\Keypair( file_get_contents(__DIR__ . '/../Client/Credentials/test.key'), @@ -52,14 +52,14 @@ public function setUp(): void ->setExceptionErrorHandler(new ExceptionErrorHandler()) ->setClient($this->vonageClient->reveal()) ->setAuthHandler(new KeypairHandler()) - ->setBaseUrl('https://api-eu.vonage.com/meetings'); + ->setBaseUrl('https://api-eu.vonage.com/v1/meetings'); $this->meetingsClient = new MeetingsClient($this->api); } public function testBaseUrlIsSet(): void { $this->assertEquals( - 'https://api-eu.vonage.com/meetings', + 'https://api-eu.vonage.com/v1/meetings', $this->meetingsClient->getAPIResource()->getBaseUrl() ); } @@ -71,7 +71,7 @@ public function testWillGetAvailableRooms(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/rooms?page_size=20', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/rooms?page_size=20', $uriString); return true; }))->willReturn($this->getResponse('get-rooms-success')); @@ -91,7 +91,7 @@ public function testWillGetAvailableRoomsWithFilter(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/rooms?start_id=999&end_id=234&page_size=20', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/rooms?start_id=999&end_id=234&page_size=20', $uriString); return true; }))->willReturn($this->getResponse('get-rooms-success')); @@ -111,7 +111,7 @@ public function testWillCreateRoom(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/rooms', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/rooms', $uriString); $this->assertRequestJsonBodyContains('display_name', 'test-room', $request); return true; @@ -134,7 +134,7 @@ public function testWillCreateLongTermRoom(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/rooms', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/rooms', $uriString); $this->assertRequestJsonBodyContains('display_name', 'test-room', $request); return true; @@ -161,7 +161,7 @@ public function testClientWillHandleUnauthorizedRequests(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/rooms', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/rooms', $uriString); $this->assertRequestJsonBodyContains('display_name', 'something', $request); return true; @@ -183,7 +183,7 @@ public function testClientWillHandleNotFoundResponse(): void $uri = $request->getUri(); $uriString = $uri->__toString(); $this->assertEquals( - 'https://api-eu.vonage.com/meetings/rooms/224d6219-dc05-4c09-9d42-96adce7fcb67', + 'https://api-eu.vonage.com/v1/meetings/rooms/224d6219-dc05-4c09-9d42-96adce7fcb67', $uriString ); return true; @@ -200,7 +200,7 @@ public function testClientWillHandleValidationError(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/rooms', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/rooms', $uriString); return true; }))->willReturn($this->getResponse('empty', 400)); @@ -221,7 +221,7 @@ public function testWillGetRoomDetails(): void $uri = $request->getUri(); $uriString = $uri->__toString(); $this->assertEquals( - 'https://api-eu.vonage.com/meetings/rooms/224d6219-dc05-4c09-9d42-96adce7fcb67', + 'https://api-eu.vonage.com/v1/meetings/rooms/224d6219-dc05-4c09-9d42-96adce7fcb67', $uriString ); return true; @@ -242,7 +242,7 @@ public function testWillUpdateExistingRoom(): void $uri = $request->getUri(); $uriString = $uri->__toString(); $this->assertEquals( - 'https://api-eu.vonage.com/meetings/rooms/e857c5ce-cdee-4971-ab20-208a98263282', + 'https://api-eu.vonage.com/v1/meetings/rooms/e857c5ce-cdee-4971-ab20-208a98263282', $uriString ); @@ -274,7 +274,7 @@ public function testWillGetRecording(): void $uri = $request->getUri(); $uriString = $uri->__toString(); $this->assertEquals( - 'https://api-eu.vonage.com/meetings/recordings/2dbd1cf7-afbb-45d8-9fb6-9e95ce2f8885', + 'https://api-eu.vonage.com/v1/meetings/recordings/2dbd1cf7-afbb-45d8-9fb6-9e95ce2f8885', $uriString ); @@ -294,7 +294,7 @@ public function testWillDeleteRecording(): void $uri = $request->getUri(); $uriString = $uri->__toString(); $this->assertEquals( - 'https://api-eu.vonage.com/meetings/recordings/2dbd1cf7-afbb-45d8-9fb6-9e95ce2f8885', + 'https://api-eu.vonage.com/v1/meetings/recordings/2dbd1cf7-afbb-45d8-9fb6-9e95ce2f8885', $uriString ); @@ -313,7 +313,7 @@ public function testWillGetRecordingsFromSession(): void $uri = $request->getUri(); $uriString = $uri->__toString(); $this->assertEquals( - 'https://api-eu.vonage.com/meetings/sessions/2_MX40NjMwODczMn5-MTU3NTgyODEwNzQ2MH5OZDJrVmdBRUNDbG5MUzNqNXgya20yQ1Z-fg/recordings', + 'https://api-eu.vonage.com/v1/meetings/sessions/2_MX40NjMwODczMn5-MTU3NTgyODEwNzQ2MH5OZDJrVmdBRUNDbG5MUzNqNXgya20yQ1Z-fg/recordings', $uriString ); @@ -335,7 +335,7 @@ public function testWillGetMeetingDialNumbers(): void $uri = $request->getUri(); $uriString = $uri->__toString(); $this->assertEquals( - 'https://api-eu.vonage.com/meetings/dial-in-numbers', + 'https://api-eu.vonage.com/v1/meetings/dial-in-numbers', $uriString ); @@ -357,7 +357,7 @@ public function testWillGetApplicationThemes(): void $uri = $request->getUri(); $uriString = $uri->__toString(); $this->assertEquals( - 'https://api-eu.vonage.com/meetings/themes', + 'https://api-eu.vonage.com/v1/meetings/themes', $uriString ); @@ -378,7 +378,7 @@ public function testWillCreateTheme(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/themes', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/themes', $uriString); $this->assertRequestJsonBodyContains('theme_name', 'My-Theme', $request); @@ -398,7 +398,7 @@ public function testWillHandleConflictErrorOnThemeCreation(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/themes', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/themes', $uriString); $this->assertRequestJsonBodyContains('theme_name', 'My-Theme', $request); @@ -417,7 +417,7 @@ public function testWillGetThemeById(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/themes/afb5b1f2-fe83-4b14-83ff-f23f5630c160', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/themes/afb5b1f2-fe83-4b14-83ff-f23f5630c160', $uriString); return true; }))->willReturn($this->getResponse('get-theme-success')); @@ -434,7 +434,7 @@ public function testWillDeleteTheme(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/themes/2dbd1cf7-afbb-45d8-9fb6-9e95ce2f8885', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/themes/2dbd1cf7-afbb-45d8-9fb6-9e95ce2f8885', $uriString); return true; }))->willReturn($this->getResponse('empty', 204)); @@ -450,7 +450,7 @@ public function testWillForceDeleteTheme(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/themes/2dbd1cf7-afbb-45d8-9fb6-9e95ce2f8885?force=true', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/themes/2dbd1cf7-afbb-45d8-9fb6-9e95ce2f8885?force=true', $uriString); return true; }))->willReturn($this->getResponse('empty', 204)); @@ -468,7 +468,7 @@ public function testWillUpdateThemeById(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/themes/afb5b1f2-fe83-4b14-83ff-f23f5630c160', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/themes/afb5b1f2-fe83-4b14-83ff-f23f5630c160', $uriString); return true; }))->willReturn($this->getResponse('update-theme-success')); @@ -499,7 +499,7 @@ public function testWillExtractCorrectImageKey($logoType, $validCall): void if ($request->getMethod() === 'GET') { $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/themes/logos-upload-urls', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/themes/logos-upload-urls', $uriString); return true; } @@ -521,7 +521,7 @@ public function testWillUploadImageToAws(): void if ($request->getMethod() === 'GET') { $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/themes/logos-upload-urls', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/themes/logos-upload-urls', $uriString); return true; } @@ -531,7 +531,7 @@ public function testWillUploadImageToAws(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/themes/afb5b1f2-fe83-4b14-83ff-f23f5630c160/finalizeLogos', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/themes/afb5b1f2-fe83-4b14-83ff-f23f5630c160/finalizeLogos', $uriString); return true; } @@ -566,7 +566,7 @@ public function testCanGetUploadUrlsForThemeLogo(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/themes/logos-upload-urls', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/themes/logos-upload-urls', $uriString); return true; }))->willReturn($this->getResponse('get-upload-urls-success')); @@ -582,7 +582,7 @@ public function testWillGetRoomsAssociatedWithTheme(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/themes/323867d7-8c4b-4dce-8c11-48f14425d888/rooms?page_size=20', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/themes/323867d7-8c4b-4dce-8c11-48f14425d888/rooms?page_size=20', $uriString); return true; }))->willReturn($this->getResponse('get-rooms-by-theme-id-success')); @@ -601,7 +601,7 @@ public function testWillGetRoomsAssociatedWithThemeUsingFilter(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/themes/323867d7-8c4b-4dce-8c11-48f14425d888/rooms?start_id=245&end_id=765&page_size=20', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/themes/323867d7-8c4b-4dce-8c11-48f14425d888/rooms?start_id=245&end_id=765&page_size=20', $uriString); return true; }))->willReturn($this->getResponse('get-rooms-by-theme-id-success')); @@ -621,7 +621,7 @@ public function testWillUpdateExistingApplication(): void $uri = $request->getUri(); $uriString = $uri->__toString(); - $this->assertEquals('https://api-eu.vonage.com/meetings/applications', $uriString); + $this->assertEquals('https://api-eu.vonage.com/v1/meetings/applications', $uriString); return true; }))->willReturn($this->getResponse('update-application-success'));