Gitea/API/Users.pm

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