line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JIRA::REST::Class::Sprint; |
2
|
4
|
|
|
4
|
|
1622
|
use parent qw( JIRA::REST::Class::Abstract ); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
16
|
|
3
|
4
|
|
|
4
|
|
218
|
use strict; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
61
|
|
4
|
4
|
|
|
4
|
|
12
|
use warnings; |
|
4
|
|
|
|
|
96
|
|
|
4
|
|
|
|
|
75
|
|
5
|
4
|
|
|
4
|
|
50
|
use 5.010; |
|
4
|
|
|
|
|
8
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
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 sprint of a JIRA issue as an object (if you're using L<Atlassian GreenHopper|https://www.atlassian.com/software/jira/agile>). |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
|
13
|
use Readonly 2.04; |
|
4
|
|
|
|
|
37
|
|
|
4
|
|
|
|
|
831
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Readonly my @ACCESSORS => qw( id rapidViewId state name startDate endDate |
17
|
|
|
|
|
|
|
completeDate sequence ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( @ACCESSORS ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Readonly my $GREENHOPPER_SPRINT => qr{ com [.] atlassian [.] greenhopper [.] |
22
|
|
|
|
|
|
|
service [.] sprint [.] Sprint }x; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub init { |
25
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
26
|
0
|
|
|
|
|
|
$self->SUPER::init( @_ ); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $data = $self->data; |
29
|
0
|
|
|
|
|
|
$data =~ s{ $GREENHOPPER_SPRINT [ ^ \[ ]+ \[ }{}x; |
30
|
0
|
|
|
|
|
|
$data =~ s{\]$}{}x; |
31
|
0
|
|
|
|
|
|
my @fields = split /,/, $data; |
32
|
0
|
|
|
|
|
|
foreach my $field ( @fields ) { |
33
|
0
|
|
|
|
|
|
my ( $k, $v ) = split /=/, $field; |
34
|
0
|
0
|
0
|
|
|
|
if ( $v && $v eq '<null>' ) { |
35
|
0
|
|
|
|
|
|
undef $v; |
36
|
|
|
|
|
|
|
} |
37
|
0
|
|
|
|
|
|
$self->{$k} = $v; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=pod |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=encoding UTF-8 |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=for :stopwords Packy Anderson Alexey Melezhik Atlassian GreenHopper JRC ScriptRunner TODO |
52
|
|
|
|
|
|
|
aggregateprogress aggregatetimeestimate aggregatetimeoriginalestimate |
53
|
|
|
|
|
|
|
assigneeType avatar avatarUrls completeDate displayName duedate |
54
|
|
|
|
|
|
|
emailAddress endDate fieldtype fixVersions fromString genericized iconUrl |
55
|
|
|
|
|
|
|
isAssigneeTypeValid issueTypes issuekeys issuelinks issuetype jira jql |
56
|
|
|
|
|
|
|
lastViewed maxResults originalEstimate originalEstimateSeconds parentkey |
57
|
|
|
|
|
|
|
projectId rapidViewId remainingEstimate remainingEstimateSeconds |
58
|
|
|
|
|
|
|
resolutiondate sprintlist startDate subtaskIssueTypes timeSpent |
59
|
|
|
|
|
|
|
timeSpentSeconds timeestimate timeoriginalestimate timespent timetracking |
60
|
|
|
|
|
|
|
toString updateAuthor worklog workratio |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 NAME |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
JIRA::REST::Class::Sprint - A helper class for L<JIRA::REST::Class|JIRA::REST::Class> that represents the sprint of a JIRA issue as an object (if you're using L<Atlassian GreenHopper|https://www.atlassian.com/software/jira/agile>). |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 VERSION |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
version 0.10 |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 READ-ONLY ACCESSORS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 B<id> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 B<rapidViewId> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 B<state> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 B<name> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 B<startDate> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 B<endDate> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 B<completeDate> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 B<sequence> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 RELATED CLASSES |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=over 2 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * L<JIRA::REST::Class|JIRA::REST::Class> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item * L<JIRA::REST::Class::Abstract|JIRA::REST::Class::Abstract> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=back |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# These methods don't work, probably because JIRA doesn't have a well-defined |
99
|
|
|
|
|
|
|
# interface for adding/removing issues from a sprint. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub greenhopper_api_url { |
102
|
|
|
|
|
|
|
my $self = shift; |
103
|
|
|
|
|
|
|
my $url = $self->jira->rest_api_url_base; |
104
|
|
|
|
|
|
|
$url =~ s{/rest/api/.+}{/rest/greenhopper/latest}; |
105
|
|
|
|
|
|
|
return $url; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub add_issues { |
109
|
|
|
|
|
|
|
my $self = shift; |
110
|
|
|
|
|
|
|
my $url = join '/', q{}, |
111
|
|
|
|
|
|
|
'sprint', $self->id, 'issues', 'add'; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
my $args = { issueKeys => \@_ }; |
114
|
|
|
|
|
|
|
my $host = $self->jira->{rest}->getHost; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
$self->jira->{rest}->setHost($self->greenhopper_api_url); |
117
|
|
|
|
|
|
|
$self->jira->{rest}->PUT($url, undef, $args); |
118
|
|
|
|
|
|
|
$self->jira->_content; |
119
|
|
|
|
|
|
|
$self->jira->{rest}->setHost($host); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub remove_issues { |
123
|
|
|
|
|
|
|
my $self = shift; |
124
|
|
|
|
|
|
|
my $url = join '/', q{}, |
125
|
|
|
|
|
|
|
'sprint', $self->id, 'issues', 'remove'; |
126
|
|
|
|
|
|
|
my $args = { issueKeys => \@_ }; |
127
|
|
|
|
|
|
|
my $host = $self->jira->{rest}->getHost; |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
$self->jira->{rest}->setHost($self->greenhopper_api_url); |
130
|
|
|
|
|
|
|
$self->jira->{rest}->PUT($url, undef, $args); |
131
|
|
|
|
|
|
|
$self->jira->_content; |
132
|
|
|
|
|
|
|
$self->jira->{rest}->setHost($host); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 AUTHOR |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Packy Anderson <packy@cpan.org> |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This software is Copyright (c) 2017 by Packy Anderson. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This is free software, licensed under: |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |