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

filter: Statementstmt 30.2% 13 / 43 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 19.5% 17 / 87 CC 13 SCAR 36.3
CC
13
Cov
19%
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) 2017-2019 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 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
27 0 my ($class,$version)=@_;
28 0 state $cmds = { 'domain' => { delete => [ \&delete, undef ] , 'transfer_request' => [ \&transfer, undef] } };
29 0 return $cmds;
30 }
31  
32 sub setup
33 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
34 0 my ($class,$po,$version)=@_;
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 0 ▶{
Subroutine delete: not called CC=7 SCAR=40.3
Pod undocumented
46 0 my ($epp,$domain,$rd)=@_;
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 $epp->message()->command_extension('superuser', ['domainDelete', @data]);
60 0 return;
61 }
62  
63 sub transfer
64 0 ▶{
Subroutine transfer: not called CC=7 SCAR=40.3
Pod undocumented
65 0 my ($epp,$domain,$rd)=@_;
66  
67 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
68 0 my $superuser = $rd->{superuser};
69  
70 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
71 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
72 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
73 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
74  
75 0 my $period=Net::DRI::Protocol::EPP::Util::build_period($superuser->{duration});
76 0 $period->[0] = 'superuser:renewalPeriod'; # using "period" like in core EPP would have been too simple...
77  
78 0 my @data=($period, ['superuser:automaticTransferLength', $superuser->{transfer_length}]);
79  
80 0 $epp->message()->command_extension('superuser', ['domainTransferRequest', @data]);
81 0 return;
82 }
83  
84 ####################################################################################################
85 1 1;
86  
87 __END__
« DRI/Protocol/EPP/Extensions/ICANN/RegistrarExpirationDate.pm ↑ Summary DRI/Protocol/ResultStatus.pm »