Skip to content

Commit 95b746f

Browse files
authored
Merge pull request #262 from jazzdrive3/add-infogram-support
Add support for Infogram oembed.
2 parents c71e62f + ebe107e commit 95b746f

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/Providers/OEmbed/Infogram.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Embed\Providers\OEmbed;
4+
5+
use Embed\Http\Url;
6+
7+
class Infogram extends EndPoint implements EndPointInterface
8+
{
9+
protected static $pattern = [
10+
'infogr.am/*',
11+
'www.infogr.am/*',
12+
];
13+
protected static $endPoint = 'https://infogr.am/oembed';
14+
15+
/**
16+
* {@inheritdoc}
17+
*/
18+
public function getEndPoint()
19+
{
20+
$url = $this->response->getUrl()->withScheme('https');
21+
22+
return Url::create(static::$endPoint)
23+
->withQueryParameters([
24+
'url' => (string) $url,
25+
]);
26+
}
27+
}

tests/InfogramTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Embed\Tests;
4+
5+
class InfogramTest extends AbstractTestCase
6+
{
7+
public function testOne()
8+
{
9+
$this->assertEmbed(
10+
'https://infogr.am/7743c36a-f3ca-4465-9a80-a8abbd5d8dc4',
11+
[
12+
'title' => 'Frost Bank Advisors (online graphic)',
13+
'width' => 550,
14+
'height' => 600,
15+
'type' => 'rich',
16+
'providerName' => 'Infogram',
17+
'author_url' => 'https://infogram.com/sabjnewsroom01',
18+
]
19+
);
20+
}
21+
}

0 commit comments

Comments
 (0)