line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JIRA::REST::Class::Issue::TimeTracking; |
2
|
4
|
|
|
4
|
|
1449
|
use parent qw( JIRA::REST::Class::Abstract ); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
16
|
|
3
|
4
|
|
|
4
|
|
195
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
63
|
|
4
|
4
|
|
|
4
|
|
14
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
74
|
|
5
|
4
|
|
|
4
|
|
47
|
use 5.010; |
|
4
|
|
|
|
|
10
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.12'; |
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 the time tracking for a JIRA issue as an object. |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
|
2185
|
use Contextual::Return; |
|
4
|
|
|
|
|
45510
|
|
|
4
|
|
|
|
|
21
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub init { |
17
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
18
|
0
|
|
|
|
|
|
$self->SUPER::init( @_ ); |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $data = $self->issue->get( q{}, { fields => 'timetracking' } ); |
21
|
0
|
|
|
|
|
|
$self->{data} = $data->{fields}->{timetracking}; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
return; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#pod =accessor B<originalEstimate> |
27
|
|
|
|
|
|
|
#pod |
28
|
|
|
|
|
|
|
#pod Returns the original estimate as a number of seconds in numeric context, and as a w/d/h/m/s string in a string context. |
29
|
|
|
|
|
|
|
#pod |
30
|
|
|
|
|
|
|
#pod =cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub originalEstimate { |
33
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
34
|
|
|
|
|
|
|
#<<< |
35
|
|
|
|
|
|
|
return |
36
|
0
|
|
|
0
|
|
|
NUM { $self->data->{originalEstimateSeconds} } |
37
|
0
|
|
|
0
|
|
|
STR { $self->data->{originalEstimate} } |
38
|
0
|
|
|
|
|
|
; |
39
|
|
|
|
|
|
|
#>>> |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#pod =accessor B<remainingEstimate> |
43
|
|
|
|
|
|
|
#pod |
44
|
|
|
|
|
|
|
#pod Returns the remaining estimate as a number of seconds in numeric context, and as a w/d/h/m/s string in a string context. |
45
|
|
|
|
|
|
|
#pod |
46
|
|
|
|
|
|
|
#pod =cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub remainingEstimate { |
49
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
50
|
|
|
|
|
|
|
#<<< |
51
|
|
|
|
|
|
|
return |
52
|
0
|
|
|
0
|
|
|
NUM { $self->data->{remainingEstimateSeconds} } |
53
|
0
|
|
|
0
|
|
|
STR { $self->data->{remainingEstimate} } |
54
|
0
|
|
|
|
|
|
; |
55
|
|
|
|
|
|
|
#>>> |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
#pod =accessor B<timeSpent> |
59
|
|
|
|
|
|
|
#pod |
60
|
|
|
|
|
|
|
#pod Returns the time spent as a number of seconds in numeric context, and as a w/d/h/m/s string in a string context. |
61
|
|
|
|
|
|
|
#pod |
62
|
|
|
|
|
|
|
#pod =cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub timeSpent { |
65
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
66
|
|
|
|
|
|
|
#<<< |
67
|
|
|
|
|
|
|
return |
68
|
0
|
|
|
0
|
|
|
NUM { $self->data->{timeSpentSeconds} } |
69
|
0
|
|
|
0
|
|
|
STR { $self->data->{timeSpent} } |
70
|
0
|
|
|
|
|
|
; |
71
|
|
|
|
|
|
|
#>>> |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
#pod =method B<set_originalEstimate> |
75
|
|
|
|
|
|
|
#pod |
76
|
|
|
|
|
|
|
#pod Sets the original estimate to the amount of time given. Accepts any time format that JIRA uses. |
77
|
|
|
|
|
|
|
#pod |
78
|
|
|
|
|
|
|
#pod =cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub set_originalEstimate { |
81
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
82
|
0
|
|
|
|
|
|
my $est = shift; |
83
|
0
|
|
|
|
|
|
return $self->update( { originalEstimate => $est } ); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
#pod =method B<set_remainingEstimate> |
87
|
|
|
|
|
|
|
#pod |
88
|
|
|
|
|
|
|
#pod Sets the remaining estimate to the amount of time given. Accepts any time format that JIRA uses. |
89
|
|
|
|
|
|
|
#pod |
90
|
|
|
|
|
|
|
#pod =cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub set_remainingEstimate { |
93
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
94
|
0
|
|
|
|
|
|
my $est = shift; |
95
|
0
|
|
|
|
|
|
return $self->update( { remainingEstimate => $est } ); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
#pod =method B<update> |
99
|
|
|
|
|
|
|
#pod |
100
|
|
|
|
|
|
|
#pod Accepts a hashref of timetracking fields to update. The acceptable fields are determined by JIRA, but I think they're originalEstimate and remainingEstimate. |
101
|
|
|
|
|
|
|
#pod |
102
|
|
|
|
|
|
|
#pod =cut |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub update { |
105
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
106
|
0
|
|
|
|
|
|
my $update = shift; |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
foreach my $key ( qw/ originalEstimate remainingEstimate / ) { |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# if we're updating the key, don't change it |
111
|
0
|
0
|
|
|
|
|
next if exists $update->{$key}; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# since we're not updating the key, copy the original value |
114
|
|
|
|
|
|
|
# into the update, because the REST interface has an annoying |
115
|
|
|
|
|
|
|
# tendency to reset those values if you don't explicitly set them |
116
|
0
|
0
|
|
|
|
|
if ( defined $self->data->{$key} ) { |
117
|
0
|
|
|
|
|
|
$update->{$key} = $self->data->{$key}; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
return $self->issue->put_field( timetracking => $update ); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
__END__ |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=pod |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=encoding UTF-8 |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=for :stopwords Packy Anderson Alexandr Alexey Ciornii Heumann Manni Melezhik Atlassian |
133
|
|
|
|
|
|
|
GreenHopper JRC ScriptRunner TODO aggregateprogress aggregatetimeestimate |
134
|
|
|
|
|
|
|
aggregatetimeoriginalestimate assigneeType avatar avatarUrls completeDate |
135
|
|
|
|
|
|
|
displayName duedate emailAddress endDate fieldtype fixVersions fromString |
136
|
|
|
|
|
|
|
genericized iconUrl isAssigneeTypeValid issueTypes issuekeys issuelinks |
137
|
|
|
|
|
|
|
issuetype jira jql lastViewed maxResults originalEstimate |
138
|
|
|
|
|
|
|
originalEstimateSeconds parentkey projectId rapidViewId remainingEstimate |
139
|
|
|
|
|
|
|
remainingEstimateSeconds resolutiondate sprintlist startDate |
140
|
|
|
|
|
|
|
subtaskIssueTypes timeSpent timeSpentSeconds timeestimate |
141
|
|
|
|
|
|
|
timeoriginalestimate timespent timetracking toString updateAuthor worklog |
142
|
|
|
|
|
|
|
workratio |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 NAME |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
JIRA::REST::Class::Issue::TimeTracking - A helper class for L<JIRA::REST::Class|JIRA::REST::Class> that represents the time tracking for a JIRA issue as an object. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 VERSION |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
version 0.12 |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 METHODS |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 B<set_originalEstimate> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Sets the original estimate to the amount of time given. Accepts any time format that JIRA uses. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 B<set_remainingEstimate> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Sets the remaining estimate to the amount of time given. Accepts any time format that JIRA uses. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 B<update> |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Accepts a hashref of timetracking fields to update. The acceptable fields are determined by JIRA, but I think they're originalEstimate and remainingEstimate. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 READ-ONLY ACCESSORS |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 B<originalEstimate> |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Returns the original estimate as a number of seconds in numeric context, and as a w/d/h/m/s string in a string context. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head2 B<remainingEstimate> |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Returns the remaining estimate as a number of seconds in numeric context, and as a w/d/h/m/s string in a string context. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head2 B<timeSpent> |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Returns the time spent as a number of seconds in numeric context, and as a w/d/h/m/s string in a string context. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head1 RELATED CLASSES |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=over 2 |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * L<JIRA::REST::Class|JIRA::REST::Class> |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=item * L<JIRA::REST::Class::Abstract|JIRA::REST::Class::Abstract> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=back |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 AUTHOR |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Packy Anderson <packy@cpan.org> |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
This software is Copyright (c) 2017 by Packy Anderson. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
This is free software, licensed under: |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=cut |