| 1 | package JIRA::Client; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: (DEPRECATED) Extended interface to JIRA's SOAP API | ||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | $JIRA::Client::VERSION = '0.45'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Data::Util qw(:check); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use SOAP::Lite; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | my ($class, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | my $args; | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | if (@args == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | $args = shift @args; | |||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | is_hash_ref($args) or croak "$class::new sole argument must be a hash-ref.\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | foreach my $arg (qw/baseurl user password/) { | |||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | exists $args->{$arg} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | or croak "Missing $arg key to $class::new hash argument.\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | $args->{soapargs} = [] unless exists $args->{soapargs}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | } elsif (@args >= 3) { | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | my $baseurl = shift @args; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | my $user = shift @args; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | my $password = shift @args; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | $args = { | |||||||||||||||||||||||||||||||||||||||||
| 30 | baseurl => $baseurl, | ||||||||||||||||||||||||||||||||||||||||||
| 31 | user => $user, | ||||||||||||||||||||||||||||||||||||||||||
| 32 | password => $password, | ||||||||||||||||||||||||||||||||||||||||||
| 33 | soapargs => \@args, | ||||||||||||||||||||||||||||||||||||||||||
| 34 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 35 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | croak "Invalid number of arguments to $class::new.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | $args->{wsdl} = '/rpc/soap/jirasoapservice-v2?wsdl' unless exists $args->{wsdl}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | my $url = $args->{baseurl}; | |||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | $url =~ s{/$}{}; # clean trailing slash | |||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | $url .= $args->{wsdl}; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my $soap = SOAP::Lite->proxy($url, @{$args->{soapargs}}); | |||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | # Make all scalars be encoded as strings by default. | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | $soap->typelookup({default => [0, sub {1}, 'as_string']}); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | my $auth = $soap->login($args->{user}, $args->{password}); | |||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | croak $auth->faultcode(), ', ', $auth->faultstring() | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | if defined $auth->fault(); | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | my $auth_result = $auth->result() | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | or croak "Unknown error while connecting to JIRA. Please, check the URL.\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | my $self = { | |||||||||||||||||||||||||||||||||||||||||
| 58 | soap => $soap, | ||||||||||||||||||||||||||||||||||||||||||
| 59 | auth => $auth_result, | ||||||||||||||||||||||||||||||||||||||||||
| 60 | iter => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 61 | cache => { | ||||||||||||||||||||||||||||||||||||||||||
| 62 | components => {}, # project_key => {name => RemoteComponent} | ||||||||||||||||||||||||||||||||||||||||||
| 63 | versions => {}, # project_key => {name => RemoteVersion} | ||||||||||||||||||||||||||||||||||||||||||
| 64 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 65 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | # This empty DESTROY is necessary because we're using AUTOLOAD. | ||||||||||||||||||||||||||||||||||||||||||
| 71 | # http://www.perlmonks.org/?node_id=93045 | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub DESTROY { } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | # The issue "https://jira.atlassian.com/browse/JRA-12300" explains why | ||||||||||||||||||||||||||||||||||||||||||
| 75 | # some fields in JIRA have nonintuitive names. Here we map them. | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | my %JRA12300 = ( | |||||||||||||||||||||||||||||||||||||||||
| 78 | affectsVersions => 'versions', | ||||||||||||||||||||||||||||||||||||||||||
| 79 | type => 'issuetype', | ||||||||||||||||||||||||||||||||||||||||||
| 80 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 2 | my %JRA12300_backwards = reverse %JRA12300; | |||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | # These are some helper functions to convert names into ids. | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub _convert_type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_convert_type: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my ($self, $type) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | if ($type =~ /\D/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | my $types = $self->get_issue_types(); | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | return $types->{$type}{id} if exists $types->{$type}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $types = $self->get_subtask_issue_types(); | |||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | return $types->{$type}{id} if exists $types->{$type}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | croak "There is no issue type called '$type'.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | return $type; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | sub _convert_priority { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_convert_priority: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my ($self, $prio) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | if ($prio =~ /\D/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my $prios = $self->get_priorities(); | |||||||||||||||||||||||||||||||||||||||||
| 104 | croak "There is no priority called '$prio'.\n" | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | unless exists $prios->{$prio}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | return $prios->{$prio}{id}; | |||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | return $prio; | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub _convert_resolution { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_convert_resolution: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my ($self, $resolution) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | if ($resolution =~ /\D/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | my $resolutions = $self->get_resolutions(); | |||||||||||||||||||||||||||||||||||||||||
| 115 | croak "There is no resolution called '$resolution'.\n" | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | unless exists $resolutions->{$resolution}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | return $resolutions->{$resolution}{id}; | |||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | return $resolution; | |||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | sub _convert_security_level { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_convert_security_level: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my ($self, $seclevel, $project) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | if ($seclevel =~ /\D/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $seclevels = $self->get_security_levels($project); | |||||||||||||||||||||||||||||||||||||||||
| 126 | croak "There is no security level called '$seclevel'.\n" | ||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | unless exists $seclevels->{$seclevel}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | return $seclevels->{$seclevel}{id}; | |||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | return $seclevel; | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | # This routine receives an array with a list of $components specified | ||||||||||||||||||||||||||||||||||||||||||
| 134 | # by RemoteComponent objects, names, and ids. It returns an array of | ||||||||||||||||||||||||||||||||||||||||||
| 135 | # RemoteComponent objects. | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | sub _convert_components { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_convert_components: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my ($self, $components, $project) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | is_array_ref($components) or croak "The 'components' value must be an ARRAY ref.\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my @converted; | |||||||||||||||||||||||||||||||||||||||||
| 141 | my $pcomponents; # project components | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | foreach my $component (@{$components}) { | |||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if (is_instance($component => 'RemoteComponent')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | push @converted, $component; | |||||||||||||||||||||||||||||||||||||||||
| 145 | } elsif (is_integer($component)) { | ||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | push @converted, RemoteComponent->new($component); | |||||||||||||||||||||||||||||||||||||||||
| 147 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 148 | # It's a component name. Let us convert it into its id. | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | croak "Cannot convert component names because I don't know for which project.\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | unless $project; | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | $pcomponents = $self->get_components($project) unless defined $pcomponents; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | croak "There is no component called '$component'.\n" | ||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | unless exists $pcomponents->{$component}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | push @converted, RemoteComponent->new($pcomponents->{$component}{id}); | |||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | return \@converted; | |||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | # This routine receives an array with a list of $versions specified by | ||||||||||||||||||||||||||||||||||||||||||
| 161 | # RemoteVersion objects, names, and ids. It returns an array of | ||||||||||||||||||||||||||||||||||||||||||
| 162 | # RemoteVersion objects. | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | sub _convert_versions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_convert_versions: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | my ($self, $versions, $project) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | is_array_ref($versions) or croak "The '$versions' value must be an ARRAY ref.\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | my @converted; | |||||||||||||||||||||||||||||||||||||||||
| 168 | my $pversions; # project versions | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | foreach my $version (@{$versions}) { | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | if (is_instance($version => 'RemoteVersion')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | push @converted, $version; | |||||||||||||||||||||||||||||||||||||||||
| 172 | } elsif (is_integer($version)) { | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | push @converted, RemoteVersion->new($version); | |||||||||||||||||||||||||||||||||||||||||
| 174 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 175 | # It is a version name. Let us convert it into its id. | ||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | croak "Cannot convert version names because I don't know for which project.\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | unless $project; | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | $pversions = $self->get_versions($project) unless defined $pversions; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | croak "There is no version called '$version'.\n" | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | unless exists $pversions->{$version}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | push @converted, RemoteVersion->new($pversions->{$version}{id}); | |||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | return \@converted; | |||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | # This routine returns a duedate as a SOAP::Data object with type | ||||||||||||||||||||||||||||||||||||||||||
| 188 | # 'date'. It can generate this from a DateTime object or from a string | ||||||||||||||||||||||||||||||||||||||||||
| 189 | # in the format YYYY-MM-DD. | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | sub _convert_duedate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_convert_duedate: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | my ($self, $duedate) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if (is_instance($duedate => 'DateTime')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | return SOAP::Data->type(date => $duedate->strftime('%F')); | |||||||||||||||||||||||||||||||||||||||||
| 195 | } elsif (is_string($duedate)) { | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if (my ($year, $month, $day) = ($duedate =~ /^(\d{4})-(\d{2})-(\d{2})/)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | $month >= 1 and $month <= 12 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$month >= 1 and $month <= 12
MC/DC0%0/2
$month >= 1 and $month <= 12
$month >= 1
$month <= 12
Truth table0%0/3
A and B
A= $month >= 1B= $month <= 12
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | or croak "Invalid duedate ($duedate).\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | return SOAP::Data->type(date => $duedate); | |||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | return $duedate; | |||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | # This routine receives a hash mapping custom field's ids to | ||||||||||||||||||||||||||||||||||||||||||
| 206 | # values. The ids can be specified by their real id or by their id's | ||||||||||||||||||||||||||||||||||||||||||
| 207 | # numeric suffix (as the 1000 in 'customfield_1000'). Scalar values | ||||||||||||||||||||||||||||||||||||||||||
| 208 | # are substituted by references to arrays containing the original | ||||||||||||||||||||||||||||||||||||||||||
| 209 | # value. The routine returns a hash-ref to another hash with converted | ||||||||||||||||||||||||||||||||||||||||||
| 210 | # keys and values. | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | sub _convert_custom_fields { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_convert_custom_fields: not called CC=12 SCAR=50.5
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | my ($self, $custom_fields) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | is_hash_ref($custom_fields) or croak "The 'custom_fields' value must be a HASH ref.\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | my %converted; | |||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | while (my ($id, $values) = each %$custom_fields) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my $realid = $id; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | unless ($realid =~ /^customfield_\d+$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | my $cfs = $self->get_custom_fields(); | |||||||||||||||||||||||||||||||||||||||||
| 220 | croak "Can't find custom field named '$id'.\n" | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | unless exists $cfs->{$id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $realid = $cfs->{$id}{id}; | |||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | # Custom field values must be specified as ARRAYs but we allow for some short-cuts. | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | if (is_value($values)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $converted{$realid} = [$values]; | |||||||||||||||||||||||||||||||||||||||||
| 228 | } elsif (is_array_ref($values)) { | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $converted{$realid} = $values; | |||||||||||||||||||||||||||||||||||||||||
| 230 | } elsif (is_hash_ref($values)) { | ||||||||||||||||||||||||||||||||||||||||||
| 231 | # This is a short-cut for a Cascading select field, which | ||||||||||||||||||||||||||||||||||||||||||
| 232 | # must be specified like this: http://tinyurl.com/2bmthoa | ||||||||||||||||||||||||||||||||||||||||||
| 233 | # The short-cut requires a HASH where each cascading level | ||||||||||||||||||||||||||||||||||||||||||
| 234 | # is indexed by its level number, starting at zero. | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | foreach my $level (sort {$a <=> $b} keys %$values) { | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my $level_values = $values->{$level}; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | $level_values = [$level_values] unless ref $level_values; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | if ($level eq '0') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | # The first level doesn't have a colon | ||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $converted{$realid} = $level_values | |||||||||||||||||||||||||||||||||||||||||
| 241 | } elsif ($level =~ /^\d+$/) { | ||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $converted{"$realid:$level"} = $level_values; | |||||||||||||||||||||||||||||||||||||||||
| 243 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | croak "Invalid cascading field values level spec ($level). It must be a natural number.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | croak "Custom field '$id' got a '", ref($values), "' reference as a value.\nValues can only be specified as scalars, ARRAYs, or HASHes though.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | return \%converted; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 2 | my %_converters = ( | |||||||||||||||||||||||||||||||||||||||||
| 255 | affectsVersions => \&_convert_versions, | ||||||||||||||||||||||||||||||||||||||||||
| 256 | components => \&_convert_components, | ||||||||||||||||||||||||||||||||||||||||||
| 257 | custom_fields => \&_convert_custom_fields, | ||||||||||||||||||||||||||||||||||||||||||
| 258 | duedate => \&_convert_duedate, | ||||||||||||||||||||||||||||||||||||||||||
| 259 | fixVersions => \&_convert_versions, | ||||||||||||||||||||||||||||||||||||||||||
| 260 | priority => \&_convert_priority, | ||||||||||||||||||||||||||||||||||||||||||
| 261 | resolution => \&_convert_resolution, | ||||||||||||||||||||||||||||||||||||||||||
| 262 | type => \&_convert_type, | ||||||||||||||||||||||||||||||||||||||||||
| 263 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | # Accept both names for fields with duplicate names. | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 2 | foreach my $field (keys %JRA12300) { | |||||||||||||||||||||||||||||||||||||||||
| 267 | 4 | $_converters{$JRA12300{$field}} = $_converters{$field}; | |||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | # This routine applies all the previous conversions to the $params | ||||||||||||||||||||||||||||||||||||||||||
| 271 | # hash. It returns a reference another hash with converted keys and | ||||||||||||||||||||||||||||||||||||||||||
| 272 | # values, which is the base for invoking the methods createIssue, | ||||||||||||||||||||||||||||||||||||||||||
| 273 | # UpdateIssue, and progressWorkflowAction. | ||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | sub _convert_params { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_convert_params: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my ($self, $params, $project) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | my %converted; | |||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | # Convert fields' values | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | while (my ($field, $value) = each %$params) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | $converted{$field} = | ||||||||||||||||||||||||||||||||||||||||||
| 283 | exists $_converters{$field} | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | ? $_converters{$field}->($self, $value, $project) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | : $value; | ||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | return \%converted; | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | # This routine gets a hash produced by _convert_params and flatens in | ||||||||||||||||||||||||||||||||||||||||||
| 292 | # place its Component, Version, and custom_fields fields. It also | ||||||||||||||||||||||||||||||||||||||||||
| 293 | # converts the hash's key according with the %JRA12300 table. It goes | ||||||||||||||||||||||||||||||||||||||||||
| 294 | # a step further before invoking the methods UpdateIssue and | ||||||||||||||||||||||||||||||||||||||||||
| 295 | # progressWorkflowAction. | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | sub _flaten_components_and_versions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flaten_components_and_versions: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | my ($params) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | # Flaten Component and Version fields | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | for my $field (grep {exists $params->{$_}} qw/components affectsVersions fixVersions/) { | |||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | $params->{$field} = [map {$_->{id}} @{$params->{$field}}]; | |||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | # Flaten the customFieldValues field | ||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | if (my $custom_fields = delete $params->{custom_fields}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | while (my ($id, $values) = each %$custom_fields) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | $params->{$id} = $values; | |||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | # Due to a bug in JIRA we have to substitute the names of some fields. | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | foreach my $field (grep {exists $params->{$_}} keys %JRA12300) { | |||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | $params->{$JRA12300{$field}} = delete $params->{$field}; | |||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | sub create_issue | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_issue: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | my ($self, $params, $seclevel) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | is_hash_ref($params) or croak "create_issue's requires a HASH-ref argument.\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | for my $field (qw/project summary type/) { | |||||||||||||||||||||||||||||||||||||||||
| 326 | croak "create_issue's HASH ref must define a '$field'.\n" | ||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | unless exists $params->{$field}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | $params = $self->_convert_params($params, $params->{project}); | |||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | # Substitute customFieldValues array for custom_fields hash | ||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | if (my $cfs = delete $params->{custom_fields}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | $params->{customFieldValues} = [map {RemoteCustomFieldValue->new($_, $cfs->{$_})} keys %$cfs]; | |||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | if (my $parent = delete $params->{parent}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | if (defined $seclevel) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | return $self->createIssueWithParentWithSecurityLevel($params, $parent, _convert_security_level($self, $seclevel, $params->{project})); | |||||||||||||||||||||||||||||||||||||||||
| 340 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | return $self->createIssueWithParent($params, $parent); | |||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | if (defined $seclevel) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | return $self->createIssueWithSecurityLevel($params, _convert_security_level($self, $seclevel, $params->{project})); | |||||||||||||||||||||||||||||||||||||||||
| 346 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | return $self->createIssue($params); | |||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | sub update_issue | ||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_issue: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | my ($self, $issue, $params) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my $key; | |||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | ▶ | if (is_instance($issue => 'RemoteIssue')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | $key = $issue->{key}; | |||||||||||||||||||||||||||||||||||||||||
| 359 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $key = $issue; | |||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | $issue = $self->getIssue($key); | |||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | is_hash_ref($params) or croak "update_issue second argument must be a HASH ref.\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | my ($project) = ($key =~ /^([^-]+)/); | |||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | $params = $self->_convert_params($params, $project); | |||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | _flaten_components_and_versions($params); | |||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | return $self->updateIssue($key, $params); | |||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | sub get_issue_types { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_issue_types: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | $self->{cache}{issue_types} ||= {map {$_->{name} => $_} @{$self->getIssueTypes()}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"cache"}{"issue_types"} ||= {map({$_->{"name"}, $_;} @{$self->getIssueTypes;})}
MC/DC0%0/1
$self->{"cache"}{"issue_types"} ||= {map({$_->{"name"}, $_;} @{$self->getIssueTypes;})}
$self->{"cache"}{"issue_types"}
Truth table0%0/2
A
A= $self->{"cache"}{"issue_types"}
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | return $self->{cache}{issue_types}; | |||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | sub get_subtask_issue_types { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_subtask_issue_types: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | ▶ | $self->{cache}{subtask_issue_types} ||= {map {$_->{name} => $_} @{$self->getSubTaskIssueTypes()}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"cache"}{"subtask_issue_types"} ||= {map({$_->{"name"}, $_;} @{$self->getSubTaskIssueTypes;})}
MC/DC0%0/1
$self->{"cache"}{"subtask_issue_types"} ||= {map({$_->{"name"}, $_;} @{$self->getSubTaskIssueTypes;})}
$self->{"cache"}{"subtask_issue_types"}
Truth table0%0/2
A
A= $self->{"cache"}{"subtask_issue_types"}
| |||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | return $self->{cache}{subtask_issue_types}; | |||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | ▶ | sub get_statuses { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_statuses: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | $self->{cache}{statuses} ||= {map {$_->{name} => $_} @{$self->getStatuses()}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"cache"}{"statuses"} ||= {map({$_->{"name"}, $_;} @{$self->getStatuses;})}
MC/DC0%0/1
$self->{"cache"}{"statuses"} ||= {map({$_->{"name"}, $_;} @{$self->getStatuses;})}
$self->{"cache"}{"statuses"}
Truth table0%0/2
A
A= $self->{"cache"}{"statuses"}
| |||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | return $self->{cache}{statuses}; | |||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | sub get_priorities { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_priorities: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | $self->{cache}{priorities} ||= {map {$_->{name} => $_} @{$self->getPriorities()}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"cache"}{"priorities"} ||= {map({$_->{"name"}, $_;} @{$self->getPriorities;})}
MC/DC0%0/1
$self->{"cache"}{"priorities"} ||= {map({$_->{"name"}, $_;} @{$self->getPriorities;})}
$self->{"cache"}{"priorities"}
Truth table0%0/2
A
A= $self->{"cache"}{"priorities"}
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | return $self->{cache}{priorities}; | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | sub get_resolutions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_resolutions: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | $self->{cache}{resolutions} ||= {map {$_->{name} => $_} @{$self->getResolutions()}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"cache"}{"resolutions"} ||= {map({$_->{"name"}, $_;} @{$self->getResolutions;})}
MC/DC0%0/1
$self->{"cache"}{"resolutions"} ||= {map({$_->{"name"}, $_;} @{$self->getResolutions;})}
$self->{"cache"}{"resolutions"}
Truth table0%0/2
A
A= $self->{"cache"}{"resolutions"}
| |||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | return $self->{cache}{resolutions}; | |||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | sub get_security_levels { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_security_levels: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | my ($self, $project_key) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | $self->{cache}{seclevels}{$project_key} ||= {map {$_->{name} => $_} @{$self->getSecurityLevels($project_key)}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"cache"}{"seclevels"}{$project_key} ||= {map({$_->{"name"}, $_;} @{$self->getSecurityLevels($project_key);})}
MC/DC0%0/1
$self->{"cache"}{"seclevels"}{$project_key} ||= {map({$_->{"name"}, $_;} @{$self->getSecurityLevels($project_key);})}
$self->{"cache"}{"seclevels"}{$project_key}
Truth table0%0/2
A
A= $self->{"cache"}{"seclevels"}{$project_key}
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | return $self->{cache}{seclevels}{$project_key}; | |||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | sub get_custom_fields { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_custom_fields: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | $self->{cache}{custom_fields} ||= {map {$_->{name} => $_} @{$self->getCustomFields()}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"cache"}{"custom_fields"} ||= {map({$_->{"name"}, $_;} @{$self->getCustomFields;})}
MC/DC0%0/1
$self->{"cache"}{"custom_fields"} ||= {map({$_->{"name"}, $_;} @{$self->getCustomFields;})}
$self->{"cache"}{"custom_fields"}
Truth table0%0/2
A
A= $self->{"cache"}{"custom_fields"}
| |||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | return $self->{cache}{custom_fields}; | |||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | sub set_custom_fields { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_custom_fields: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | my ($self, $cfs) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | $self->{cache}{custom_fields} = $cfs; | |||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | sub get_components { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_components: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my ($self, $project_key) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | $self->{cache}{components}{$project_key} ||= {map {$_->{name} => $_} @{$self->getComponents($project_key)}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"cache"}{"components"}{$project_key} ||= {map({$_->{"name"}, $_;} @{$self->getComponents($project_key);})}
MC/DC0%0/1
$self->{"cache"}{"components"}{$project_key} ||= {map({$_->{"name"}, $_;} @{$self->getComponents($project_key);})}
$self->{"cache"}{"components"}{$project_key}
Truth table0%0/2
A
A= $self->{"cache"}{"components"}{$project_key}
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | return $self->{cache}{components}{$project_key}; | |||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | sub get_versions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_versions: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | my ($self, $project_key) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | $self->{cache}{versions}{$project_key} ||= {map {$_->{name} => $_} @{$self->getVersions($project_key)}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"cache"}{"versions"}{$project_key} ||= {map({$_->{"name"}, $_;} @{$self->getVersions($project_key);})}
MC/DC0%0/1
$self->{"cache"}{"versions"}{$project_key} ||= {map({$_->{"name"}, $_;} @{$self->getVersions($project_key);})}
$self->{"cache"}{"versions"}{$project_key}
Truth table0%0/2
A
A= $self->{"cache"}{"versions"}{$project_key}
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | return $self->{cache}{versions}{$project_key}; | |||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | sub get_favourite_filters { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_favourite_filters: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | $self->{cache}{filters} ||= {map {$_->{name} => $_} @{$self->getFavouriteFilters()}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"cache"}{"filters"} ||= {map({$_->{"name"}, $_;} @{$self->getFavouriteFilters;})}
MC/DC0%0/1
$self->{"cache"}{"filters"} ||= {map({$_->{"name"}, $_;} @{$self->getFavouriteFilters;})}
$self->{"cache"}{"filters"}
Truth table0%0/2
A
A= $self->{"cache"}{"filters"}
| |||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | return $self->{cache}{filters}; | |||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | ▶ | sub set_filter_iterator { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_filter_iterator: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | my ($self, $filter, $cache_size) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | if ($filter =~ /\D/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | my $filters = $self->getSavedFilters(); | |||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | foreach my $f (@$filters) { | |||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | if ($f->{name} eq $filter) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | $filter = $f->{id}; | |||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | ▶ | croak "Can't find filter '$filter'\n" if $filter =~ /\D/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | if ($cache_size) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | croak "set_filter_iterator's second arg must be a number ($cache_size).\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | if $cache_size =~ /\D/; | ||||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | $self->{iter} = { | ||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | id => $filter, | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$cache_size || 128
MC/DC0%0/1
$cache_size || 128
$cache_size
Truth table0%0/2
A
A= $cache_size
| |||||||||||||||||||||||||||||||||||||||||||
| 474 | offset => 0, # offset to be used in the next call to getIssuesFromFilterWithLimit | ||||||||||||||||||||||||||||||||||||||||||
| 475 | issues => [], # issues returned by the last call to getIssuesFromFilterWithLimit | ||||||||||||||||||||||||||||||||||||||||||
| 476 | size => $cache_size || 128, | ||||||||||||||||||||||||||||||||||||||||||
| 477 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | sub next_issue { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_issue: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 485 | defined $self->{iter} | ||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | or croak "You must call setFilterIterator before calling nextIssue\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | my $iter = $self->{iter}; | |||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | if (@{$iter->{issues}} == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | ▶ | if ($iter->{id}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | my $issues = eval {$self->getIssuesFromFilterWithLimit($iter->{id}, $iter->{offset}, $iter->{size})}; | |||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 492 | # The getIssuesFromFilterWithLimit appeared in JIRA | ||||||||||||||||||||||||||||||||||||||||||
| 493 | # 3.13.4. Before that we had to use the unsafe | ||||||||||||||||||||||||||||||||||||||||||
| 494 | # getIssuesFromFilter. Here we detect that we're talking | ||||||||||||||||||||||||||||||||||||||||||
| 495 | # with an old JIRA and resort to the deprecated method | ||||||||||||||||||||||||||||||||||||||||||
| 496 | # instead. | ||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | ▶ | croak $@ unless $@ =~ /No such operation/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $iter->{issues} = $self->getIssuesFromFilter($iter->{id}); | |||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | $iter->{id} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||
| 501 | elsif (@$issues) { | ||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | $iter->{offset} += @$issues; | |||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | $iter->{issues} = $issues; | |||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||
| 505 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | $self->{iter} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||
| 510 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | return shift @{$iter->{issues}}; | |||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | sub progress_workflow_action_safely { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
progress_workflow_action_safely: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | my ($self, $issue, $action, $params) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | my $key; | |||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | if (is_instance($issue => 'RemoteIssue')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | $key = $issue->{key}; | |||||||||||||||||||||||||||||||||||||||||
| 523 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | $key = $issue; | |||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | $issue = undef; | |||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | ▶ | $params = {} unless defined $params; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | is_hash_ref($params) or croak "progress_workflow_action_safely's third arg must be a HASH-ref\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | # Grok the action id if it's not a number | ||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | ▶ | if ($action =~ /\D/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | my @available_actions = @{$self->getAvailableActions($key)}; | |||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | my @named_actions = grep {$action eq $_->{name}} @available_actions; | |||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | if (@named_actions) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | $action = $named_actions[0]->{id}; | |||||||||||||||||||||||||||||||||||||||||
| 536 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | croak "Unavailable action ($action).\n"; | |||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||
| 541 | # Make sure $params contains all the fields that are present in | ||||||||||||||||||||||||||||||||||||||||||
| 542 | # the action screen. | ||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | my @fields = @{$self->getFieldsForAction($key, $action)}; | |||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | foreach my $id (map {$_->{id}} @fields) { | |||||||||||||||||||||||||||||||||||||||||
| 545 | # Due to a bug in JIRA we have to substitute the names of some fields. | ||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | ▶ | $id = $JRA12300_backwards{$id} if $JRA12300_backwards{$id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | next if exists $params->{$id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | ▶ | $issue = $self->getIssue($key) unless defined $issue; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | if (exists $issue->{$id}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | ▶ | $params->{$id} = $issue->{$id} if defined $issue->{$id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||
| 554 | # NOTE: It's not a problem if we can't find a missing | ||||||||||||||||||||||||||||||||||||||||||
| 555 | # parameter in the issue. It will simply stay undefined. | ||||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | my ($project) = ($key =~ /^([^-]+)/); | |||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | $params = $self->_convert_params($params, $project); | |||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | _flaten_components_and_versions($params); | |||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | return $self->progressWorkflowAction($key, $action, $params); | |||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | ▶ | sub get_issue_custom_field_values { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_issue_custom_field_values: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | my ($self, $issue, @cfs) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | my @values; | |||||||||||||||||||||||||||||||||||||||||
| 571 | my $cfs; | ||||||||||||||||||||||||||||||||||||||||||
| 572 | CUSTOM_FIELD: | ||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | foreach my $cf (@cfs) { | |||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | ▶ | unless ($cf =~ /^customfield_\d+$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | ▶ | $cfs = $self->get_custom_fields() unless defined $cfs; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 576 | croak "Can't find custom field named '$cf'.\n" | ||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | unless exists $cfs->{$cf}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | $cf = $cfs->{$cf}{id}; | |||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | foreach my $rcfv (@{$issue->{customFieldValues}}) { | |||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | ▶ | if ($rcfv->{customfieldId} eq $cf) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | push @values, $rcfv->{values}; | |||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | next CUSTOM_FIELD; | |||||||||||||||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | push @values, undef; # unset custom field | |||||||||||||||||||||||||||||||||||||||||
| 587 | } | ||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | ▶ | return wantarray ? @values : \@values; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | ▶ | sub attach_files_to_issue { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attach_files_to_issue: not called CC=15 SCAR=54.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | my ($self, $issue, @files) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||
| 595 | # First we process the @files specification. Filenames are pushed | ||||||||||||||||||||||||||||||||||||||||||
| 596 | # in @filenames and @attachments will end up with IO objects from | ||||||||||||||||||||||||||||||||||||||||||
| 597 | # which the file contents are going to be read later. | ||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | my (@filenames, @attachments); | |||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | for my $file (@files) { | |||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | ▶ | if (is_string($file)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | require File::Basename; | |||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | push @filenames, File::Basename::basename($file); | |||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | ▶ | open my $fh, '<:raw', $file | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 606 | or croak "Can't open $file: $!\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | push @attachments, $fh; | |||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||
| 609 | } elsif (is_hash_ref($file)) { | ||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | ▶ | while (my ($name, $contents) = each %$file) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | push @filenames, $name; | |||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | ▶ | if (is_string($contents)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | ▶ | open my $fh, '<:raw', $contents | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 614 | or croak "Can't open $contents: $!\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | push @attachments, $fh; | |||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||
| 617 | ▶ | } elsif (is_glob_ref($contents) | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
is_glob_ref($contents) or is_instance($contents, "IO::File") or is_instance($contents, "FileHandle")
is_glob_ref($contents) or is_instance($contents, "IO::File")
MC/DC0%0/3
is_glob_ref($contents) or is_instance($contents, "IO::File") or is_instance($contents, "FileHandle")
is_glob_ref($contents)
is_instance($contents, "IO::File")
is_instance($contents, "FileHandle")
Truth table0%0/4
A or B or C
A= is_glob_ref($contents)B= is_instance($contents, "IO::File")C= is_instance($contents, "FileHandle")
| |||||||||||||||||||||||||||||||||||||||||||
| 618 | || is_instance($contents => 'IO::File') | ||||||||||||||||||||||||||||||||||||||||||
| 619 | || is_instance($contents => 'FileHandle')) { | ||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | push @attachments, $contents; | |||||||||||||||||||||||||||||||||||||||||
| 621 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | croak "Invalid content specification for file $name.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||
| 625 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | croak "Files must be specified by STRINGs or HASHes, not by " . ref($file) . "s\n"; | |||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||
| 630 | # Now we have to read all file contents and encode them to Base64. | ||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | require MIME::Base64; | |||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | for my $i (0 .. $#attachments) { | |||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | my $fh = $attachments[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | my $attachment = ''; | |||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | my $chars_read; | |||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | ▶ | while ($chars_read = read $fh, my $buf, 57*72) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | $attachment .= MIME::Base64::encode_base64($buf); | |||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | ▶ | defined $chars_read | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 641 | or croak "Error reading '$filenames[$i]': $!\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | ▶ | length $attachment | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 643 | or croak "Can't attach empty file '$filenames[$i]'\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | $attachments[$i] = $attachment; | |||||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | return $self->addBase64EncodedAttachmentsToIssue($issue, \@filenames, \@attachments); | |||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | ▶ | sub attach_strings_to_issue { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attach_strings_to_issue: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | my ($self, $issue, $hash) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | require MIME::Base64; | |||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | my (@filenames, @attachments); | |||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | ▶ | while (my ($filename, $contents) = each %$hash) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | push @filenames, $filename; | |||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | push @attachments, MIME::Base64::encode_base64($contents); | |||||||||||||||||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | return $self->addBase64EncodedAttachmentsToIssue($issue, \@filenames, \@attachments); | |||||||||||||||||||||||||||||||||||||||||
| 664 | } | ||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | ▶ | sub filter_issues_unsorted { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
filter_issues_unsorted: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | my ($self, $filter, $limit) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | $filter =~ s/^\s*"?//; | |||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | $filter =~ s/"?\s*$//; | |||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | ▶ | if ($filter =~ /^(?:[A-Z]+-\d+\s+)*[A-Z]+-\d+$/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 674 | # space separated key list | ||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||
| 676 | # Let's construct a JQL query in the form "issuekey IN (...)" to | ||||||||||||||||||||||||||||||||||||||||||
| 677 | # pass to getIssuesFromJqlSearch. | ||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | my %keys = map {($_ => undef)} split / /, $filter; # discard duplicates | |||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | my @keys = keys %keys; | |||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||
| 682 | # If the list is too big we split it up and invoke | ||||||||||||||||||||||||||||||||||||||||||
| 683 | # getIssuesFromJqlSearch several times. | ||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | my @issues; | |||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | ▶ | while (my @subkeys = splice(@keys, 0, 128)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | my $jql = 'issuekey IN (' . join(',', @subkeys) . ')'; | |||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | push @issues, @{$self->getIssuesFromJqlSearch($jql, 1000)}; | |||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | return @issues; | |||||||||||||||||||||||||||||||||||||||||
| 690 | } elsif ($filter =~ /^[\w-]+$/i) { | ||||||||||||||||||||||||||||||||||||||||||
| 691 | # saved filter | ||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | ▶ | return @{$self->getIssuesFromFilterWithLimit($filter, 0, $limit || 1000)}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$limit || 1000
MC/DC0%0/1
$limit || 1000
$limit
Truth table0%0/2
A
A= $limit
| |||||||||||||||||||||||||||||||||||||||||||
| 693 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 694 | # JQL filter | ||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | ▶ | return @{$self->getIssuesFromJqlSearch($filter, $limit || 1000)}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$limit || 1000
MC/DC0%0/1
$limit || 1000
$limit
Truth table0%0/2
A
A= $limit
| |||||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||
| 697 | } | ||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | ▶ | sub filter_issues { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
filter_issues: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | my ($self, $filter, $limit) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||
| 703 | # Order the issues by project key and then by numeric value using | ||||||||||||||||||||||||||||||||||||||||||
| 704 | # a Schwartzian transform. | ||||||||||||||||||||||||||||||||||||||||||
| 705 | return | ||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | map {$_->[2]} | |||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | ▶ | sort {$a->[0] cmp $b->[0] or $a->[1] <=> $b->[1]} | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$JIRA::Client::a->[0] cmp $JIRA::Client::b->[0] || $JIRA::Client::a->[1] <=> $JIRA::Client::b->[1]
MC/DC0%0/2
$JIRA::Client::a->[0] cmp $JIRA::Client::b->[0] || $JIRA::Client::a->[1] <=> $JIRA::Client::b->[1]
$JIRA::Client::a->[0] cmp $JIRA::Client::b->[0]
$JIRA::Client::a->[1] <=> $JIRA::Client::b->[1]
Truth table0%0/3
A || B
A= $JIRA::Client::a->[0] cmp $JIRA::Client::b->[0]B= $JIRA::Client::a->[1] <=> $JIRA::Client::b->[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | map {my ($p, $n) = ($_->{key} =~ /([A-Z]+)-(\d+)/); [$p, $n, $_]} | |||||||||||||||||||||||||||||||||||||||||
| 709 | filter_issues_unsorted($self, $filter, $limit); | ||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||
| 713 | ## no critic (Modules::ProhibitMultiplePackages) | ||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||
| 715 | package RemoteFieldValue; | ||||||||||||||||||||||||||||||||||||||||||
| 716 | 2 | $RemoteFieldValue::VERSION = '0.45'; | |||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | my ($class, $id, $values) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||
| 720 | # Due to a bug in JIRA we have to substitute the names of some fields. | ||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | ▶ | $id = $JRA12300{$id} if exists $JRA12300{$id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | ▶ | $values = [$values] unless ref $values; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | return bless({id => $id, values => $values}, $class); | |||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||
| 728 | package RemoteCustomFieldValue; | ||||||||||||||||||||||||||||||||||||||||||
| 729 | 2 | $RemoteCustomFieldValue::VERSION = '0.45'; | |||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | my ($class, $id, $values) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | ▶ | $values = [$values] unless ref $values; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | return bless({customfieldId => $id, key => undef, values => $values} => $class); | |||||||||||||||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||
| 738 | package RemoteComponent; | ||||||||||||||||||||||||||||||||||||||||||
| 739 | 2 | $RemoteComponent::VERSION = '0.45'; | |||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | my ($class, $id, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | my $o = bless({id => $id}, $class); | |||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | ▶ | $o->{name} = $name if $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | return $o; | |||||||||||||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||
| 748 | package RemoteVersion; | ||||||||||||||||||||||||||||||||||||||||||
| 749 | 2 | $RemoteVersion::VERSION = '0.45'; | |||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | my ($class, $id, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | my $o = bless({id => $id}, $class); | |||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | ▶ | $o->{name} = $name if $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | return $o; | |||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||
| 757 | package JIRA::Client; | ||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||
| 759 | # Almost all of the JIRA API parameters are strings. The %typeof hash | ||||||||||||||||||||||||||||||||||||||||||
| 760 | # specifies the exceptions. It maps a method name to a hash mapping a | ||||||||||||||||||||||||||||||||||||||||||
| 761 | # parameter position to its type. (The parameter position is | ||||||||||||||||||||||||||||||||||||||||||
| 762 | # zero-based, after the authentication token. | ||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||
| 764 | 2 | my %typeof = ( | |||||||||||||||||||||||||||||||||||||||||
| 765 | addActorsToProjectRole => {1 => \&_cast_remote_project_role}, | ||||||||||||||||||||||||||||||||||||||||||
| 766 | addAttachmentsToIssue => \&_cast_attachments, | ||||||||||||||||||||||||||||||||||||||||||
| 767 | addBase64EncodedAttachmentsToIssue => \&_cast_base64encodedattachments, | ||||||||||||||||||||||||||||||||||||||||||
| 768 | addComment => {0 => \&_cast_issue_key, 1 => \&_cast_remote_comment}, | ||||||||||||||||||||||||||||||||||||||||||
| 769 | addDefaultActorsToProjectRole => {1 => \&_cast_remote_project_role}, | ||||||||||||||||||||||||||||||||||||||||||
| 770 | # addPermissionTo | ||||||||||||||||||||||||||||||||||||||||||
| 771 | # addUserToGroup | ||||||||||||||||||||||||||||||||||||||||||
| 772 | # addVersion | ||||||||||||||||||||||||||||||||||||||||||
| 773 | addWorklogAndAutoAdjustRemainingEstimate => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 774 | addWorklogAndRetainRemainingEstimate => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 775 | addWorklogWithNewRemainingEstimate => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 776 | archiveVersion => {2 => 'boolean'}, | ||||||||||||||||||||||||||||||||||||||||||
| 777 | # createGroup | ||||||||||||||||||||||||||||||||||||||||||
| 778 | # createIssue | ||||||||||||||||||||||||||||||||||||||||||
| 779 | createIssueWithParent => {1 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 780 | createIssueWithParentWithSecurityLevel => {1 => \&_cast_issue_key, 2 => 'long'}, | ||||||||||||||||||||||||||||||||||||||||||
| 781 | createIssueWithSecurityLevel => {1 => 'long'}, | ||||||||||||||||||||||||||||||||||||||||||
| 782 | # createPermissionScheme | ||||||||||||||||||||||||||||||||||||||||||
| 783 | # createProject | ||||||||||||||||||||||||||||||||||||||||||
| 784 | # createProjectFromObject | ||||||||||||||||||||||||||||||||||||||||||
| 785 | createProjectRole => {0 => \&_cast_remote_project_role}, | ||||||||||||||||||||||||||||||||||||||||||
| 786 | # createUser | ||||||||||||||||||||||||||||||||||||||||||
| 787 | # deleteGroup | ||||||||||||||||||||||||||||||||||||||||||
| 788 | deleteIssue => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 789 | # deletePermissionFrom | ||||||||||||||||||||||||||||||||||||||||||
| 790 | # deletePermissionScheme | ||||||||||||||||||||||||||||||||||||||||||
| 791 | # deleteProject | ||||||||||||||||||||||||||||||||||||||||||
| 792 | deleteProjectAvatar => {0 => 'long'}, | ||||||||||||||||||||||||||||||||||||||||||
| 793 | deleteProjectRole => {0 => \&_cast_remote_project_role, 1 => 'boolean'}, | ||||||||||||||||||||||||||||||||||||||||||
| 794 | # deleteUser | ||||||||||||||||||||||||||||||||||||||||||
| 795 | # deleteWorklogAndAutoAdjustRemainingEstimate | ||||||||||||||||||||||||||||||||||||||||||
| 796 | # deleteWorklogAndRetainRemainingEstimate | ||||||||||||||||||||||||||||||||||||||||||
| 797 | # deleteWorklogWithNewRemainingEstimate | ||||||||||||||||||||||||||||||||||||||||||
| 798 | # editComment | ||||||||||||||||||||||||||||||||||||||||||
| 799 | # getAllPermissions | ||||||||||||||||||||||||||||||||||||||||||
| 800 | getAssociatedNotificationSchemes => {0 => \&_cast_remote_project_role}, | ||||||||||||||||||||||||||||||||||||||||||
| 801 | getAssociatedPermissionSchemes => {0 => \&_cast_remote_project_role}, | ||||||||||||||||||||||||||||||||||||||||||
| 802 | getAttachmentsFromIssue => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 803 | getAvailableActions => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 804 | getComment => {0 => 'long'}, | ||||||||||||||||||||||||||||||||||||||||||
| 805 | getComments => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 806 | # getComponents | ||||||||||||||||||||||||||||||||||||||||||
| 807 | # getConfiguration | ||||||||||||||||||||||||||||||||||||||||||
| 808 | # getCustomFields | ||||||||||||||||||||||||||||||||||||||||||
| 809 | getDefaultRoleActors => {0 => \&_cast_remote_project_role}, | ||||||||||||||||||||||||||||||||||||||||||
| 810 | # getFavouriteFilters | ||||||||||||||||||||||||||||||||||||||||||
| 811 | getFieldsForAction => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 812 | getFieldsForCreate => {1 => 'long'}, | ||||||||||||||||||||||||||||||||||||||||||
| 813 | getFieldsForEdit => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 814 | # getGroup | ||||||||||||||||||||||||||||||||||||||||||
| 815 | getIssue => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 816 | # getIssueById | ||||||||||||||||||||||||||||||||||||||||||
| 817 | getIssueCountForFilter => {0 => \&_cast_filter_name_to_id}, | ||||||||||||||||||||||||||||||||||||||||||
| 818 | getIssuesFromFilter => {0 => \&_cast_filter_name_to_id}, | ||||||||||||||||||||||||||||||||||||||||||
| 819 | getIssuesFromFilterWithLimit => {0 => \&_cast_filter_name_to_id, 1 => 'int', 2 => 'int'}, | ||||||||||||||||||||||||||||||||||||||||||
| 820 | getIssuesFromJqlSearch => {1 => 'int'}, | ||||||||||||||||||||||||||||||||||||||||||
| 821 | # getIssuesFromTextSearch | ||||||||||||||||||||||||||||||||||||||||||
| 822 | getIssuesFromTextSearchWithLimit => {1 => 'int', 2 => 'int'}, | ||||||||||||||||||||||||||||||||||||||||||
| 823 | getIssuesFromTextSearchWithProject => {2 => 'int'}, | ||||||||||||||||||||||||||||||||||||||||||
| 824 | # getIssueTypes | ||||||||||||||||||||||||||||||||||||||||||
| 825 | # getIssueTypesForProject | ||||||||||||||||||||||||||||||||||||||||||
| 826 | # getNotificationSchemes | ||||||||||||||||||||||||||||||||||||||||||
| 827 | # getPermissionSchemes | ||||||||||||||||||||||||||||||||||||||||||
| 828 | # getPriorities | ||||||||||||||||||||||||||||||||||||||||||
| 829 | # getProjectAvatar | ||||||||||||||||||||||||||||||||||||||||||
| 830 | getProjectAvatars => {1 => 'boolean'}, | ||||||||||||||||||||||||||||||||||||||||||
| 831 | getProjectById => {0 => 'long'}, | ||||||||||||||||||||||||||||||||||||||||||
| 832 | # getProjectByKey | ||||||||||||||||||||||||||||||||||||||||||
| 833 | getProjectRole => {0 => 'long'}, | ||||||||||||||||||||||||||||||||||||||||||
| 834 | getProjectRoleActors => {0 => \&_cast_remote_project_role}, | ||||||||||||||||||||||||||||||||||||||||||
| 835 | # getProjectRoles | ||||||||||||||||||||||||||||||||||||||||||
| 836 | # getProjectsNoSchemes | ||||||||||||||||||||||||||||||||||||||||||
| 837 | getProjectWithSchemesById => {0 => 'long'}, | ||||||||||||||||||||||||||||||||||||||||||
| 838 | getResolutionDateById => {0 => 'long'}, | ||||||||||||||||||||||||||||||||||||||||||
| 839 | getResolutionDateByKey => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 840 | # getResolutions | ||||||||||||||||||||||||||||||||||||||||||
| 841 | # getSavedFilters | ||||||||||||||||||||||||||||||||||||||||||
| 842 | getSecurityLevel => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 843 | # getSecurityLevels | ||||||||||||||||||||||||||||||||||||||||||
| 844 | # getSecuritySchemes | ||||||||||||||||||||||||||||||||||||||||||
| 845 | # getServerInfo | ||||||||||||||||||||||||||||||||||||||||||
| 846 | # getStatuses | ||||||||||||||||||||||||||||||||||||||||||
| 847 | # getSubTaskIssueTypes | ||||||||||||||||||||||||||||||||||||||||||
| 848 | # getSubTaskIssueTypesForProject | ||||||||||||||||||||||||||||||||||||||||||
| 849 | # getUser | ||||||||||||||||||||||||||||||||||||||||||
| 850 | # getVersions | ||||||||||||||||||||||||||||||||||||||||||
| 851 | getWorklogs => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 852 | hasPermissionToCreateWorklog => {0 => \&_cast_issue_key}, | ||||||||||||||||||||||||||||||||||||||||||
| 853 | # hasPermissionToDeleteWorklog | ||||||||||||||||||||||||||||||||||||||||||
| 854 | # hasPermissionToEditComment | ||||||||||||||||||||||||||||||||||||||||||
| 855 | # hasPermissionToUpdateWorklog | ||||||||||||||||||||||||||||||||||||||||||
| 856 | # isProjectRoleNameUnique | ||||||||||||||||||||||||||||||||||||||||||
| 857 | # login ##NOT USED## | ||||||||||||||||||||||||||||||||||||||||||
| 858 | # logout ##NOT USED## | ||||||||||||||||||||||||||||||||||||||||||
| 859 | progressWorkflowAction => {0 => \&_cast_issue_key, 2 => \&_cast_remote_field_values}, | ||||||||||||||||||||||||||||||||||||||||||
| 860 | # refreshCustomFields | ||||||||||||||||||||||||||||||||||||||||||
| 861 | # releaseVersion | ||||||||||||||||||||||||||||||||||||||||||
| 862 | removeActorsFromProjectRole => {1 => \&_cast_remote_project_role}, | ||||||||||||||||||||||||||||||||||||||||||
| 863 | # removeAllRoleActorsByNameAndType | ||||||||||||||||||||||||||||||||||||||||||
| 864 | # removeAllRoleActorsByProject | ||||||||||||||||||||||||||||||||||||||||||
| 865 | removeDefaultActorsFromProjectRole => {1 => \&_cast_remote_project_role}, | ||||||||||||||||||||||||||||||||||||||||||
| 866 | # removeUserFromGroup | ||||||||||||||||||||||||||||||||||||||||||
| 867 | # setNewProjectAvatar | ||||||||||||||||||||||||||||||||||||||||||
| 868 | setProjectAvatar => {1 => 'long'}, | ||||||||||||||||||||||||||||||||||||||||||
| 869 | # setUserPassword | ||||||||||||||||||||||||||||||||||||||||||
| 870 | # updateGroup | ||||||||||||||||||||||||||||||||||||||||||
| 871 | updateIssue => {0 => \&_cast_issue_key, 1 => \&_cast_remote_field_values}, | ||||||||||||||||||||||||||||||||||||||||||
| 872 | # updateProject | ||||||||||||||||||||||||||||||||||||||||||
| 873 | updateProjectRole => {0 => \&_cast_remote_project_role}, | ||||||||||||||||||||||||||||||||||||||||||
| 874 | # updateUser | ||||||||||||||||||||||||||||||||||||||||||
| 875 | # updateWorklogAndAutoAdjustRemainingEstimate | ||||||||||||||||||||||||||||||||||||||||||
| 876 | # updateWorklogAndRetainRemainingEstimate | ||||||||||||||||||||||||||||||||||||||||||
| 877 | # updateWorklogWithNewRemainingEstimate | ||||||||||||||||||||||||||||||||||||||||||
| 878 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | ▶ | sub _cast_issue_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cast_issue_key: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | my ($self, $issue) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | ▶ | return ref $issue ? $issue->{key} : $issue; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | ▶ | sub _cast_remote_comment { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cast_remote_comment: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | my ($self, $arg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | ▶ | return ref $arg ? $arg : bless({body => $arg} => 'RemoteComment'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 888 | } | ||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | ▶ | sub _cast_filter_name_to_id { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cast_filter_name_to_id: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | my ($self, $arg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | ▶ | is_string($arg) or croak "Filter arg must be a string.\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | ▶ | return $arg unless $arg =~ /\D/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | my $filters = $self->get_favourite_filters(); | |||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | ▶ | exists $filters->{$arg} or croak "Unknown filter: $arg\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | return $filters->{$arg}{id}; | |||||||||||||||||||||||||||||||||||||||||
| 897 | } | ||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | ▶ | sub _cast_remote_field_values { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cast_remote_field_values: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | my ($self, $arg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | ▶ | return is_hash_ref($arg) ? [map {RemoteFieldValue->new($_, $arg->{$_})} keys %$arg] : $arg; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 902 | } | ||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | ▶ | sub _cast_remote_project_role { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cast_remote_project_role: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | my ($self, $arg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | ▶ | if (is_instance($arg => 'RemoteProjectRole') && exists $arg->{id} && is_string($arg->{id})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
is_instance($arg, "RemoteProjectRole") and exists $arg->{"id"} and is_string($arg->{"id"})
is_instance($arg, "RemoteProjectRole") and exists $arg->{"id"}
MC/DC0%0/3
is_instance($arg, "RemoteProjectRole") and exists $arg->{"id"} and is_string($arg->{"id"})
is_instance($arg, "RemoteProjectRole")
exists $arg->{"id"}
is_string($arg->{"id"})
Truth table0%0/4
A and B and C
A= is_instance($arg, "RemoteProjectRole")B= exists $arg->{"id"}C= is_string($arg->{"id"})
| |||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | $arg->{id} = SOAP::Data->type(long => $arg->{id}); | |||||||||||||||||||||||||||||||||||||||||
| 908 | } | ||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | return $arg; | |||||||||||||||||||||||||||||||||||||||||
| 910 | } | ||||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | ▶ | sub _cast_attachments { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cast_attachments: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | my ($self, $method, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 914 | # The addAttachmentsToIssue method is deprecated and requires too | ||||||||||||||||||||||||||||||||||||||||||
| 915 | # much overhead to pass the file contents over the wire. Here we | ||||||||||||||||||||||||||||||||||||||||||
| 916 | # convert the arguments to call the newer | ||||||||||||||||||||||||||||||||||||||||||
| 917 | # addBase64EncodedAttachmentsToIssue method instead. | ||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | require MIME::Base64; | |||||||||||||||||||||||||||||||||||||||||
| 919 | 0 | for my $content (@{$args->[2]}) { | |||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | $content = MIME::Base64::encode_base64($content); | |||||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | $$method = 'addBase64EncodedAttachmentsToIssue'; | |||||||||||||||||||||||||||||||||||||||||
| 923 | 0 | _cast_base64encodedattachments($self, $method, $args); | |||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 925 | } | ||||||||||||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | ▶ | sub _cast_base64encodedattachments { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cast_base64encodedattachments: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | my ($self, $method, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | $args->[0] = _cast_issue_key($self, $args->[0]); | |||||||||||||||||||||||||||||||||||||||||
| 930 | # We have to set the names of the arrays and of its elements | ||||||||||||||||||||||||||||||||||||||||||
| 931 | # because the default naming isn't properly understood by JIRA. | ||||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | for my $i (1 .. 2) { | |||||||||||||||||||||||||||||||||||||||||
| 933 | $args->[$i] = SOAP::Data->name( | ||||||||||||||||||||||||||||||||||||||||||
| 934 | "array$i", | ||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | [map {SOAP::Data->name("elem$i", $_)} @{$args->[$i]}], | |||||||||||||||||||||||||||||||||||||||||
| 936 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 939 | } | ||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||
| 941 | # All methods follow the same call convention, which makes it easy to | ||||||||||||||||||||||||||||||||||||||||||
| 942 | # implement them all with an AUTOLOAD. | ||||||||||||||||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||||||||||||||||
| 944 | 2 | our $AUTOLOAD; | |||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: not called CC=12 SCAR=50.5
| |||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | (my $method = $AUTOLOAD) =~ s/.*:://; | |||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||
| 949 | # Perform any non-default type coersion | ||||||||||||||||||||||||||||||||||||||||||
| 950 | 0 | ▶ | if (my $typeof = $typeof{$method}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | ▶ | if (is_hash_ref($typeof)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | ▶ | while (my ($i, $type) = each %$typeof) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 953 | 0 | ▶ | if (is_code_ref($type)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | $args[$i] = $type->($self, $args[$i]); | |||||||||||||||||||||||||||||||||||||||||
| 955 | } elsif (is_value($args[$i])) { | ||||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | $args[$i] = SOAP::Data->type($type => $args[$i]); | |||||||||||||||||||||||||||||||||||||||||
| 957 | } elsif (is_array_ref($args[$i])) { | ||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | foreach (@{$args[$i]}) { | |||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | $_ = SOAP::Data->type($type => $_); | |||||||||||||||||||||||||||||||||||||||||
| 960 | } | ||||||||||||||||||||||||||||||||||||||||||
| 961 | } elsif (is_hash_ref($args[$i])) { | ||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | foreach (values %{$args[$i]}) { | |||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | $_ = SOAP::Data->type($type => $_); | |||||||||||||||||||||||||||||||||||||||||
| 964 | } | ||||||||||||||||||||||||||||||||||||||||||
| 965 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | croak "Can't coerse argument $i of method $AUTOLOAD.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 967 | } | ||||||||||||||||||||||||||||||||||||||||||
| 968 | } | ||||||||||||||||||||||||||||||||||||||||||
| 969 | } elsif (is_code_ref($typeof)) { | ||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | $typeof->($self, \$method, \@args); | |||||||||||||||||||||||||||||||||||||||||
| 971 | } | ||||||||||||||||||||||||||||||||||||||||||
| 972 | } | ||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | my $call = $self->{soap}->call($method, $self->{auth}, @args); | |||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | ▶ | croak $call->faultcode(), ', ', $call->faultstring() | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 976 | if defined $call->fault(); | ||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | return $call->result(); | |||||||||||||||||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||
| 981 | 2 | 1; # End of JIRA::Client | |||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||
| 983 | __END__ | ||||||||||||||||||||||||||||||||||||||||||