File Coverage

blib/lib/WWW/LogicBoxes/DomainTransfer.pm
Criterion Covered Total %
statement 24 36 66.6
branch 0 6 0.0
condition n/a
subroutine 8 9 88.8
pod 1 1 100.0
total 33 52 63.4


line stmt bran cond sub pod time code
1             package WWW::LogicBoxes::DomainTransfer;
2              
3 39     39   407174 use strict;
  39         110  
  39         1401  
4 39     39   235 use warnings;
  39         101  
  39         1285  
5              
6 39     39   671 use Moose;
  39         142257  
  39         338  
7 39     39   268924 use MooseX::StrictConstructor;
  39         25388  
  39         381  
8 39     39   129461 use namespace::autoclean;
  39         107  
  39         403  
9              
10 39     39   4617 use WWW::LogicBoxes::Types qw( Bool DateTime DomainName DomainNames DomainStatus Int PrivateNameServers Str VerificationStatus );
  39         104  
  39         472  
11              
12 39     39   443728 use WWW::LogicBoxes::PrivateNameServer;
  39         107  
  39         1071  
13              
14 39     39   1162 use DateTime;
  39         356345  
  39         19937  
15              
16             our $VERSION = '1.10.0'; # VERSION
17             # ABSTRACT: LogicBoxes Domain Transfer In Progress Representation
18              
19             has id => (
20             is => 'ro',
21             isa => Int,
22             required => 1,
23             );
24              
25             has name => (
26             is => 'ro',
27             isa => DomainName,
28             required => 1,
29             );
30              
31             has customer_id => (
32             is => 'ro',
33             isa => Int,
34             required => 1,
35             );
36              
37             has status => (
38             is => 'ro',
39             isa => DomainStatus,
40             required => 1,
41             );
42              
43             has transfer_status => (
44             is => 'ro',
45             isa => Str,
46             required => 1,
47             );
48              
49             has verification_status => (
50             is => 'ro',
51             isa => VerificationStatus,
52             required => 1,
53             );
54              
55             has ns => (
56             is => 'ro',
57             isa => DomainNames,
58             required => 1,
59             );
60              
61             has registrant_contact_id => (
62             is => 'ro',
63             isa => Int,
64             required => 1,
65             );
66              
67             has admin_contact_id => (
68             is => 'ro',
69             isa => Int,
70             required => 1,
71             );
72              
73             has technical_contact_id => (
74             is => 'ro',
75             isa => Int,
76             required => 1,
77             );
78              
79             has billing_contact_id => (
80             is => 'ro',
81             isa => Int,
82             required => 1,
83             );
84              
85             has epp_key => (
86             is => 'ro',
87             isa => Str,
88             required => 0,
89             predicate => 'has_epp_key',
90             );
91              
92             has private_nameservers => (
93             is => 'ro',
94             isa => PrivateNameServers,
95             required => 0,
96             predicate => 'has_private_nameservers',
97             );
98              
99             sub construct_from_response {
100 0     0 1   my $self = shift;
101 0           my $response = shift;
102              
103 0 0         if( !$response ) {
104 0           return;
105             }
106              
107 0           my @private_nameservers;
108 0           for my $private_nameserver_name ( keys %{ $response->{cns} } ) {
  0            
109             push @private_nameservers, WWW::LogicBoxes::PrivateNameServer->new(
110             domain_id => $response->{orderid},
111             name => $private_nameserver_name,
112 0           ips => $response->{cns}{$private_nameserver_name},
113             );
114             }
115              
116             return $self->new(
117             id => $response->{orderid},
118             name => $response->{domainname},
119             customer_id => $response->{customerid},
120             status => $response->{currentstatus},
121             transfer_status => $response->{actionstatusdesc},
122             verification_status => $response->{raaVerificationStatus},
123 0           ns => [ map { $response->{ $_ } } sort ( grep { $_ =~ m/^ns/ } keys %{ $response } ) ],
  0            
  0            
124             registrant_contact_id => $response->{registrantcontactid},
125             admin_contact_id => $response->{admincontactid},
126             technical_contact_id => $response->{techcontactid},
127             billing_contact_id => $response->{billingcontactid},
128 0 0         $response->{domsecret} ? ( epp_key => $response->{domsecret} ) : ( ),
    0          
129             scalar @private_nameservers ? ( private_nameservers => \@private_nameservers ) : ( ),
130             );
131             }
132              
133             __PACKAGE__->meta->make_immutable;
134             1;
135              
136             __END__
137             =pod
138              
139             =head1 NAME
140              
141             WWW::LogicBoxes::DomainTransfer - Representation of a Domain Transfer In Progress
142              
143             =head1 SYNOPSIS
144              
145             use WWW::LogicBoxes;
146              
147             my $logic_boxes = WWW::LogicBoxes->new( ... );
148              
149             my $domain_transfer = $logic_boxes->get_domain_by_name( 'in-progress-transfer.com' );
150              
151             print 'Status of Domain Transfer is ' . $domain_transfer->transfer_status . "\n";
152              
153             =head1 DESCRIPTION
154              
155             Represents L<LogicBoxes|http://www.logicboxes.com> domains transfers that are in progress.
156              
157             =head1 ATTRIBUTES
158              
159             =head2 B<id>
160              
161             The order_id of the domain in L<LogicBoxes|http://www.logicboxes.com>'s system.
162              
163             =head2 B<name>
164              
165             The full domain name ( test-domain.com ).
166              
167             =head2 B<customer_id>
168              
169             The id of the L<customer|WWW::LogicBoxes::Customer> who owns this domain in L<LogicBoxes|http://www.logicboxes.com>.
170              
171             =head2 B<status>
172              
173             Current status of the domain with L<LogicBoxes|http://www.logicboxes.com>. Will be one of the following values:
174              
175             =over 4
176              
177             =item InActive
178              
179             =item Active
180              
181             =item Suspended
182              
183             =item Pending Delete Restorable
184              
185             =item Deleted
186              
187             =item Archived
188              
189             =back
190              
191             =head2 B<transfer_status>
192              
193             A human readable string indicating what part of the transfer flow we are currently in. A non exahustive list of possible values incldue:
194              
195             =over 4
196              
197             =item Transfer waiting for Losing Registrar Approval
198              
199             =item Transfer waiting for Admin Contact Approval
200              
201             =back
202              
203             =head2 B<verification_status>
204              
205             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:
206              
207             =over 4
208              
209             =item Verified
210              
211             =item Pending
212              
213             =item Suspended
214              
215             =back
216              
217             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>.
218              
219             =head2 B<ns>
220              
221             ArrayRef of Domain Names that are the authorizative nameservers for this domain.
222              
223             =head2 B<registrant_contact_id>
224              
225             A L<Contact|WWW::LogicBoxes::Contact> id for the Registrant.
226              
227             =head2 B<admin_contact_id>
228              
229             A L<Contact|WWW::LogicBoxes::Contact> id for the Admin.
230              
231             =head2 B<technical_contact_id>
232              
233             A L<Contact|WWW::LogicBoxes::Contact> id for the Technical.
234              
235             =head2 B<billing_contact_id>
236              
237             A L<Contact|WWW::LogicBoxes::Contact> id for the Billing.
238              
239             =head2 B<epp_key>
240              
241             The secret key needed in order to transfer a domain to another registrar, if it has been provided. Predicate of has_epp_key.
242              
243             =head2 private_nameserves
244              
245             ArrayRef of L<WWW::LogicBoxes::PrivateNameServer> objects that contains any created private name servers. Predicate of has_private_nameservers.
246              
247             =head1 METHODS
248              
249             These methods are used internally, it's fairly unlikely that consumers will ever call them directly.
250              
251             =head2 construct_from_response
252              
253             my $logic_boxes = WWW::LogicBoxes->new( ... );
254              
255             my $response = $logic_boxes->submit({
256             method => 'domains__details_by_name',
257             params => {
258             'domain-name' => 'test-domain.com',
259             'options' => [qw( All )],
260             },
261             });
262              
263             my $domain = WWW::LogicBoxes::DomainTransfer->construct_from_response( $response );
264              
265             Constructs an instance of $self from a L<LogicBoxes|http://www.logicboxes.com> response.
266              
267             =cut