Class/Issue/Comment.pm

filter: Statementstmt 66.6% 22 / 33 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 100% 2 / 2 totaltotal 69.0% 29 / 42 CC 3 SCAR 15.6
CC
3
Cov
67%
init
12.0
delete
2.0
BEGIN
1.0
CRAP 4.8
« Class/Project.pm ↑ Summary Class/Issue/Type.pm »
1 package JIRA::REST::Class::Issue::Comment;
2 4 ▶use parent qw( JIRA::REST::Class::Abstract );
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 our $VERSION = '0.12';
8 4 our $SOURCE = 'CPAN';
9 ## $SOURCE = 'GitHub'; # COMMENT
10 # the line above will be commented out by Dist::Zilla
11  
12 # ABSTRACT: A helper class for L<JIRA::REST::Class|JIRA::REST::Class> that represents a comment on a JIRA issue as an object.
13  
14 4 ▶use Readonly 2.04;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 # fields that will be turned into JIRA::REST::Class::User objects
17 4 Readonly my @USERS => qw( author updateAuthor );
18  
19 # fields that will be turned into DateTime objects
20 4 Readonly my @DATES => qw( created updated );
21  
22 4 __PACKAGE__->mk_ro_accessors( @USERS, @DATES );
23  
24 4 __PACKAGE__->mk_data_ro_accessors( qw/ body id self visibility / );
25  
26 4 __PACKAGE__->mk_contextual_ro_accessors();
27  
28 0 ▶sub init {
Subroutine init: not called CC=3 SCAR=24.8
Pod documented
29 0 my $self = shift;
30 0 $self->SUPER::init( @_ );
31  
32 # make user objects
33 0 foreach my $field ( @USERS ) {
34 0 $self->populate_scalar_data( $field, 'user', $field );
35 }
36  
37 # make date objects
38 0 foreach my $field ( @DATES ) {
39 0 $self->{$field} = $self->make_date( $self->data->{$field} );
40 }
41  
42 0 return;
43 }
44  
45 #pod =method B<delete>
46 #pod
47 #pod Deletes the comment from the issue. Returns nothing.
48 #pod
49 #pod =cut
50  
51 0 ▶sub delete { ## no critic (ProhibitBuiltinHomonyms)
Subroutine delete: not called CC=1 SCAR=6.9
Pod documented
52 0 my $self = shift;
53 0 $self->issue->delete( '/comment/' . $self->id );
54  
55 # now that we've deleted this comment, the
56 # lazy accessor will need to be reloaded
57 0 undef $self->issue->{comments};
58  
59 0 return;
60 }
61  
62 4 1;
63  
64 #pod =accessor B<author>
65 #pod
66 #pod The author of the comment as a
67 #pod L<JIRA::REST::Class::User|JIRA::REST::Class::User> object.
68 #pod
69 #pod =accessor B<updateAuthor>
70 #pod
71 #pod The updateAuthor of the comment as a
72 #pod L<JIRA::REST::Class::User|JIRA::REST::Class::User> object.
73 #pod
74 #pod =accessor B<created>
75 #pod
76 #pod The created date for the comment as a L<DateTime|DateTime> object.
77 #pod
78 #pod =accessor B<updated>
79 #pod
80 #pod The updated date for the comment as a L<DateTime|DateTime> object.
81 #pod
82 #pod =accessor B<body>
83 #pod
84 #pod The body of the comment as a string.
85 #pod
86 #pod =accessor B<id>
87 #pod
88 #pod The ID of the comment.
89 #pod
90 #pod =accessor B<self>
91 #pod
92 #pod The full URL for the JIRA REST API call for the comment.
93 #pod
94 #pod =accessor B<visibility>
95 #pod
96 #pod A hash reference representing the visibility of the comment.
97 #pod
98 #pod =for stopwords iconUrl updateAuthor
99 #pod
100 #pod =cut
101  
102 __END__
« Class/Project.pm ↑ Summary Class/Issue/Type.pm »