lib/WWW/Hetzner/Cloud/RRSet.pm

filter: Statementstmt 44.7% 17 / 38 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 37.5% 3 / 8 Podpod 100% 4 / 4 totaltotal 38.7% 24 / 62 CC 7 SCAR 24.9
CC
7
Cov
34%
update
20.0
delete
20.0
values
2.0
CRAP 12.0
« lib/WWW/Hetzner/Cloud/Network.pm ↑ Summary lib/WWW/Hetzner/Robot/API/Traffic.pm »
1 package WWW::Hetzner::Cloud::RRSet;
2 # ABSTRACT: Hetzner Cloud DNS RRSet 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 zone_id => ( is => 'ro', required => 1 );
19  
20  
21 25 has name => ( is => 'ro' );
22  
23  
24 25 has type => ( is => 'ro' );
25  
26  
27 25 has ttl => ( is => 'rw' );
28  
29  
30 0 ▶has records => ( is => 'rw', default => sub { [] } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
31  
32  
33 sub update {
34 0 ▶ my ($self) = @_;
Subroutine update: not called CC=4 SCAR=30.0
Pod documented
35 0 ▶ croak "Cannot update RRSet without zone_id" unless $self->zone_id;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->zone_id 0 0 0
36 0 ▶ croak "Cannot update RRSet without name" unless $self->name;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->name 0 0 0
37 0 ▶ croak "Cannot update RRSet without type" unless $self->type;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->type 0 0 0
38  
39 0 my $path = "/zones/" . $self->zone_id . "/rrsets/" . $self->name . "/" . $self->type;
40 0 $self->_client->put($path, {
41 ttl => $self->ttl,
42 records => $self->records,
43 });
44 0 return $self;
45 }
46  
47  
48 sub delete {
49 0 ▶ my ($self) = @_;
Subroutine delete: not called CC=4 SCAR=30.0
Pod documented
50 0 ▶ croak "Cannot delete RRSet without zone_id" unless $self->zone_id;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->zone_id 0 0 0
51 0 ▶ croak "Cannot delete RRSet without name" unless $self->name;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->name 0 0 0
52 0 ▶ croak "Cannot delete RRSet without type" unless $self->type;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->type 0 0 0
53  
54 0 my $path = "/zones/" . $self->zone_id . "/rrsets/" . $self->name . "/" . $self->type;
55 0 $self->_client->delete($path);
56 0 return 1;
57 }
58  
59  
60 sub values {
61 0 ▶ my ($self) = @_;
Subroutine values: not called CC=1 SCAR=6.9
Pod documented
62 0 return [ map { $_->{value} } @{$self->records} ];
63 }
64  
65  
66 sub data {
67 0 ▶ my ($self) = @_;
Subroutine data: not called CC=1 SCAR=6.9
Pod documented
68 return {
69 0 zone_id => $self->zone_id,
70 name => $self->name,
71 type => $self->type,
72 ttl => $self->ttl,
73 records => $self->records,
74 };
75 }
76  
77  
78  
79 25 1.
80  
81 __END__
« lib/WWW/Hetzner/Cloud/Network.pm ↑ Summary lib/WWW/Hetzner/Robot/API/Traffic.pm »