Gitea/API/Users.pm

filter: Statementstmt 55.1% 16 / 29 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 44.4% 4 / 9 Podpod 100% 2 / 2 totaltotal 48.8% 22 / 45 CC 3 SCAR 11.3
CC
3
Cov
48%
get
6.0
search
6.0
__ANON__
2.0
CRAP 3.1
« Gitea/Role/OpenAPI.pm ↑ Summary Gitea/Comment.pm »
1 package WWW::Gitea::API::Users;
2  
3 # ABSTRACT: Gitea users API (lookup and search)
4  
5 5 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use WWW::Gitea::User;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 5 has client => (
12 is => 'ro',
13 required => 1,
14 weak_ref => 1,
15 );
16  
17  
18 has openapi_operations => (
19 is => 'lazy',
20 0 ▶ builder => sub {
Subroutine _build_openapi_operations: not called CC=1 SCAR=6.9
Subroutine __ANON__: not called CC=1 SCAR=6.9
21 return {
22 0 'users.get' => { method => 'GET', path => '/users/{username}' },
23 'users.search' => { method => 'GET', path => '/users/search' },
24 };
25 },
26 5 );
27  
28  
29 5 with 'WWW::Gitea::Role::OpenAPI';
30  
31 0 ▶sub _wrap {
Subroutine _wrap: not called CC=1 SCAR=6.9
32 0 my ($self, $data) = @_;
33 0 return WWW::Gitea::User->new(client => $self->client, data => $data);
34 }
35  
36 0 ▶sub get {
Subroutine get: not called CC=2 SCAR=17.9
Pod documented
37 0 my ($self, $username) = @_;
38 0 ▶ croak 'username required' unless defined $username;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $username 0 0 0
39 0 my $data = $self->call_operation('users.get',
40 path => { username => $username });
41 0 return $self->_wrap($data);
42 }
43  
44  
45 0 ▶sub search {
Subroutine search: not called CC=2 SCAR=17.9
Pod documented
46 0 my ($self, %query) = @_;
47 0 my $data = $self->call_operation('users.search', query => \%query);
48 0 ▶ return [ map { $self->_wrap($_) } @{ $data->{data} || [] } ];
Condition0%0/2
$data->{'data'} || []
l!l
00
MC/DC0%0/1
$data->{'data'} || []
$data->{'data'}
Truth table0%0/2
A
A= $data->{'data'}
Aresult
11
00
49 }
50  
51  
52  
53 5 1;
54  
55 __END__
« Gitea/Role/OpenAPI.pm ↑ Summary Gitea/Comment.pm »