lib/JIRA/REST/Class/Sprint.pm

filter: Statementstmt 62.5% 20 / 32 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 100% 1 / 1 totaltotal 56.5% 26 / 46 SCAR 17.1
CC
4
Cov
54%
init
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.6
« lib/JIRA/REST/Class/Project/Version.pm ↑ Summary lib/JIRA/REST/Class/Issue/Comment.pm »
1 package JIRA::REST::Class::Sprint;
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.10';
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 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 ▶use Readonly 2.04;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 4 Readonly my @ACCESSORS => qw( id rapidViewId state name startDate endDate
17 completeDate sequence );
18  
19 4 __PACKAGE__->mk_ro_accessors( @ACCESSORS );
20  
21 4 Readonly my $GREENHOPPER_SPRINT => qr{ com [.] atlassian [.] greenhopper [.]
22 service [.] sprint [.] Sprint }x;
23  
24 sub init {
25 0 ▶ my $self = shift;
Subroutine init: not called CC=4 SCAR=30.0
Pod documented
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 ▶ if ( $v && $v eq '<null>' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($v and $v eq "<null>") 0 0 0
Condition0%0/3
$v and $v eq "<null>"
!ll&&!rl&&r
000
MC/DC0%0/2
$v and $v eq "<null>"
$v $v eq "<null>"
Truth table0%0/3
A and B
A= $vB= $v eq "<null>"
ABresult
0X0
100
111
35 0 undef $v;
36 }
37 0 $self->{$k} = $v;
38 }
39  
40 0 return;
41 }
42  
43 4 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
« lib/JIRA/REST/Class/Project/Version.pm ↑ Summary lib/JIRA/REST/Class/Issue/Comment.pm »