Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/Adapters/Vimeo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Embed\Adapters;

use Embed\Http\Response;

/**
* Adapter to provide information from Vimeo.
* Required when Vimeo returns a 403 status code.
*/
class Vimeo extends Webpage
{
/**
* {@inheritdoc}
*/
public static function check(Response $response)
{
return $response->isValid([200, 403]) && $response->getUrl()->match([
'vimeo.com/*',
]);
}
}
9 changes: 9 additions & 0 deletions src/Providers/OEmbed/Vimeo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Embed\Providers\OEmbed;

class Vimeo extends EndPoint implements EndPointInterface
{
protected static $pattern = ['vimeo.com/*'];
protected static $endPoint = 'https://vimeo.com/api/oembed.json';
}
20 changes: 20 additions & 0 deletions tests/VimeoTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Embed\Tests;

class VimeoTest extends AbstractTestCase
{
public function testOne()
{
$this->assertEmbed(
'https://vimeo.com/235352744',
[
'title' => 'Vimeo Live is here',
'providerName' => 'Vimeo',
'width' => 640,
'height' => 360,
'code' => '<iframe src="https://player.vimeo.com/video/235352744?app_id=122963" width="640" height="360" frameborder="0" allow="autoplay; fullscreen" allowfullscreen title="Vimeo Live is here"></iframe>',
]
);
}
}