lib/Kubernetes/REST/HTTPRequest.pm

filter: Statementstmt 91.6% 22 / 24 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 88.2% 30 / 34 CC 3 SCAR 5.1
CC
3
Cov
89%
__ANON__
2.3
authenticate
2.0
__ANON__
1.1
CRAP 1.7
« lib/Kubernetes/REST/APIError.pm ↑ Summary lib/Kubernetes/REST/Role/IO.pm »
1 package Kubernetes::REST::HTTPRequest;
2 91 our $VERSION = '1.110';
3 # ABSTRACT: HTTP request object
4 91 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 91 ▶use Types::Standard qw/Str HashRef/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 91 has server => (is => 'ro');
9  
10  
11 91 has credentials => (is => 'ro');
12  
13  
14 2 ▶sub authenticate {
Subroutine authenticate: called CC=2 SCAR=6.9
Pod documented
15 2 my $self = shift;
16 2 my $auth = $self->credentials;
17 2 ▶ if (defined $auth) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $auth) 1 1 2
18 1 $self->headers->{ Authorization } = 'Bearer ' . $auth->token;
19 }
20 }
21  
22  
23 91 has uri => (is => 'rw', isa => Str);
24  
25  
26 91 has method => (is => 'rw', isa => Str);
27  
28  
29 1 ▶has url => (is => 'rw', isa => Str, lazy => 1, default => sub {
Subroutine __ANON__: called CC=2 SCAR=8.1
30 1 my $self = shift;
31 1 ▶ return $self->server->endpoint . $self->uri if $self->server;
Branch: 1 branch
BranchTrueFalseTotal
if $self->server 1 0 1
32 0 return '';
33 91 });
34  
35  
36 0 ▶has headers => (is => 'rw', isa => HashRef, default => sub { {} });
Subroutine __ANON__: not called CC=1 SCAR=1.2
37  
38  
39 91 has parameters => (is => 'rw', isa => HashRef);
40  
41  
42 91 has content => (is => 'rw', isa => Str);
43  
44  
45 91 1;
46  
47 __END__
« lib/Kubernetes/REST/APIError.pm ↑ Summary lib/Kubernetes/REST/Role/IO.pm »