blib/lib/WWW/LogicBoxes/Domain.pm

filter: Statementstmt 75.4% 43 / 57 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 100% 1 / 1 totaltotal 73.2% 52 / 71 CC 4 SCAR 19.9
CC
4
Cov
70%
construct_from_response
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 7.3
« blib/lib/WWW/LogicBoxes/Role/Command/Raw.pm ↑ Summary blib/lib/WWW/LogicBoxes/Role/Command/Domain/Transfer.pm »
1 package WWW::LogicBoxes::Domain;
2  
3 39 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 39 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 39 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 39 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 39 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 39 ▶use WWW::LogicBoxes::Types qw( Bool DateTime DomainName DomainNames DomainStatus Int PrivateNameServers Str VerificationStatus );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 39 ▶use WWW::LogicBoxes::PrivateNameServer;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 39 ▶use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 39 our $VERSION = '1.1.0'; # VERSION
17 # ABSTRACT: LogicBoxes Domain Representation
18  
19 39 has id => (
20 is => 'ro',
21 isa => Int,
22 required => 1,
23 );
24  
25 39 has name => (
26 is => 'ro',
27 isa => DomainName,
28 required => 1,
29 );
30  
31 39 has customer_id => (
32 is => 'ro',
33 isa => Int,
34 required => 1,
35 );
36  
37 39 has status => (
38 is => 'ro',
39 isa => DomainStatus,
40 required => 1,
41 );
42  
43 39 has verification_status => (
44 is => 'ro',
45 isa => VerificationStatus,
46 required => 1,
47 );
48  
49 39 has is_locked => (
50 is => 'ro',
51 isa => Bool,
52 required => 1,
53 );
54  
55 39 has is_private => (
56 is => 'ro',
57 isa => Bool,
58 required => 1,
59 );
60  
61 39 has created_date => (
62 is => 'ro',
63 isa => DateTime,
64 required => 1,
65 );
66  
67 39 has expiration_date => (
68 is => 'ro',
69 isa => DateTime,
70 required => 1,
71 );
72  
73 39 has ns => (
74 is => 'ro',
75 isa => DomainNames,
76 required => 1,
77 );
78  
79 39 has registrant_contact_id => (
80 is => 'ro',
81 isa => Int,
82 required => 1,
83 );
84  
85 39 has admin_contact_id => (
86 is => 'ro',
87 isa => Int,
88 required => 1,
89 );
90  
91 39 has technical_contact_id => (
92 is => 'ro',
93 isa => Int,
94 required => 1,
95 );
96  
97 39 has billing_contact_id => (
98 is => 'ro',
99 isa => Int,
100 required => 1,
101 );
102  
103 39 has epp_key => (
104 is => 'ro',
105 isa => Str,
106 required => 1,
107 );
108  
109 39 has private_nameservers => (
110 is => 'ro',
111 isa => PrivateNameServers,
112 required => 0,
113 predicate => 'has_private_nameservers',
114 );
115  
116 sub construct_from_response {
117 0 ▶ my $self = shift;
Subroutine construct_from_response: not called CC=4 SCAR=30.0
Pod documented
118 0 my $response = shift;
119  
120 0 ▶ if( !$response ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($response) 0 0 0
121 0 return;
122 }
123  
124 0 my @private_nameservers;
125 0 for my $private_nameserver_name ( keys %{ $response->{cns} } ) {
126 push @private_nameservers, WWW::LogicBoxes::PrivateNameServer->new(
127 domain_id => $response->{orderid},
128 name => $private_nameserver_name,
129 0 ips => $response->{cns}{$private_nameserver_name},
130 );
131 }
132  
133 return $self->new(
134 id => $response->{orderid},
135 name => $response->{domainname},
136 customer_id => $response->{customerid},
137 status => $response->{currentstatus},
138 verification_status => $response->{raaVerificationStatus},
139 0 is_locked => !!( grep { $_ eq 'transferlock' } @{ $response->{orderstatus} } ),
140 is_private => $response->{isprivacyprotected} eq 'true',
141 created_date => DateTime->from_epoch( epoch => $response->{creationtime}, time_zone => 'UTC' ),
142 expiration_date => DateTime->from_epoch( epoch => $response->{endtime}, time_zone => 'UTC' ),
143 0 ▶ ns => [ map { $response->{ $_ } } sort ( grep { $_ =~ m/^ns/ } keys %{ $response } ) ],
Branch: 1 branch
BranchTrueFalseTotal
scalar @private_nameservers ? : 0 0 0
144 registrant_contact_id => $response->{registrantcontactid},
145 admin_contact_id => $response->{admincontactid},
146 technical_contact_id => $response->{techcontactid},
147 billing_contact_id => $response->{billingcontactid},
148 epp_key => $response->{domsecret},
149 0 scalar @private_nameservers ? ( private_nameservers => \@private_nameservers ) : ( ),
150 );
151 }
152  
153 39 __PACKAGE__->meta->make_immutable;
154 39 1;
155  
156 __END__
157 =pod
158  
159 =head1 NAME
160  
161 WWW::LogicBoxes::Domain - Representation of Registered LogicBoxes Domain
162  
163 =head1 SYNOPSIS
164  
165 use WWW::LogicBoxes;
166  
167 my $logic_boxes = WWW::LogicBoxes->new( ... );
168  
169 my $domain = $logic_boxes->get_domain_by_name( 'test-domain.com' );
170  
171 print 'ID For domain test-domain.com is ' . $domain->id . "\n";
172  
173 =head1 DESCRIPTION
174  
175 Represents L<LogicBoxes|http://www.logicboxes.com> domains, containing all related information. For most operations this will be the base object that is used to represent the data.
176  
177 =head1 ATTRIBUTES
178  
179 =head2 B<id>
180  
181 The order_id of the domain in L<LogicBoxes|http://www.logicboxes.com>'s system.
182  
183 =head2 B<name>
184  
185 The full domain name ( test-domain.com ).
186  
187 =head2 B<customer_id>
188  
189 The id of the L<customer|WWW::LogicBoxes::Customer> who owns this domain in L<LogicBoxes|http://www.logicboxes.com>.
190  
191 =head2 B<status>
192  
193 Current status of the domain with L<LogicBoxes|http://www.logicboxes.com>. Will be one of the following values:
194  
195 =over 4
196  
197 =item InActive
198  
199 =item Active
200  
201 =item Suspended
202  
203 =item Pending Delete Restorable
204  
205 =item Deleted
206  
207 =item Archived
208  
209 =back
210  
211 =head2 B<verification_status>
212  
213 According to ICANN rules, all new gTLD domains that were registered after January 1st, 2014 must be verified. verification_status describes the current state of this verification and will be one of the following values:
214  
215 =over 4
216  
217 =item Verified
218  
219 =item Pending
220  
221 =item Suspended
222  
223 =back
224  
225 For details on the ICANN policy please see the riveting ICANN Registrar Agreement L<https://www.icann.org/resources/pages/approved-with-specs-2013-09-17-en>.
226  
227 =head2 B<is_locked>
228  
229 Boolean indicating if the domain is currently locked, preventing transfer.
230  
231 =head2 B<is_private>
232  
233 Boolean indicating if this domain uses WHOIS Privacy.
234  
235 =head2 B<created_date>
236  
237 Date this domain registration was created.
238  
239 =head2 B<expiration_date>
240  
241 Date this domain registration expires.
242  
243 =head2 B<ns>
244  
245 ArrayRef of Domain Names that are the authorizative nameservers for this domain.
246  
247 =head2 B<registrant_contact_id>
248  
249 A L<Contact|WWW::LogicBoxes::Contact> id for the Registrant.
250  
251 =head2 B<admin_contact_id>
252  
253 A L<Contact|WWW::LogicBoxes::Contact> id for the Admin.
254  
255 =head2 B<technical_contact_id>
256  
257 A L<Contact|WWW::LogicBoxes::Contact> id for the Technical.
258  
259 =head2 B<billing_contact_id>
260  
261 A L<Contact|WWW::LogicBoxes::Contact> id for the Billing.
262  
263 =head2 B<epp_key>
264  
265 The secret key needed in order to transfer a domain to another registrar.
266  
267 =head2 private_nameserves
268  
269 ArrayRef of L<WWW::LogicBoxes::PrivateNameServer> objects that contains any created private name servers. Predicate of has_private_nameservers.
270  
271 =head1 METHODS
272  
273 These methods are used internally, it's fairly unlikely that consumers will ever call them directly.
274  
275 =head2 construct_from_response
276  
277 my $logic_boxes = WWW::LogicBoxes->new( ... );
278  
279 my $response = $logic_boxes->submit({
280 method => 'domains__details_by_name',
281 params => {
282 'domain-name' => 'test-domain.com',
283 'options' => [qw( All )],
284 },
285 });
286  
287 my $domain = WWW::LogicBoxes::Domain->construct_from_response( $response );
288  
289 Constructs an instance of $self from a L<LogicBoxes|http://www.logicboxes.com> response.
290  
291 =cut
« blib/lib/WWW/LogicBoxes/Role/Command/Raw.pm ↑ Summary blib/lib/WWW/LogicBoxes/Role/Command/Domain/Transfer.pm »