blib/lib/JIRA/REST/Class/Issue/Comment.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 43 SCAR 6.9
CC
1
Cov
0%
init
2.0
delete
2.0
BEGIN
2.0
CRAP 2.0
1 package JIRA::REST::Class::Issue::Comment;
2 use parent qw( JIRA::REST::Class::Abstract );
3 use strict;
4 use warnings;
5 use 5.010;
6  
7 our $VERSION = '0.11';
8 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 use Readonly 2.04;
15  
16 # fields that will be turned into JIRA::REST::Class::User objects
17 Readonly my @USERS => qw( author updateAuthor );
18  
19 # fields that will be turned into DateTime objects
20 Readonly my @DATES => qw( created updated );
21  
22 __PACKAGE__->mk_ro_accessors( @USERS, @DATES );
23  
24 __PACKAGE__->mk_data_ro_accessors( qw/ body id self visibility / );
25  
26 __PACKAGE__->mk_contextual_ro_accessors();
27  
28 sub init {
29 my $self = shift;
30 $self->SUPER::init( @_ );
31  
32 # make user objects
33 foreach my $field ( @USERS ) {
34 $self->populate_scalar_data( $field, 'user', $field );
35 }
36  
37 # make date objects
38 foreach my $field ( @DATES ) {
39 $self->{$field} = $self->make_date( $self->data->{$field} );
40 }
41  
42 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 sub delete { ## no critic (ProhibitBuiltinHomonyms)
52 my $self = shift;
53 $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 undef $self->issue->{comments};
58  
59 return;
60 }
61  
62 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__
103  
104 =pod
105  
106 =encoding UTF-8
107  
108 =for :stopwords Packy Anderson Alexandr Alexey Ciornii Melezhik iconUrl updateAuthor
109  
110 =head1 NAME
111  
112 JIRA::REST::Class::Issue::Comment - A helper class for L<JIRA::REST::Class|JIRA::REST::Class> that represents a comment on a JIRA issue as an object.
113  
114 =head1 VERSION
115  
116 version 0.11
117  
118 =head1 METHODS
119  
120 =head2 B<delete>
121  
122 Deletes the comment from the issue. Returns nothing.
123  
124 =head1 READ-ONLY ACCESSORS
125  
126 =head2 B<author>
127  
128 The author of the comment as a
129 L<JIRA::REST::Class::User|JIRA::REST::Class::User> object.
130  
131 =head2 B<updateAuthor>
132  
133 The updateAuthor of the comment as a
134 L<JIRA::REST::Class::User|JIRA::REST::Class::User> object.
135  
136 =head2 B<created>
137  
138 The created date for the comment as a L<DateTime|DateTime> object.
139  
140 =head2 B<updated>
141  
142 The updated date for the comment as a L<DateTime|DateTime> object.
143  
144 =head2 B<body>
145  
146 The body of the comment as a string.
147  
148 =head2 B<id>
149  
150 The ID of the comment.
151  
152 =head2 B<self>
153  
154 The full URL for the JIRA REST API call for the comment.
155  
156 =head2 B<visibility>
157  
158 A hash reference representing the visibility of the comment.
159  
160 =head1 RELATED CLASSES
161  
162 =over 2
163  
164 =item * L<JIRA::REST::Class|JIRA::REST::Class>
165  
166 =item * L<JIRA::REST::Class::Abstract|JIRA::REST::Class::Abstract>
167  
168 =item * L<JIRA::REST::Class::User|JIRA::REST::Class::User>
169  
170 =back
171  
172 =head1 AUTHOR
173  
174 Packy Anderson <packy@cpan.org>
175  
176 =head1 COPYRIGHT AND LICENSE
177  
178 This software is Copyright (c) 2017 by Packy Anderson.
179  
180 This is free software, licensed under:
181  
182 The Artistic License 2.0 (GPL Compatible)
183  
184 =cut