Skip to content
Permalink
Browse files

Merge pull request #328 from bendesilva/add-vimeo

Add Vimeo as a provider
  • Loading branch information...
oscarotero committed Sep 16, 2019
2 parents 960bbd5 + 55df81e commit dc1dc3c126f8a78acdae06b83f591c0728ea131d
Showing with 51 additions and 0 deletions.
  1. +22 −0 src/Adapters/Vimeo.php
  2. +9 −0 src/Providers/OEmbed/Vimeo.php
  3. +20 −0 tests/VimeoTest.php
@@ -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/*',
]);
}
}
@@ -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';
}
@@ -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>',
]
);
}
}

0 comments on commit dc1dc3c

Please sign in to comment.
You can’t perform that action at this time.