lib/WWW/Hetzner/Cloud/SSHKey.pm

filter: Statementstmt 65.5% 19 / 29 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 100% 3 / 3 totaltotal 60.4% 26 / 43 CC 3 SCAR 12.0
CC
3
Cov
58%
update
6.0
delete
6.0
data
2.0
CRAP 3.3
« lib/WWW/Hetzner/Robot/CLI/Cmd/Wol.pm ↑ Summary lib/WWW/Hetzner/Cloud/API/RRSets.pm »
1 package WWW::Hetzner::Cloud::SSHKey;
2 # ABSTRACT: Hetzner Cloud SSHKey object
3  
4 25 our $VERSION = '0.100';
5  
6 25 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 25 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 25 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 25 has _client => (
12 is => 'ro',
13 required => 1,
14 weak_ref => 1,
15 init_arg => 'client',
16 );
17  
18 25 has id => ( is => 'ro' );
19  
20  
21 25 has name => ( is => 'rw' );
22  
23  
24 25 has public_key => ( is => 'ro' );
25  
26  
27 25 has fingerprint => ( is => 'ro' );
28  
29  
30 25 has created => ( is => 'ro' );
31  
32  
33 4 ▶has labels => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
34  
35  
36 sub update {
37 0 ▶ my ($self) = @_;
Subroutine update: not called CC=2 SCAR=17.9
Pod documented
38 0 ▶ croak "Cannot update SSH key without ID" unless $self->id;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->id 0 0 0
39  
40 0 $self->_client->put("/ssh_keys/" . $self->id, {
41 name => $self->name,
42 labels => $self->labels,
43 });
44 0 return $self;
45 }
46  
47  
48 sub delete {
49 0 ▶ my ($self) = @_;
Subroutine delete: not called CC=2 SCAR=17.9
Pod documented
50 0 ▶ croak "Cannot delete SSH key without ID" unless $self->id;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->id 0 0 0
51  
52 0 $self->_client->delete("/ssh_keys/" . $self->id);
53 0 return 1;
54 }
55  
56  
57 sub data {
58 0 ▶ my ($self) = @_;
Subroutine data: not called CC=1 SCAR=6.9
Pod documented
59 return {
60 0 id => $self->id,
61 name => $self->name,
62 public_key => $self->public_key,
63 fingerprint => $self->fingerprint,
64 created => $self->created,
65 labels => $self->labels,
66 };
67 }
68  
69  
70  
71 25 1.
72  
73 __END__
« lib/WWW/Hetzner/Robot/CLI/Cmd/Wol.pm ↑ Summary lib/WWW/Hetzner/Cloud/API/RRSets.pm »