line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::SocialMeta::Twitter; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
24
|
use Moo; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
32
|
|
4
|
5
|
|
|
5
|
|
975
|
use Carp; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
1698
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
extends 'HTML::SocialMeta::Base'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.6'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Provider Specific Fields |
11
|
|
|
|
|
|
|
has 'meta_attribute' => ( is => 'ro', default => 'name' ); |
12
|
|
|
|
|
|
|
has 'meta_namespace' => ( is => 'ro', default => 'twitter' ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has '+card_options' => ( |
15
|
|
|
|
|
|
|
default => sub { |
16
|
|
|
|
|
|
|
return { |
17
|
|
|
|
|
|
|
summary => q(create_summary), |
18
|
|
|
|
|
|
|
featured_image => q(create_summary_large_image), |
19
|
|
|
|
|
|
|
app => q(create_app), |
20
|
|
|
|
|
|
|
player => q(create_player), |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has '+build_fields' => ( |
26
|
|
|
|
|
|
|
default => sub { |
27
|
|
|
|
|
|
|
return { |
28
|
|
|
|
|
|
|
summary => [qw(card site title description image)], |
29
|
|
|
|
|
|
|
summary_large_image => [qw(card site title description image)], |
30
|
|
|
|
|
|
|
app => |
31
|
|
|
|
|
|
|
[qw(card site description app_country app_name app_id app_url)], |
32
|
|
|
|
|
|
|
player => [ |
33
|
|
|
|
|
|
|
qw(card site title description image player player_width player_height) |
34
|
|
|
|
|
|
|
], |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub create_summary { |
40
|
5
|
|
|
5
|
1
|
72
|
my ($self) = @_; |
41
|
|
|
|
|
|
|
|
42
|
5
|
|
|
|
|
44
|
$self->card('summary'); |
43
|
|
|
|
|
|
|
|
44
|
5
|
|
|
|
|
1020
|
return $self->build_meta_tags( $self->card ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub create_summary_large_image { |
48
|
4
|
|
|
4
|
1
|
23
|
my ($self) = @_; |
49
|
|
|
|
|
|
|
|
50
|
4
|
|
|
|
|
59
|
$self->card('summary_large_image'); |
51
|
|
|
|
|
|
|
|
52
|
4
|
|
|
|
|
59
|
return $self->build_meta_tags( $self->card ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub create_app { |
56
|
6
|
|
|
6
|
1
|
28
|
my ($self) = @_; |
57
|
|
|
|
|
|
|
|
58
|
6
|
|
|
|
|
91
|
$self->card('app'); |
59
|
|
|
|
|
|
|
|
60
|
6
|
|
|
|
|
94
|
return $self->build_meta_tags( $self->card ); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub create_player { |
64
|
3
|
|
|
3
|
1
|
28
|
my ($self) = @_; |
65
|
|
|
|
|
|
|
|
66
|
3
|
|
|
|
|
48
|
$self->card('player'); |
67
|
|
|
|
|
|
|
|
68
|
3
|
|
|
|
|
45
|
return $self->build_meta_tags( $self->card ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub provider_convert { |
72
|
33
|
|
|
33
|
0
|
30
|
my ( $self, $field ) = @_; |
73
|
|
|
|
|
|
|
|
74
|
33
|
100
|
100
|
|
|
174
|
return [ { field_type => $field } ] |
75
|
|
|
|
|
|
|
if $field !~ m{^app}xms || $field =~ m{country$}xms; |
76
|
|
|
|
|
|
|
|
77
|
18
|
100
|
|
|
|
226
|
return [ { field_type => $field . ':googleplay' } ] |
78
|
|
|
|
|
|
|
if $self->operatingSystem eq q{ANDROID}; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
return [ |
81
|
9
|
50
|
|
|
|
139
|
{ field_type => $field . ':iphone' }, |
82
|
|
|
|
|
|
|
{ field_type => $field . ':ipad' } |
83
|
|
|
|
|
|
|
] |
84
|
|
|
|
|
|
|
if $self->operatingSystem eq q{IOS}; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
return croak 'We currently do not support this APP type'; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# |
90
|
|
|
|
|
|
|
# The End |
91
|
|
|
|
|
|
|
# |
92
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |