DRI/Protocol/EPP/Extensions/Nomulus/Superuser.pm

filter: Statementstmt 27.6% 13 / 47 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 44.4% 4 / 9 Podpod 0.0% 0 / 5 totaltotal 18.6% 17 / 91 CC 13 SCAR 36.3
CC
13
Cov
18%
delete
56.0
transfer
56.0
register_commands
2.0
CRAP 37.8
« DRI/Protocol/EPP/Extensions/ICANN/RegistrarExpirationDate.pm ↑ Summary DRI/Protocol/ResultStatus.pm »
1 ## Domain Registry Interface, Nomulus Superuser Extension Mapping for EPP
2 ##
3 ## Copyright (c) 2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
4 ##
5 ## This file is part of Net::DRI
6 ##
7 ## Net::DRI is free software; you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 2 of the License, or
10 ## (at your option) any later version.
11 ##
12 ## See the LICENSE file that comes with this distribution for more details.
13 ####################################################################################################
14  
15 package Net::DRI::Protocol::EPP::Extensions::Nomulus::Superuser;
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use feature 'state';
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 ####################################################################################################
24  
25 sub register_commands
26 {
27 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
28 0 state $cmds = { 'domain' => { delete => [ \&delete, undef ] , 'transfer_request' => [ \&transfer, undef] } };
29 0 return $cmds;
30 }
31  
32 sub setup
33 {
34 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
35 0 state $ns = { 'superuser' => 'urn:google:params:xml:ns:superuser-1.0' };
36 0 $po->ns($ns);
37 0 return;
38 }
39  
40 0 ▶sub implements { return 'https://github.com/google/nomulus/blob/4b83615513a7fafd6bbab6a0b65d1726dede1f7a/java/google/registry/xml/xsd/superuser.xsd'; }
Subroutine implements: not called CC=1 SCAR=6.9
Pod undocumented
41  
42 ####################################################################################################
43  
44 sub delete ## no critic (Subroutines::ProhibitBuiltinHomonyms)
45 {
46 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine delete: not called CC=7 SCAR=40.3
Pod undocumented
47  
48 0 ▶ return unless Net::DRI::Util::has_key($rd, 'superuser') && ref $rd->{'superuser'} eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rd, "superuser") and ref $rd->{"superuser"} eq "HASH" 0 0 0
Condition0%0/3
Net::DRI::Util::has_key($rd, "superuser") and ref $rd->{"superuser"} eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_key($rd, "superuser") and ref $rd->{"superuser"} eq "HASH"
Net::DRI::Util::has_key($rd, "superuser") ref $rd->{"superuser"} eq "HASH"
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rd, "superuser")B= ref $rd->{"superuser"} eq "HASH"
ABresult
0X0
100
111
49 0 my $superuser = $rd->{superuser};
50  
51 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('redemption_grace_period must be defined') unless Net::DRI::Util::has_key($superuser, 'redemption_grace_period');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($superuser, "redemption_grace_period") 0 0 0
52 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('redemption_grace_period must be of type XML nonNegativeInteger') unless Net::DRI::Util::is_class($superuser->{redemption_grace_period}, 'DateTime::Duration');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::is_class($superuser->{"redemption_grace_period"}, "DateTime::Duration") 0 0 0
53 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('pending_delete must be defined') unless Net::DRI::Util::has_key($superuser, 'pending_delete');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($superuser, "pending_delete") 0 0 0
54 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('pending_delete must be of type XML nonNegativeInteger') unless Net::DRI::Util::is_class($superuser->{pending_delete}, 'DateTime::Duration');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::is_class($superuser->{"pending_delete"}, "DateTime::Duration") 0 0 0
55  
56 my @data=(['superuser:redemptionGracePeriodDays', $superuser->{redemption_grace_period}->in_units('days')],
57 0 ['superuser:pendingDeleteDays', $superuser->{pending_delete}->in_units('days')]);
58  
59 0 my $mes=$epp->message();
60 0 my $eid=$mes->command_extension_register('superuser', 'domainDelete');
61 0 $mes->command_extension($eid, \@data);
62 0 return;
63 }
64  
65 sub transfer
66 {
67 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine transfer: not called CC=7 SCAR=40.3
Pod undocumented
68  
69 0 ▶ return unless Net::DRI::Util::has_key($rd, 'superuser') && ref $rd->{'superuser'} eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rd, "superuser") and ref $rd->{"superuser"} eq "HASH" 0 0 0
Condition0%0/3
Net::DRI::Util::has_key($rd, "superuser") and ref $rd->{"superuser"} eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_key($rd, "superuser") and ref $rd->{"superuser"} eq "HASH"
Net::DRI::Util::has_key($rd, "superuser") ref $rd->{"superuser"} eq "HASH"
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rd, "superuser")B= ref $rd->{"superuser"} eq "HASH"
ABresult
0X0
100
111
70 0 my $superuser = $rd->{superuser};
71  
72 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('duration must be defined') unless Net::DRI::Util::has_key($superuser, 'duration');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($superuser, "duration") 0 0 0
73 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('duration must be a DateTime::Duration object') unless Net::DRI::Util::is_class($superuser->{duration}, 'DateTime::Duration');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::is_class($superuser->{"duration"}, "DateTime::Duration") 0 0 0
74 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('transfer_length must be defined') unless Net::DRI::Util::has_key($superuser, 'transfer_length');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($superuser, "transfer_length") 0 0 0
75 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('transfer_length must be of type XML nonNegativeInteger') unless Net::DRI::Util::verify_int($superuser->{transfer_length}, 0); # this does not get until infinity, but should be good enough
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::verify_int($superuser->{"transfer_length"}, 0) 0 0 0
76  
77 0 my $period=Net::DRI::Protocol::EPP::Util::build_period($superuser->{duration});
78 0 $period->[0] = 'superuser:renewalPeriod'; # using "period" like in core EPP would have been too simple...
79  
80 0 my @data=($period, ['superuser:automaticTransferLength', $superuser->{transfer_length}]);
81  
82 0 my $mes=$epp->message();
83 0 my $eid=$mes->command_extension_register('superuser', 'domainTransferRequest');
84 0 $mes->command_extension($eid, \@data);
85 0 return;
86 }
87  
88 ####################################################################################################
89 1 1;
90  
91 __END__
92  
93 =pod
94  
95 =head1 NAME
96  
97 Net::DRI::Protocol::EPP::Extensions::Nomulus::Superuser - EPP Superuser Nomulus Extension mapping for Net::DRI
98  
99 =head1 DESCRIPTION
100  
101 Please see the README file for details.
102  
103 =head1 SUPPORT
104  
105 For now, support questions should be sent to:
106  
107 E<lt>netdri@dotandco.comE<gt>
108  
109 Please also see the SUPPORT file in the distribution.
110  
111 =head1 SEE ALSO
112  
113 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
114  
115 =head1 AUTHOR
116  
117 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
118  
119 =head1 COPYRIGHT
120  
121 Copyright (c) 2017-2018 Patrick Mevzek <netdri@dotandco.com>.
122 All rights reserved.
123  
124 This program is free software; you can redistribute it and/or modify
125 it under the terms of the GNU General Public License as published by
126 the Free Software Foundation; either version 2 of the License, or
127 (at your option) any later version.
128  
129 See the LICENSE file that comes with this distribution for more details.
130  
131 =cut
« DRI/Protocol/EPP/Extensions/ICANN/RegistrarExpirationDate.pm ↑ Summary DRI/Protocol/ResultStatus.pm »