CSAF/ROLIE/Entry.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 41 CC 2 SCAR 11.0
CC
2
Cov
0%
TO_JSON
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.0
1 package CSAF::ROLIE::Entry;
2  
3 use 5.010001;
4 use strict;
5 use warnings;
6 use utf8;
7  
8 use Moo;
9 use CSAF::Util qw(parse_datetime);
10  
11 has id => (is => 'rw', required => 1);
12 has title => (is => 'rw', required => 1);
13 has published => (is => 'rw', coerce => \&parse_datetime);
14 has updated => (is => 'rw', required => 1, coerce => \&parse_datetime);
15 has format => (is => 'rw', required => 1);
16 has link => (is => 'rw', required => 1);
17 has content => (is => 'rw', required => 1);
18 has summary => (is => 'rw');
19  
20 sub TO_JSON {
21  
22 my $self = shift;
23  
24 my $json = {
25 id => $self->id,
26 title => $self->title,
27 published => $self->published->datetime,
28 updated => $self->updated->datetime,
29 format => $self->format,
30 link => $self->link,
31 content => $self->content
32 };
33  
34 $json->{summary} = $self->summary if ($self->summary);
35  
36 return $json;
37  
38 }
39  
40 1;
41  
42 __END__