-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #328 from bendesilva/add-vimeo
Add Vimeo as a provider
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/*', | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>', | ||
] | ||
); | ||
} | ||
} |