blib/lib/WWW/eNom/Role/Command/Service.pm

filter: Statementstmt 19.4% 33 / 170 Branchbran 0.0% 0 / 60 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 27.7% 10 / 36 Podpod 100% 10 / 10 totaltotal 18.8% 53 / 281 CC 32 SCAR 27.1
CC
32
Cov
14%
__ANON__
30.0
__ANON__
30.0
__ANON__
30.0
CRAP 15.0
« blib/lib/WWW/eNom/Role/Command/Domain.pm ↑ Summary blib/lib/WWW/eNom/Role/Command/Domain/Registration.pm »
1 package WWW::eNom::Role::Command::Service;
2  
3 44 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 44 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 44 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 44 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 44 ▶use WWW::eNom::Types qw( Bool Domain DomainName PositiveInt );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 44 ▶use DateTime::Format::DateParse;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 44 ▶use Math::Currency;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 44 ▶use POSIX qw( ceil );
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 44 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 44 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 44 requires 'submit', '_set_domain_auto_renew', 'get_domain_by_name';
19  
20 44 our $VERSION = 'v2.0.0'; # VERSION
21 # ABSTRACT: Addon Services That Can Be Purchased
22  
23 sub get_domain_privacy_wholesale_price {
24 0 ▶ my $self = shift;
Subroutine get_domain_privacy_wholesale_price: not called CC=1 SCAR=6.9
Pod documented
25  
26 return try {
27 0 ▶ my $response = $self->submit({
Subroutine __ANON__: not called CC=3 SCAR=24.8
28 method => 'PE_GetProductPrice',
29 params => {
30 ProductType => 72,
31 },
32 });
33  
34 0 ▶ if( $response->{ErrCount} > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->{"ErrCount"} > 0) 0 0 0
35 0 croak 'Unknown error';
36 }
37  
38 0 ▶ if( !exists $response->{productprice}{price} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $response->{"productprice"}{"price"}) 0 0 0
39 0 croak 'Response did not contain price info';
40 }
41  
42 0 return Math::Currency->new( $response->{productprice}{price} );
43 }
44 catch {
45 0 ▶ croak $_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
46 0 };
47 }
48  
49 sub purchase_domain_privacy_for_domain {
50 0 ▶ my $self = shift;
Subroutine purchase_domain_privacy_for_domain: not called CC=1 SCAR=6.9
Pod documented
51 0 my ( %args ) = validated_hash(
52 \@_,
53 domain_name => { isa => DomainName },
54 years => { isa => PositiveInt, default => 1 },
55 is_auto_renew => { isa => Bool, default => 0 },
56 );
57  
58 return try {
59 my $response = $self->submit({
60 method => 'PurchaseServices',
61 params => {
62 Service => 'WPPS',
63 Domain => $args{domain_name},
64 NumYears => $args{years},
65 0 ▶ RenewName => ( $args{is_auto_renew} ? 1 : 0 ),
Subroutine __ANON__: not called CC=5 SCAR=34.0
Branch: 1 branch
BranchTrueFalseTotal
$args{'is_auto_renew'} ? : 0 0 0
66 }
67 });
68  
69 0 ▶ if( $response->{ErrCount} > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->{"ErrCount"} > 0) 0 0 0
70 0 ▶ if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq "Domain name not found";} @{$$response{"errors"};}) 0 0 0
71 0 croak 'Domain not found in your account';
72 }
73  
74 0 ▶ if( grep { $_ eq 'ID Protection is already active for this domain' } @{ $response->{errors} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq "ID Protection is already active for this domain";} @{$$response{"errors"};}) 0 0 0
75 0 croak 'Domain privacy is already purchased for this domain';
76 }
77  
78 0 croak 'Unknown error';
79 }
80  
81 0 return $response->{OrderID};
82 }
83 catch {
84 0 ▶ croak $_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
85 0 };
86 }
87  
88 sub get_is_privacy_purchased_by_name {
89 0 ▶ my $self = shift;
Subroutine get_is_privacy_purchased_by_name: not called CC=1 SCAR=6.9
Pod documented
90 0 my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } );
91  
92 return try {
93 0 ▶ my $response = $self->submit({
Subroutine __ANON__: not called CC=3 SCAR=24.8
94 method => 'GetWPPSInfo',
95 params => {
96 Domain => $domain_name
97 }
98 });
99  
100 0 ▶ if( $response->{ErrCount} > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->{"ErrCount"} > 0) 0 0 0
101 0 ▶ if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq "Domain name not found";} @{$$response{"errors"};}) 0 0 0
102 0 croak 'Domain not found in your account';
103 }
104 }
105  
106 0 return !!( $response->{GetWPPSInfo}{WPPSExists} == 1 );
107 }
108 catch {
109 0 ▶ croak $_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
110 0 };
111 }
112  
113 sub enable_privacy_by_name {
114 0 ▶ my $self = shift;
Subroutine enable_privacy_by_name: not called CC=3 SCAR=24.8
Pod documented
115 0 my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } );
116  
117 0 ▶ if( !$self->get_is_privacy_purchased_by_name( $domain_name ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->get_is_privacy_purchased_by_name($domain_name)) { } 0 0 0
118 0 my $domain = $self->get_domain_by_name( $domain_name );
119 0 my $years = $domain->expiration_date->year - DateTime->now->year;
120 0 ▶ $years == 0 and $years = 1;
Branch: 1 branch
BranchTrueFalseTotal
$years == 0 and $years = 1 0 0 0
121  
122 0 $self->purchase_domain_privacy_for_domain(
123 domain_name => $domain_name,
124 years => $years,
125 is_auto_renew => $domain->is_auto_renew,
126 );
127 }
128 else {
129 try {
130 0 ▶ my $response = $self->submit({
Subroutine __ANON__: not called CC=4 SCAR=30.0
131 method => 'EnableServices',
132 params => {
133 Domain => $domain_name,
134 Service => 'WPPS',
135 }
136 });
137  
138 0 ▶ if( $response->{ErrCount} > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->{"ErrCount"} > 0) 0 0 0
139 0 ▶ if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq "Domain name not found";} @{$$response{"errors"};}) 0 0 0
140 0 croak 'Domain not found in your account';
141 }
142  
143 0 ▶ if( grep { $_ eq 'Unable to activate service for this domain' } @{ $response->{errors} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq "Unable to activate service for this domain";} @{$$response{"errors"};}) 0 0 0
144 # NO OP
145 0 return;
146 }
147  
148 0 croak 'Unknown error';
149 }
150 }
151 catch {
152 0 ▶ croak $_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
153 0 };
154 }
155  
156 0 return $self->get_domain_by_name( $domain_name );
157 }
158  
159 sub disable_privacy_by_name {
160 0 ▶ my $self = shift;
Subroutine disable_privacy_by_name: not called CC=1 SCAR=6.9
Pod documented
161 0 my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } );
162  
163 try {
164 0 ▶ my $response = $self->submit({
Subroutine __ANON__: not called CC=5 SCAR=34.0
165 method => 'DisableServices',
166 params => {
167 Domain => $domain_name,
168 Service => 'WPPS',
169 }
170 });
171  
172 0 ▶ if( $response->{ErrCount} > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->{"ErrCount"} > 0) 0 0 0
173 0 ▶ if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq "Domain name not found";} @{$$response{"errors"};}) 0 0 0
174 0 croak 'Domain not found in your account';
175 }
176  
177 0 ▶ if( ( grep { $_ eq 'ID Protect is not purchased for this domain' } @{ $response->{errors} } )
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq "ID Protect is not purchased for this domain";} @{$$response{"errors"};} or grep {$_ eq "Unable to disable service for this domain";} @{$$response{"errors"};}) 0 0 0
Condition0%0/3
grep {$_ eq "ID Protect is not purchased for this domain";} @{$$response{"errors"};} or grep {$_ eq "Unable to disable service for this domain";} @{$$response{"errors"};}
l!l&&r!l&&!r
000
MC/DC0%0/2
grep {$_ eq "ID Protect is not purchased for this domain";} @{$$response{"errors"};} or grep {$_ eq "Unable to disable service for this domain";} @{$$response{"errors"};}
grep {$_ eq "ID Protect is not purchased for this domain";} @{$$response{"errors"};} grep {$_ eq "Unable to disable service for this domain";} @{$$response{"errors"};}
Truth table0%0/3
A or B
A= grep {$_ eq "ID Protect is not purchased for this domain";} @{$$response{"errors"};}B= grep {$_ eq "Unable to disable service for this domain";} @{$$response{"errors"};}
ABresult
1X1
011
000
178 0 || ( grep { $_ eq 'Unable to disable service for this domain' } @{ $response->{errors} } ) ) {
179 # NO OP
180 0 return;
181 }
182  
183 0 croak 'Unknown error';
184 }
185 }
186 catch {
187 0 ▶ croak $_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
188 0 };
189  
190 0 return $self->get_domain_by_name( $domain_name );
191 }
192  
193 sub get_is_privacy_auto_renew_by_name {
194 0 ▶ my $self = shift;
Subroutine get_is_privacy_auto_renew_by_name: not called CC=1 SCAR=6.9
Pod documented
195 0 my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } );
196  
197 return try {
198 0 ▶ my $response = $self->submit({
Subroutine __ANON__: not called CC=5 SCAR=34.0
199 method => 'GetWPPSInfo',
200 params => {
201 Domain => $domain_name
202 }
203 });
204  
205 0 ▶ if( $response->{ErrCount} > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->{"ErrCount"} > 0) 0 0 0
206 0 ▶ if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq "Domain name not found";} @{$$response{"errors"};}) 0 0 0
207 0 croak 'Domain not found in your account';
208 }
209 }
210  
211 0 ▶ if( $response->{GetWPPSInfo}{WPPSExists} == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->{"GetWPPSInfo"}{"WPPSExists"} == 0) 0 0 0
212 0 croak 'Domain does not have privacy';
213 }
214  
215 0 ▶ if( !$response->{GetWPPSInfo}{WPPSAutoRenew} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($response->{"GetWPPSInfo"}{"WPPSAutoRenew"}) 0 0 0
216 0 croak 'Response did not contain privacy renewal data';
217 }
218  
219 0 return !!( $response->{GetWPPSInfo}{WPPSAutoRenew} eq 'Yes' );
220 }
221 catch {
222 0 ▶ croak $_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
223 0 };
224 }
225  
226 sub get_privacy_expiration_date_by_name {
227 0 ▶ my $self = shift;
Subroutine get_privacy_expiration_date_by_name: not called CC=1 SCAR=6.9
Pod documented
228 0 my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } );
229  
230 return try {
231 0 ▶ my $response = $self->submit({
Subroutine __ANON__: not called CC=5 SCAR=34.0
232 method => 'GetWPPSInfo',
233 params => {
234 Domain => $domain_name
235 }
236 });
237  
238 0 ▶ if( $response->{ErrCount} > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->{"ErrCount"} > 0) 0 0 0
239 0 ▶ if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq "Domain name not found";} @{$$response{"errors"};}) 0 0 0
240 0 croak 'Domain not found in your account';
241 }
242 }
243  
244 0 ▶ if( $response->{GetWPPSInfo}{WPPSExists} == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->{"GetWPPSInfo"}{"WPPSExists"} == 0) 0 0 0
245 0 croak 'Domain does not have privacy';
246 }
247  
248 0 ▶ if( !$response->{GetWPPSInfo}{WPPSExpDate} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($response->{"GetWPPSInfo"}{"WPPSExpDate"}) 0 0 0
249 0 croak 'Response did not contain privacy expiration data';
250 }
251  
252 0 return DateTime::Format::DateParse->parse_datetime( $response->{GetWPPSInfo}{WPPSExpDate} );
253 }
254 catch {
255 0 ▶ croak $_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
256 0 };
257 }
258  
259 sub enable_privacy_auto_renew_for_domain {
260 0 ▶ my $self = shift;
Subroutine enable_privacy_auto_renew_for_domain: not called CC=2 SCAR=17.9
Pod documented
261 0 my ( $domain ) = pos_validated_list( \@_, { isa => Domain } );
262  
263 0 my $current_is_privacy_auto_renew = $self->get_is_privacy_auto_renew_by_name( $domain->name );
264 0 ▶ if( $current_is_privacy_auto_renew ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current_is_privacy_auto_renew) 0 0 0
265 0 return $domain;
266 }
267  
268 0 return $self->_set_domain_auto_renew({
269 domain_name => $domain->name,
270 is_auto_renew => $domain->is_auto_renew,
271 privacy_is_auto_renew => 1,
272 });
273 }
274  
275 sub disable_privacy_auto_renew_for_domain {
276 0 ▶ my $self = shift;
Subroutine disable_privacy_auto_renew_for_domain: not called CC=2 SCAR=17.9
Pod documented
277 0 my ( $domain ) = pos_validated_list( \@_, { isa => Domain } );
278  
279 0 my $current_is_privacy_auto_renew = $self->get_is_privacy_auto_renew_by_name( $domain->name );
280 0 ▶ if( !$current_is_privacy_auto_renew ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($current_is_privacy_auto_renew) 0 0 0
281 0 return $domain;
282 }
283  
284 0 return $self->_set_domain_auto_renew({
285 domain_name => $domain->name,
286 is_auto_renew => $domain->is_auto_renew,
287 privacy_is_auto_renew => 0,
288 });
289 }
290  
291 sub renew_privacy {
292 0 ▶ my $self = shift;
Subroutine renew_privacy: not called CC=1 SCAR=6.9
Pod documented
293 0 my ( %args ) = validated_hash(
294 \@_,
295 domain_name => { isa => DomainName },
296 years => { isa => PositiveInt },
297 );
298  
299 return try {
300 my $response = $self->submit({
301 method => 'RenewServices',
302 params => {
303 Service => 'WPPS',
304 Domain => $args{domain_name},
305 NumYears => $args{years},
306 }
307 0 ▶ });
Subroutine __ANON__: not called CC=5 SCAR=34.0
308  
309 0 ▶ if( $response->{ErrCount} > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->{"ErrCount"} > 0) 0 0 0
310 0 ▶ if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq "Domain name not found";} @{$$response{"errors"};}) 0 0 0
311 0 croak 'Domain not found in your account';
312 }
313  
314 0 ▶ if( grep { $_ eq 'Unable to renew ID Protect for this domain.' } @{ $response->{errors} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq "Unable to renew ID Protect for this domain.";} @{$$response{"errors"};}) 0 0 0
315 0 croak 'Domain does not have privacy';
316 }
317  
318 0 ▶ if( grep { $_ =~ qr/The number of years cannot/ } @{ $response->{errors} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ =~ qr/The number of years cannot/;} @{$$response{"errors"};}) 0 0 0
319 0 croak 'Requested renewal too long';
320 }
321  
322 0 croak 'Unknown error';
323 }
324  
325 0 return $response->{OrderID};
326 }
327 catch {
328 0 ▶ croak $_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
329 0 };
330 }
331  
332 44 1;
333  
334 __END__
335  
336 =pod
337  
338 =head1 NAME
339  
340 WWW::eNom::Role::Command::Service - Addon Services That Can Be Purchased
341  
342 =head1 SYNOPSIS
343  
344 use WWW::eNom;
345  
346 my $api = WWW::eNom->new( ... );
347  
348 # Get wholesale price for Domain privacy
349 my $domain_privacy_wholesale_price = $api->get_domain_privacy_wholesale_price();
350  
351 # Purchase Domain Privacy
352 my $order_id = $api->purchase_domain_privacy_for_domain( 'drzigman.com' );
353  
354 # Get If Privacy Has Been Purchased
355 my $is_privacy_purchased = $api->get_is_privacy_purchased_by_name( 'drzigman.com' );
356  
357 # Enable Domain Privacy
358 my $updated_domain = $api->enable_privacy_by_name( 'drzigman.com' );
359  
360 # Disable Domain Privacy
361 my $updated_domain = $api->disable_privacy_by_name( 'drzigman.com' );
362  
363 # Get Privacy Expiration Date
364 my $privacy_expiration_date = $api->get_privacy_expiration_date_by_name( 'drzigman.com' );
365  
366 # Get is Privacy Auto Renew
367 my $is_privacy_auto_renew = $api->get_is_privacy_auto_renew_by_name( 'drzigman.com' );
368  
369 my $domain = WWW::eNom::Domain->new( ... );
370  
371 # Enable Auto Renew for Domain Privacy
372 my $updated_domain = $api->enable_privacy_auto_renew_for_domain( $domain );
373  
374 # Disable Auto Renew for Domain Privacy
375 my $updated_domain = $api->disable_privacy_auto_renew_for_domain( $domain );
376  
377 # Renew Domain privacy
378 my $order_id = $api->renew_privacy({
379 domain_name => 'drzigman.com',
380 years => 1,
381 });
382  
383 =head1 REQUIRES
384  
385 =over 4
386  
387 =item submit
388  
389 =back
390  
391 =head1 DESCRIPTION
392  
393 Implements addon service related API calls (such as L<WPPS Service|https://www.enom.com/api/Value%20Added%20Topics/ID%20Protect.htm>, what eNom calls Privacy Protection).
394  
395 =head1 METHODS
396  
397 =head2 get_domain_privacy_wholesale_price
398  
399 use Math::Currency;
400  
401 my $domain_privacy_wholesale_price = $api->get_domain_privacy_wholesale_price();
402  
403 Returns the wholesale price per year (the price you as the reseller pay, not what you want to charge your customers) for domain privacy as a Math::Currency object.
404  
405 =head2 purchase_domain_privacy_for_domain
406  
407 # Be sure to wrap this in a try/catch block, presented here for clarity
408 my $order_id = $api->purchase_domain_privacy_for_domain( 'drzigman.com' );
409  
410 Abstraction of the L<PurchaseServices for ID Protect|https://www.enom.com/api/API%20topics/api_PurchaseServices.htm#input> eNom API Call. Given a FQDN, attempts to purchase Domain Privacy for the specified domain. On success, the OrderID of this purchase is returned.
411  
412 There are several reason this method could fail and croak.
413  
414 =over 4
415  
416 =item Domain not found in account
417  
418 =item Domain privacy is already purchased for this domain
419  
420 =item Unknown error
421  
422 This is almost always caused by attempting to add privacy protection to a public suffix that does not support it.
423  
424 =back
425  
426 Noting this, consumers should take care to ensure safe handling of these potential errors.
427  
428 =head2 get_is_privacy_purchased_by_name
429  
430 my $is_privacy_purchased = $api->get_is_privacy_purchased_by_name( 'drzigman.com' );
431  
432 Abstraction of the L<GetWPPSInfo|https://www.enom.com/api/API%20topics/api_GetWPPSInfo.htm> eNom API Call. Given a FQDN, returns a truthy value if privacy has been purchased B<regardless of if it is active or not> and a falsey value if privacy has not been purchased B<regardless of it is active or not>.
433  
434 If the domain is not registered or is registered to someone else this method will croak.
435  
436  
437 =head2 enable_privacy_by_name
438  
439 my $updated_domain = $api->enable_privacy_by_name( 'drzigman.com' );
440  
441 Abstraction of the L<EnableServices|https://www.enom.com/api/API%20topics/api_EnableServices.htm> eNom API Call. Given a FQDN, enables Domain Privacy for it. If privacy is already active this method is effectively a NO OP. B<If domain privacy has not been purchased for this domain, this method will buy and activate it automatically. In this case the auto renew will match that of the domain and enough Domain Privacy will be purchased to cover the registration length remaining>. Domain privacy is not free, so you may wish to check L<get_is_privacy_purchased_by_name> before making this call if you do not wish to purchase privacy.
442  
443 If the domain is not registered or is registered to someone else this method will croak.
444  
445 =head2 disable_privacy_by_name
446  
447 my $updated_domain = $api->disable_privacy_by_name( 'drzigman.com' );
448  
449 Abstraction of the L<DisableServices|https://www.enom.com/api/API%20topics/api_DisableServices.htm> eNom API Call. Given a FQDN, disables Domain Privacy for it. If privacy is not currently active (or if it has never been purchased for this domain) this method is effective a NO OP.
450  
451 If the domain is not registered or is registered to someone else this method will croak.
452  
453 =head2 get_is_privacy_auto_renew_by_name
454  
455 my $is_privacy_auto_renew = $api->get_is_privacy_auto_renew_by_name( 'drzigman.com' );
456  
457 Abstraction of the L<GetWPPSInfo|https://www.enom.com/api/API%20topics/api_GetWPPSInfo.htm> eNom API Call. Given a FQDN, returns a truthy value if auto renew is enabled for domain privacy and a falsey value if auto renew is disabled for domain privacy.
458  
459 If the domain is not registered or is registered to someone else this method will croak.
460  
461 B<NOTE> If the specified domain does not have domain privacy this method will croak with the message 'Domain does not have privacy'.
462  
463 =head2 get_privacy_expiration_date_by_name
464  
465 my $privacy_expiration_date = $api->get_privacy_expiration_date_by_name( 'drzigman.com' );
466  
467 Abstraction of the L<GetWPPSInfo|https://www.enom.com/api/API%20topics/api_GetWPPSInfo.htm> eNom API Call. Given a FQDN, returns a DateTime object representing when domain privacy will expire.
468  
469 If the domain is not registered or is registered to someone else this method will croak.
470  
471 B<NOTE> If the specified domain does not have domain privacy this method will croak with the message 'Domain does not have privacy'.
472  
473 =head2 enable_privacy_auto_renew_for_domain
474  
475 my $domain = WWW::eNom::Domain->new( ... );
476 my $updated_domain = $api->enable_privacy_auto_renew_for_domain( $domain );
477  
478 Abstraction of the L<SetRenew|https://www.enom.com/api/API%20topics/api_SetRenew.htm> eNom API Call. Given an instance of L<WWW::eNom::Domain> enables auto renew of domain privacy. If the domain privacy is already set to auto renew this method is effectively a NO OP.
479  
480 B<NOTE> If the specified domain does not have domain privacy this method will croak with the message 'Domain does not have privacy'.
481  
482 =head2 disable_privacy_auto_renew_for_domain
483  
484 my $domain = WWW::eNom::Domain->new( ... );
485 my $updated_domain = $api->disable_privacy_auto_renew_for_domain( $domain );
486  
487 Abstraction of the L<SetRenew|https://www.enom.com/api/API%20topics/api_SetRenew.htm> eNom API Call. Given an instance of L<WWW::eNom::Domain> disables auto renew of domain privacy. If the domain privacy is already set not to auto renew this method is effectively a NO OP.
488  
489 If the domain is not registered or is registered to someone else this method will croak.
490  
491 B<NOTE> If the specified domain does not have domain privacy this method will croak with the message 'Domain does not have privacy'.
492  
493 =head2 renew_privacy
494  
495 my $order_id = $api->renew_privacy({
496 domain_name => 'drzigman.com',
497 years => 1,
498 });
499  
500 Abstraction of the L<RenewServices|https://www.enom.com/api/API%20topics/api_RenewServices.htm> eNom API Call. Given a FQDN and a number of years, renews domain privacy. Returned is the order id.
501  
502 There are several reasons this method could croak:
503  
504 =over 4
505  
506 =item Requested renewal too long
507  
508 If you request a renewal longer than 10 years.
509  
510 =item Domain does not have privacy
511  
512 If the domain does not have privacy
513  
514 =back
515  
516 If the domain is not registered or is registered to someone else this method will croak.
517  
518 =cut
« blib/lib/WWW/eNom/Role/Command/Domain.pm ↑ Summary blib/lib/WWW/eNom/Role/Command/Domain/Registration.pm »