line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
2
|
|
|
|
|
|
|
package DigitalOcean::Domain; |
3
|
1
|
|
|
1
|
|
4
|
use Mouse; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
676
|
use DigitalOcean::Domain::Record; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
367
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
#ABSTRACT: Represents a Domain object in the DigitalOcean API |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has DigitalOcean => ( |
9
|
|
|
|
|
|
|
is => 'rw', |
10
|
|
|
|
|
|
|
isa => 'DigitalOcean', |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has name => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => 'Str', |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has ttl => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => 'Num|Undef', |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has zone_file => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
isa => 'Str|Undef', |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has path => ( |
33
|
|
|
|
|
|
|
is => 'rw', |
34
|
|
|
|
|
|
|
isa => 'Str', |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub BUILD { |
38
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$self->path('domains/' . $self->name . '/records'); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub records { |
45
|
0
|
|
|
0
|
1
|
|
my ($self, $per_page) = @_; |
46
|
0
|
|
|
|
|
|
my $init_arr = [['DigitalOcean', $self->DigitalOcean], ['Domain', $self]]; |
47
|
0
|
|
|
|
|
|
return $self->DigitalOcean->_get_collection($self->path, 'DigitalOcean::Domain::Record', 'domain_records', {per_page => $per_page}, $init_arr); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub create_record { |
53
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
54
|
0
|
|
|
|
|
|
my %args = @_; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $record = $self->DigitalOcean->_create($self->path, 'DigitalOcean::Domain::Record', 'domain_record', \%args); |
57
|
0
|
|
|
|
|
|
$self->_prepare_record($record); |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
return $record; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub record { |
64
|
0
|
|
|
0
|
1
|
|
my ($self, $id) = @_; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $record = $self->DigitalOcean->_get_object($self->path . "/$id", 'DigitalOcean::Domain::Record', 'domain_record'); |
67
|
0
|
|
|
|
|
|
$self->_prepare_record($record); |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
return $record; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _prepare_record { |
73
|
0
|
|
|
0
|
|
|
my ($self, $record) = @_; |
74
|
0
|
|
|
|
|
|
$record->DigitalOcean($self->DigitalOcean); |
75
|
0
|
|
|
|
|
|
$record->Domain($self); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub delete { |
80
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
81
|
0
|
|
|
|
|
|
return $self->DigitalOcean->_delete(path => 'domains/' . $self->name); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |