Skip to content

Commit

Permalink
Add v1 to meetings Client
Browse files Browse the repository at this point in the history
  • Loading branch information
SecondeJK committed Sep 11, 2023
1 parent 61b63a7 commit 8dc052c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/Meetings/ClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
60 changes: 30 additions & 30 deletions test/Meetings/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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()
);
}
Expand All @@ -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'));
Expand All @@ -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'));
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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));
Expand All @@ -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;
Expand All @@ -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
);

Expand Down Expand Up @@ -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
);

Expand All @@ -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
);

Expand All @@ -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
);

Expand All @@ -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
);

Expand All @@ -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
);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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'));
Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -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'));
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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'));
Expand All @@ -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'));
Expand All @@ -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'));
Expand All @@ -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'));
Expand Down

0 comments on commit 8dc052c

Please sign in to comment.