| 1 | package HTTP::API::Core::Example::Jira; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use parent 'HTTP::API::Core'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use HTTP::API::Core::Auth qw(basic_auth); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | # A small Jira Server/Data Center search recipe, not an official SDK. | ||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | my $username = delete $args{username}; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | my $password = delete $args{password}; | |||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | die "username is required\n" if !defined($username) || ref($username) ne ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $username or ref $username ne ""
MC/DC0%0/2
not defined $username or ref $username ne ""
not defined $username
ref $username ne ""
Truth table33%1/3
not(A) or B
A= not defined $usernameB= ref $username ne ""
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | die "password is required\n" if !defined($password) || ref($password) ne ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $password or ref $password ne ""
MC/DC50%1/2
not defined $password or ref $password ne ""
not defined $password
ref $password ne ""
Truth table66%2/3
not(A) or B
A= not defined $passwordB= ref $password ne ""
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | die "base_url is required\n" if !defined($args{base_url}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | die "custom hooks are not supported by this example\n" | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | if exists $args{hooks}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | return $class->SUPER::new( | |||||||||||||||||||||||||||||||||||||||||
| 20 | %args, | ||||||||||||||||||||||||||||||||||||||||||
| 21 | hooks => { before_request => basic_auth($username, $password) }, | ||||||||||||||||||||||||||||||||||||||||||
| 22 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 5 | ▶ | sub issues_pager { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
issues_pager: called CC=13 SCAR=26.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 5 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 5 | my $jql = delete $args{jql}; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 5 | ▶ | die "jql must be a non-empty scalar\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
not defined $jql or ref $jql ne "" or $jql eq ""
not defined $jql or ref $jql ne ""
MC/DC33%1/3
not defined $jql or ref $jql ne "" or $jql eq ""
not defined $jql
ref $jql ne ""
$jql eq ""
Truth table50%2/4
not(A) or B or C
A= not defined $jqlB= ref $jql ne ""C= $jql eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | if !defined($jql) || ref($jql) ne '' || $jql eq ''; | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 4 | my $fields = delete $args{fields}; | |||||||||||||||||||||||||||||||||||||||||
| 32 | 4 | ▶ | if (defined $fields) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 2 | ▶ | if (ref($fields) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | die "fields must contain only non-empty scalars\n" | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | ▶ | if grep { !defined($_) || ref($_) ne '' || $_ eq '' } @$fields; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
!defined($_) || ref $_ ne '' || $_ eq ''
not defined $_ or ref $_ ne ""
MC/DC33%1/3
!defined($_) || ref $_ ne '' || $_ eq ''
not defined $_
ref $_ ne ""
$_ eq ''
Truth table50%2/4
not(A) or B || C
A= not defined $_B= ref $_ ne ""C= $_ eq ''
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | $fields = join(',', @$fields); | |||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | elsif (ref($fields) ne '') { | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | die "fields must be a string or array reference\n"; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | my $max_results = exists($args{max_results}) | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 3 | ▶ | ? delete($args{max_results}) : 100; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 3 | die "unknown issues_pager option: $_\n" for sort keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 2 | ▶ | return $self->paginate( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | '/rest/api/2/search', | ||||||||||||||||||||||||||||||||||||||||||
| 49 | mode => 'offset', | ||||||||||||||||||||||||||||||||||||||||||
| 50 | items => 'issues', | ||||||||||||||||||||||||||||||||||||||||||
| 51 | total => 'total', | ||||||||||||||||||||||||||||||||||||||||||
| 52 | offset_param => 'startAt', | ||||||||||||||||||||||||||||||||||||||||||
| 53 | page_size_param => 'maxResults', | ||||||||||||||||||||||||||||||||||||||||||
| 54 | page_size => $max_results, | ||||||||||||||||||||||||||||||||||||||||||
| 55 | query => { | ||||||||||||||||||||||||||||||||||||||||||
| 56 | jql => $jql, | ||||||||||||||||||||||||||||||||||||||||||
| 57 | (defined($fields) ? (fields => $fields) : ()), | ||||||||||||||||||||||||||||||||||||||||||
| 58 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 59 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||