| 1 | package WWW::DNSMadeEasy::Domain::Record; | ||||||||||
| 2 | 8 | our $VERSION = '0.100'; | |||||||||
| 3 | 8 | our $AUTHORITY = 'cpan:GETTY'; | |||||||||
| 4 | # ABSTRACT: A domain record in the DNSMadeEasy API | ||||||||||
| 5 | |||||||||||
| 6 | 8 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 8 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 8 | has id => ( | |||||||||
| 10 | is => 'ro', | ||||||||||
| 11 | required => 1, | ||||||||||
| 12 | ); | ||||||||||
| 13 | |||||||||||
| 14 | 8 | has domain => ( | |||||||||
| 15 | is => 'ro', | ||||||||||
| 16 | required => 1, | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | 8 | has response_index => ( | |||||||||
| 20 | is => 'rw', | ||||||||||
| 21 | predicate => 'has_response_index', | ||||||||||
| 22 | ); | ||||||||||
| 23 | |||||||||||
| 24 | 8 | has as_hashref => (is => 'rw', builder => 1, lazy => 1); | |||||||||
| 25 | 8 | has response => (is => 'rw', builder => 1, lazy => 1); | |||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | sub _build_as_hashref { shift->response->as_hashref } | ||||||||
|
Subroutine
_build_as_hashref: not called CC=1 SCAR=6.9
| |||||||||||
| 28 | 0 | ▶ | sub _build_response { $_[0]->domain->dme->request(GET => $_[0]->path) } | ||||||||
|
Subroutine
_build_response: not called CC=1 SCAR=6.9
| |||||||||||
| 29 | |||||||||||
| 30 | 1 | ▶ | sub ttl { shift->as_hashref->{ttl} } | ||||||||
|
Subroutine
ttl: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 31 | 0 | ▶ | sub gtd_location { shift->as_hashref->{gtdLocation} } | ||||||||
|
Subroutine
gtd_location: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 32 | 1 | ▶ | sub name { shift->as_hashref->{name} } | ||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 33 | 1 | ▶ | sub data { shift->as_hashref->{data} } | ||||||||
|
Subroutine
data: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 34 | 1 | ▶ | sub type { shift->as_hashref->{type} } | ||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 35 | 0 | ▶ | sub password { shift->as_hashref->{password} } | ||||||||
|
Subroutine
password: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 36 | 0 | ▶ | sub description { shift->as_hashref->{description} } | ||||||||
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 37 | 0 | ▶ | sub keywords { shift->as_hashref->{keywords} } | ||||||||
|
Subroutine
keywords: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 38 | 0 | ▶ | sub title { shift->as_hashref->{title} } | ||||||||
|
Subroutine
title: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 39 | 0 | ▶ | sub redirect_type { shift->as_hashref->{redirectType} } | ||||||||
|
Subroutine
redirect_type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 40 | 0 | ▶ | sub hard_link { shift->as_hashref->{hardLink} } | ||||||||
|
Subroutine
hard_link: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 41 | |||||||||||
| 42 | 1 | ▶ | sub path { | ||||||||
|
Subroutine
path: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 43 | 1 | my ( $self ) = @_; | |||||||||
| 44 | 1 | $self->domain->path_records.'/'.$self->id; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 1 | ▶ | sub delete { | ||||||||
|
Subroutine
delete: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 48 | 1 | my ( $self ) = @_; | |||||||||
| 49 | 1 | $self->domain->dme->request('DELETE',$self->path); | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 0 | ▶ | sub put { shift->update(@_) } | ||||||||
|
Subroutine
put: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 53 | |||||||||||
| 54 | 0 | ▶ | sub update { | ||||||||
|
Subroutine
update: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 55 | 0 | my $self = shift; | |||||||||
| 56 | 0 | ▶ | my %data = ( @_ % 2 == 1 ) ? %{ $_[0] } : @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | 0 | my $put_response = $self->domain->dme->request('PUT', $self->path, \%data); | |||||||||
| 58 | return WWW::DNSMadeEasy::Domain::Record->new({ | ||||||||||
| 59 | domain => $self->domain, | ||||||||||
| 60 | id => $put_response->data->{id}, | ||||||||||
| 61 | 0 | response => $put_response, | |||||||||
| 62 | }); | ||||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 8 | 1; | |||||||||
| 66 | |||||||||||
| 67 | __END__ | ||||||||||