DNSMadeEasy/Domain.pm

filter: Statementstmt 58.9% 23 / 39 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 40.0% 6 / 15 Podpod 66.6% 8 / 12 totaltotal 56.0% 37 / 66 CC 2 SCAR 5.2
CC
2
Cov
59%
create
2.0
delete
2.0
put
2.0
CRAP 1.7
« DNSMadeEasy/Domain/Record.pm ↑ Summary DME.pm »
1 package WWW::DNSMadeEasy::Domain;
2 8 our $VERSION = '0.100';
3 8 our $AUTHORITY = 'cpan:GETTY';
4 # ABSTRACT: A domain in the DNSMadeEasy API
5  
6 8 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 ▶use WWW::DNSMadeEasy::Domain::Record;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 8 has name => (
10 # isa => 'Str',
11 is => 'ro',
12 required => 1,
13 );
14  
15 8 has dme => (
16 # isa => 'WWW::DNSMadeEasy',
17 is => 'ro',
18 required => 1,
19 );
20  
21 0 ▶sub create {
Subroutine create: not called CC=1 SCAR=6.9
Pod undocumented
22 0 my ( $class, @args ) = @_;
23 0 my $domain = $class->new(@args);
24 0 $domain->put;
25 0 return $domain;
26 }
27  
28 4 ▶sub path {
Subroutine path: called CC=1 SCAR=0.0
Pod undocumented
29 4 my ( $self ) = @_;
30 4 $self->dme->path_domains.'/'.$self->name;
31 }
32  
33 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
Pod documented
34 0 my ( $self ) = @_;
35 0 $self->dme->request('DELETE',$self->path);
36 }
37  
38 0 ▶sub put {
Subroutine put: not called CC=1 SCAR=6.9
Pod documented
39 0 my ( $self ) = @_;
40 0 $self->dme->request('PUT',$self->path);
41 }
42  
43 4 ▶sub path_records { shift->path.'/records' }
Subroutine path_records: called CC=1 SCAR=0.0
Pod undocumented
44  
45 0 ▶sub name_server { shift->response->data->{nameServer} }
Subroutine name_server: not called CC=1 SCAR=6.9
Pod documented
46 0 ▶sub gtd_enabled { shift->response->data->{gtdEnabled} }
Subroutine gtd_enabled: not called CC=1 SCAR=6.9
Pod documented
47 0 ▶sub vanity_name_servers { shift->response->data->{vanityNameServers} }
Subroutine vanity_name_servers: not called CC=1 SCAR=6.9
Pod documented
48 0 ▶sub vanity_id { shift->response->data->{vanityId} }
Subroutine vanity_id: not called CC=1 SCAR=6.9
Pod documented
49  
50 8 has response => (
51 is => 'ro',
52 builder => '_build_response',
53 lazy => 1,
54 );
55  
56 0 ▶sub _build_response {
Subroutine _build_response: not called CC=1 SCAR=6.9
57 0 my ( $self ) = @_;
58 0 $self->dme->request('GET',$self->path);
59 }
60  
61 1 ▶sub create_record {
Subroutine create_record: called CC=1 SCAR=0.0
Pod documented
62 1 my ( $self, $data ) = @_;
63  
64 1 my $post_response = $self->dme->request('POST',$self->path_records,$data);
65  
66 return WWW::DNSMadeEasy::Domain::Record->new({
67 domain => $self,
68 id => $post_response->data->{id},
69 1 response => $post_response,
70 });
71 }
72  
73 0 ▶sub post {
Subroutine post: not called CC=1 SCAR=6.9
Pod undocumented
74 0 my ( $self ) = @_;
75 0 $self->dme->request('POST',$self->path);
76 }
77  
78 2 ▶sub all_records {
Subroutine all_records: called CC=2 SCAR=6.9
Pod documented
79 2 my ( $self ) = @_;
80  
81 2 my $data = $self->dme->request('GET', $self->path_records)->as_hashref;
82  
83 2 my @records;
84 push @records, WWW::DNSMadeEasy::Domain::Record->new({
85 domain => $self,
86 id => $_->{id},
87 as_hashref => $_,
88 2 }) for @$data;
89
90 2 return @records;
91 }
92  
93 8 1;
94  
95 __END__
« DNSMadeEasy/Domain/Record.pm ↑ Summary DME.pm »