blib/lib/Langertha/Manifest/Auth.pm

filter: Statementstmt 92.0% 23 / 25 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 66.6% 4 / 6 totaltotal 85.0% 34 / 40 CC 2 SCAR 4.1
CC
2
Cov
93%
known_types
2.0
is_known_type
2.0
TO_JSON
2.0
CRAP 1.5
« blib/lib/Langertha/Role/JSON.pm ↑ Summary blib/lib/Langertha/Engine/XAI.pm »
1 package Langertha::Manifest::Auth;
2 # ABSTRACT: One auth mechanism of a provider manifest (type only, never a secret)
3 8 our $VERSION = '0.505';
4 8 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 8 with 'Langertha::Manifest::Validation';
6  
7  
8 8 my @KNOWN_TYPES = qw( api_key );
9 8 my %KNOWN_TYPE = map { $_ => 1 } @KNOWN_TYPES;
10  
11 8 has id => ( is => 'ro', isa => 'Str', required => 1 );
12 8 has type => ( is => 'ro', isa => 'Str', required => 1 );
13  
14  
15 84 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
16 84 my ($self) = @_;
17 84 $self->_check_id( 'id', $self->id );
18 84 $self->_check_token( 'type', $self->type );
19 83 return;
20 }
21  
22 0 ▶sub known_types { return @KNOWN_TYPES }
Subroutine known_types: not called CC=1 SCAR=6.9
Pod documented
23  
24  
25 2 ▶sub is_known_type { return $KNOWN_TYPE{ $_[0]->type } ? 1 : 0 }
Subroutine is_known_type: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$KNOWN_TYPE{$_[0]->type} ? : 1 1 2
26  
27  
28 62 ▶sub from_hash {
Subroutine from_hash: called CC=1 SCAR=0.0
Pod documented
29 62 my ( $class, $data ) = @_;
30 62 $class->_check_fields( $data, required => [qw( id type )] );
31 57 return $class->new( map { $_ => $class->_string( $_, $data->{$_} ) } qw( id type ) );
32 }
33  
34  
35 21 ▶sub to_hash {
Subroutine to_hash: called CC=1 SCAR=0.0
Pod documented
36 21 my ($self) = @_;
37 21 return { id => $self->id, type => $self->type };
38 }
39  
40  
41 0 ▶sub TO_JSON { shift->to_hash }
Subroutine TO_JSON: not called CC=1 SCAR=6.9
Pod undocumented
42  
43 8 __PACKAGE__->meta->make_immutable;
44  
45  
46 8 1;
47  
48 __END__
« blib/lib/Langertha/Role/JSON.pm ↑ Summary blib/lib/Langertha/Engine/XAI.pm »