| 1 | package HTTP::API::Core::Example::GitLab; | ||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use HTTP::API::Core; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use HTTP::API::Core::Auth qw(api_key_auth); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 10 | 1 | my ($class, %args) = @_; | |||||||||||||||||||||||||||
| 11 | 1 | my $token = delete $args{token}; | |||||||||||||||||||||||||||
| 12 | 1 | ▶ | die "token is required\n" if !defined($token) || $token eq ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $token or $token eq ""
MC/DC0%0/2
not defined $token or $token eq ""
not defined $token
$token eq ""
Truth table33%1/3
not(A) or B
A= not defined $tokenB= $token eq ""
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | my $api = HTTP::API::Core->new( | ||||||||||||||||||||||||||||
| 15 | 1 | ▶ | base_url => delete($args{base_url}) || 'https://gitlab.com/api/v4', | ||||||||||||||||||||||||||
|
Condition50%1/2
delete $args{'base_url'} || 'https://gitlab.com/api/v4'
MC/DC0%0/1
delete $args{'base_url'} || 'https://gitlab.com/api/v4'
delete $args{'base_url'}
Truth table50%1/2
A
A= delete $args{'base_url'}
| |||||||||||||||||||||||||||||
| 16 | hooks => { before_request => api_key_auth(name => 'PRIVATE-TOKEN', value => $token, in => 'header') }, | ||||||||||||||||||||||||||||
| 17 | %args, | ||||||||||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||||||||||
| 19 | 1 | return bless { api => $api }, $class; | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | sub projects_pager { | ||||||||||||||||||||||||||
|
Subroutine
projects_pager: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 23 | 1 | my ($self, %query) = @_; | |||||||||||||||||||||||||||
| 24 | 1 | ▶ | my $per_page = delete($query{per_page}) || 20; | ||||||||||||||||||||||||||
|
Condition50%1/2
delete $query{'per_page'} || 20
MC/DC0%0/1
delete $query{'per_page'} || 20
delete $query{'per_page'}
Truth table50%1/2
A
A= delete $query{'per_page'}
| |||||||||||||||||||||||||||||
| 25 | return $self->{api}->paginate( | ||||||||||||||||||||||||||||
| 26 | '/projects', | ||||||||||||||||||||||||||||
| 27 | mode => 'page', | ||||||||||||||||||||||||||||
| 28 | 2 | ▶ | items => sub { return $_[0] }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | 1 | page_param => 'page', | |||||||||||||||||||||||||||
| 30 | page_size_param => 'per_page', | ||||||||||||||||||||||||||||
| 31 | page_size => $per_page, | ||||||||||||||||||||||||||||
| 32 | query => \%query, | ||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 1 | 1; | |||||||||||||||||||||||||||