LinkEmbedder/Link/NHL.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 26 CC 4 SCAR 28.0
CC
4
Cov
0%
learn_p
20.0
BEGIN
2.0
CRAP 16.4
1 package LinkEmbedder::Link::NHL;
2 use Mojo::Base 'LinkEmbedder::Link';
3  
4 has provider_name => 'NHL';
5 has provider_url => sub { Mojo::URL->new('https://www.nhl.com') };
6  
7 sub learn_p {
8 my $self = shift;
9 my $path = $self->url->path->to_string;
10 return $self->SUPER::learn_p unless $path =~ m!^/video!;
11  
12 $path =~ s!/video!video/embed!;
13 $self->{iframe_src} = "https://www.nhl.com/$path?autostart=false";
14 $self->height(360) unless $self->height;
15 $self->width(540) unless $self->width;
16 $self->type('rich');
17 $self->template->[1] = 'iframe.html.ep';
18 $self->title("NHL Video");
19  
20 return Mojo::Promise->new->resolve($self);
21 }
22  
23 1;