| 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.11'; | |||||||||||||||||||||||||||
| 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
Condition0%0/3
$v and $v eq "<null>"
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>"
| |||||||||||||||||||||||||||||
| 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 Alexandr Alexey Ciornii Melezhik Atlassian GreenHopper JRC | ||||||||||||||||||||||||||||
| 52 | ScriptRunner TODO aggregateprogress aggregatetimeestimate | ||||||||||||||||||||||||||||
| 53 | aggregatetimeoriginalestimate assigneeType avatar avatarUrls completeDate | ||||||||||||||||||||||||||||
| 54 | displayName duedate emailAddress endDate fieldtype fixVersions fromString | ||||||||||||||||||||||||||||
| 55 | genericized iconUrl isAssigneeTypeValid issueTypes issuekeys issuelinks | ||||||||||||||||||||||||||||
| 56 | issuetype jira jql lastViewed maxResults originalEstimate | ||||||||||||||||||||||||||||
| 57 | originalEstimateSeconds parentkey projectId rapidViewId remainingEstimate | ||||||||||||||||||||||||||||
| 58 | remainingEstimateSeconds resolutiondate sprintlist startDate | ||||||||||||||||||||||||||||
| 59 | subtaskIssueTypes timeSpent timeSpentSeconds timeestimate | ||||||||||||||||||||||||||||
| 60 | timeoriginalestimate timespent timetracking toString updateAuthor worklog | ||||||||||||||||||||||||||||
| 61 | workratio | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | =head1 NAME | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 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>). | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =head1 VERSION | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | version 0.11 | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | =head1 READ-ONLY ACCESSORS | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =head2 B<id> | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =head2 B<rapidViewId> | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | =head2 B<state> | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | =head2 B<name> | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | =head2 B<startDate> | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | =head2 B<endDate> | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | =head2 B<completeDate> | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | =head2 B<sequence> | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | =head1 RELATED CLASSES | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | =over 2 | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | =item * L<JIRA::REST::Class|JIRA::REST::Class> | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | =item * L<JIRA::REST::Class::Abstract|JIRA::REST::Class::Abstract> | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | =back | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | # These methods don't work, probably because JIRA doesn't have a well-defined | ||||||||||||||||||||||||||||
| 100 | # interface for adding/removing issues from a sprint. | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | sub greenhopper_api_url { | ||||||||||||||||||||||||||||
| 103 | my $self = shift; | ||||||||||||||||||||||||||||
| 104 | my $url = $self->jira->rest_api_url_base; | ||||||||||||||||||||||||||||
| 105 | $url =~ s{/rest/api/.+}{/rest/greenhopper/latest}; | ||||||||||||||||||||||||||||
| 106 | return $url; | ||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | sub add_issues { | ||||||||||||||||||||||||||||
| 110 | my $self = shift; | ||||||||||||||||||||||||||||
| 111 | my $url = join '/', q{}, | ||||||||||||||||||||||||||||
| 112 | 'sprint', $self->id, 'issues', 'add'; | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | my $args = { issueKeys => \@_ }; | ||||||||||||||||||||||||||||
| 115 | my $host = $self->jira->{rest}->getHost; | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | $self->jira->{rest}->setHost($self->greenhopper_api_url); | ||||||||||||||||||||||||||||
| 118 | $self->jira->{rest}->PUT($url, undef, $args); | ||||||||||||||||||||||||||||
| 119 | $self->jira->_content; | ||||||||||||||||||||||||||||
| 120 | $self->jira->{rest}->setHost($host); | ||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | sub remove_issues { | ||||||||||||||||||||||||||||
| 124 | my $self = shift; | ||||||||||||||||||||||||||||
| 125 | my $url = join '/', q{}, | ||||||||||||||||||||||||||||
| 126 | 'sprint', $self->id, 'issues', 'remove'; | ||||||||||||||||||||||||||||
| 127 | my $args = { issueKeys => \@_ }; | ||||||||||||||||||||||||||||
| 128 | my $host = $self->jira->{rest}->getHost; | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | $self->jira->{rest}->setHost($self->greenhopper_api_url); | ||||||||||||||||||||||||||||
| 131 | $self->jira->{rest}->PUT($url, undef, $args); | ||||||||||||||||||||||||||||
| 132 | $self->jira->_content; | ||||||||||||||||||||||||||||
| 133 | $self->jira->{rest}->setHost($host); | ||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | Packy Anderson <packy@cpan.org> | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | This software is Copyright (c) 2017 by Packy Anderson. | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | This is free software, licensed under: | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | The Artistic License 2.0 (GPL Compatible) | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | =cut | ||||||||||||||||||||||||||||