DNSMadeEasy/Domain.pm

filter: Statementstmt 30.9% 13 / 42 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 18.7% 3 / 16 Podpod 66.6% 8 / 12 totaltotal 34.2% 24 / 70 CC 2 SCAR 8.3
CC
2
Cov
31%
all_records
6.0
create
2.0
path
2.0
CRAP 2.3
« DNSMadeEasy.pm ↑ Summary DNSMadeEasy/Domain/Record.pm »
1 package WWW::DNSMadeEasy::Domain;
2 BEGIN {
3 3 ▶ $WWW::DNSMadeEasy::Domain::AUTHORITY = 'cpan:GETTY';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 }
5 {
6 3 $WWW::DNSMadeEasy::Domain::VERSION = '0.001';
7 }
8 # ABSTRACT: A domain in the DNSMadeEasy API
9  
10 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use WWW::DNSMadeEasy::Domain::Record;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 has name => (
14 # isa => 'Str',
15 is => 'ro',
16 required => 1,
17 );
18  
19 3 has dme => (
20 # isa => 'WWW::DNSMadeEasy',
21 is => 'ro',
22 required => 1,
23 );
24  
25 sub create {
26 0 ▶ my ( $class, @args ) = @_;
Subroutine create: not called CC=1 SCAR=6.9
Pod undocumented
27 0 my $domain = $class->new(@args);
28 0 $domain->put;
29 0 return $domain;
30 }
31  
32 sub path {
33 0 ▶ my ( $self ) = @_;
Subroutine path: not called CC=1 SCAR=6.9
Pod undocumented
34 0 $self->dme->path_domains.'/'.$self->name;
35 }
36  
37 sub delete {
38 0 ▶ my ( $self ) = @_;
Subroutine delete: not called CC=1 SCAR=6.9
Pod documented
39 0 $self->dme->request('DELETE',$self->path);
40 }
41  
42 sub put {
43 0 ▶ my ( $self ) = @_;
Subroutine put: not called CC=1 SCAR=6.9
Pod documented
44 0 $self->dme->request('PUT',$self->path);
45 }
46  
47 0 ▶sub path_records { shift->path.'/records' }
Subroutine path_records: not called CC=1 SCAR=6.9
Pod undocumented
48  
49 0 ▶sub name_server { shift->obj->{nameServer} }
Subroutine name_server: not called CC=1 SCAR=6.9
Pod documented
50 0 ▶sub gtd_enabled { shift->obj->{gtdEnabled} }
Subroutine gtd_enabled: not called CC=1 SCAR=6.9
Pod documented
51 0 ▶sub vanity_name_servers { shift->obj->{vanityNameServers} }
Subroutine vanity_name_servers: not called CC=1 SCAR=6.9
Pod documented
52 0 ▶sub vanity_id { shift->obj->{vanityId} }
Subroutine vanity_id: not called CC=1 SCAR=6.9
Pod documented
53  
54 3 has obj => (
55 is => 'ro',
56 builder => '_build_obj',
57 lazy => 1,
58 );
59  
60 sub _build_obj {
61 0 ▶ my ( $self ) = @_;
Subroutine _build_obj: not called CC=1 SCAR=6.9
62 0 return $self->dme->request('GET',$self->path);
63 }
64  
65 sub create_record {
66 0 ▶ my ( $self, $obj ) = @_;
Subroutine create_record: not called CC=1 SCAR=6.9
Pod documented
67 0 my $post_result = $self->dme->request('POST',$self->path_records,$obj);
68 return WWW::DNSMadeEasy::Domain::Record->new({
69 domain => $self,
70 id => $_->{id},
71 0 obj => $post_result,
72 });
73 }
74  
75 sub post {
76 0 ▶ my ( $self ) = @_;
Subroutine post: not called CC=1 SCAR=6.9
Pod undocumented
77 0 $self->dme->request('POST',$self->path);
78 }
79  
80 sub all_records {
81 0 ▶ my ( $self ) = @_;
Subroutine all_records: not called CC=2 SCAR=17.9
Pod documented
82 0 my $data = $self->dme->request('GET',$self->path_records);
83 0 my @records;
84 0 for (@{$data}) {
85 push @records, WWW::DNSMadeEasy::Domain::Record->new({
86 domain => $self,
87 id => $_->{id},
88 0 obj => $_,
89 });
90 }
91 0 return @records;
92 }
93  
94 3 1;
95  
96  
97 __END__
98 =pod
99  
100 =head1 NAME
101  
102 WWW::DNSMadeEasy::Domain - A domain in the DNSMadeEasy API
103  
104 =head1 VERSION
105  
106 version 0.001
107  
108 =head1 ATTRIBUTES
109  
110 =head2 name
111  
112 Name of the domain
113  
114 =head2 dme
115  
116 L<WWW::DNSMadeEasy> object
117  
118 =head2 obj
119  
120 Hash object representation given by DNSMadeEasy.
121  
122 =head1 METHODS
123  
124 =head2 $obj->put
125  
126 =head2 $obj->delete
127  
128 =head2 $obj->all_records
129  
130 =head2 $obj->create_record
131  
132 =head2 $obj->name_server
133  
134 =head2 $obj->gtd_enabled
135  
136 =head2 $obj->vanity_name_servers
137  
138 =head2 $obj->vanity_id
139  
140 =encoding utf8
141  
142 =head1 ATTRIBUTES
143  
144 =head1 METHODS
145  
146 =head1 SUPPORT
147  
148 IRC
149  
150 Join #duckduckgo on irc.freenode.net and highlight Getty or /msg me.
151  
152 Repository
153  
154 http://github.com/Getty/p5-www-dnsmadeeasy
155 Pull request and additional contributors are welcome
156  
157 Issue Tracker
158  
159 http://github.com/Getty/p5-www-dnsmadeeasy/issues
160  
161 =head1 AUTHOR
162  
163 Torsten Raudssus <torsten@raudssus.de>
164  
165 =head1 COPYRIGHT AND LICENSE
166  
167 This software is copyright (c) 2012 by L<Raudssus Social Software|http://www.raudssus.de/>.
168  
169 This is free software; you can redistribute it and/or modify it under
170 the same terms as the Perl 5 programming language system itself.
171  
172 =cut
173  
« DNSMadeEasy.pm ↑ Summary DNSMadeEasy/Domain/Record.pm »