DRI/Protocol/EPP/Extensions/GracePeriod.pm

filter: Statementstmt 20.9% 13 / 62 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 40.0% 4 / 10 Podpod 0.0% 0 / 6 totaltotal 14.4% 17 / 118 CC 17 SCAR 43.4
CC
17
Cov
14%
update
156.0
info_parse
20.0
update_parse
12.0
CRAP 76.8
« DRI/Protocol/EPP/Extensions/VeriSign/ZoneManagement.pm ↑ Summary DRI/Protocol/EPP/Extensions/LU/Domain.pm »
1 ## Domain Registry Interface, EPP Grace Period commands (RFC3915)
2 ##
3 ## Copyright (c) 2005,2006,2008-2010,2013,2016,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::GracePeriod;
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  
20 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 =pod
24  
25 =head1 NAME
26  
27 Net::DRI::Protocol::EPP::Extensions::GracePeriod - EPP Grace Period commands (RFC3915) for Net::DRI
28  
29 =head1 DESCRIPTION
30  
31 Please see the README file for details.
32  
33 =head1 SUPPORT
34  
35 For now, support questions should be sent to:
36  
37 E<lt>netdri@dotandco.comE<gt>
38  
39 Please also see the SUPPORT file in the distribution.
40  
41 =head1 SEE ALSO
42  
43 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
44  
45 =head1 AUTHOR
46  
47 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
48  
49 =head1 COPYRIGHT
50  
51 Copyright (c) 2005,2006,2008-2010,2013,2016,2018 Patrick Mevzek <netdri@dotandco.com>.
52 All rights reserved.
53  
54 This program is free software; you can redistribute it and/or modify
55 it under the terms of the GNU General Public License as published by
56 the Free Software Foundation; either version 2 of the License, or
57 (at your option) any later version.
58  
59 See the LICENSE file that comes with this distribution for more details.
60  
61 =cut
62  
63 ####################################################################################################
64  
65 sub register_commands
66 {
67 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
68 0 my %tmp=(
69 info => [ undef, \&info_parse ],
70 update => [ \&update, \&update_parse ],
71 );
72  
73 0 return { 'domain' => \%tmp };
74 }
75  
76 0 ▶sub capabilities_add { return ('domain_update','rgp',['set']); }
Subroutine capabilities_add: not called CC=1 SCAR=6.9
Pod undocumented
77  
78 sub setup
79 {
80 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
81 0 $po->ns({ 'rgp' => 'urn:ietf:params:xml:ns:rgp-1.0' });
82 0 return;
83 }
84  
85 ####################################################################################################
86 ########### Query commands
87  
88 sub info_parse
89 {
90 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=4 SCAR=30.0
Pod undocumented
91 0 my $mes=$po->message();
92 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
93  
94 0 my $ns=$mes->ns('rgp');
95 0 my $infdata=$mes->get_extension('rgp', 'infData');
96 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
97  
98 0 my $cs=$rinfo->{domain}->{$oname}->{status}; ## a Net::DRI::Protocol::EPP::Core::Status object
99  
100 0 foreach my $el ($infdata->getChildrenByTagNameNS($ns,'rgpStatus'))
101 {
102 0 $cs->add($el->getAttribute('s'));
103 }
104 0 return;
105 }
106  
107 ############ Transform commands
108  
109 sub update
110 {
111 0 ▶ my ($epp,$domain,$todo)=@_;
Subroutine update: not called CC=12 SCAR=50.5
Pod undocumented
112 0 my $mes=$epp->message();
113  
114 0 my $rgp=$todo->set('rgp');
115 0 ▶ return unless (defined $rgp && $rgp && ref $rgp eq 'HASH');
Branch: 1 branch
BranchTrueFalseTotal
unless defined $rgp and $rgp and ref $rgp eq "HASH" 0 0 0
Condition0%0/6
defined $rgp and $rgp and ref $rgp eq "HASH"
!ll&&!rl&&r
000
defined $rgp and $rgp
!ll&&!rl&&r
000
MC/DC0%0/3
defined $rgp and $rgp and ref $rgp eq "HASH"
defined $rgp $rgp ref $rgp eq "HASH"
Truth table0%0/4
A and B and C
A= defined $rgpB= $rgpC= ref $rgp eq "HASH"
ABCresult
0XX0
10X0
1100
1111
116  
117 0 ▶ my $op=$rgp->{op} || '';
Condition0%0/2
$rgp->{'op'} || ''
l!l
00
MC/DC0%0/1
$rgp->{'op'} || ''
$rgp->{'op'}
Truth table0%0/2
A
A= $rgp->{'op'}
Aresult
11
00
118 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('RGP op must be request or report') unless ($op=~m/^(?:request|report)$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $op =~ /^(?:request|report)$/ 0 0 0
119 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Report data must be included if the operation is a report') unless (($op eq 'request') xor exists $rgp->{report});
Branch: 1 branch
BranchTrueFalseTotal
unless $op eq "request" xor exists $rgp->{"report"} 0 0 0
Condition0%0/4
$op eq "request" xor exists $rgp->{"report"}
l&&rl&&!r!l&&r!l&&!r
0000
MC/DC0%0/2
$op eq "request" xor exists $rgp->{"report"}
$op eq "request" exists $rgp->{"report"}
Truth table0%0/4
A xor B
A= $op eq "request"B= exists $rgp->{"report"}
ABresult
110
101
011
000
120  
121 0 my $eid=$mes->command_extension_register('rgp', 'update');
122  
123 0 ▶ if ($op eq 'request')
Branch: 1 branch
BranchTrueFalseTotal
if ($op eq 'request') { } 0 0 0
124 {
125 0 $mes->command_extension($eid,['rgp:restore',{ op => $op }]);
126 } else
127 {
128 0 my %r=%{$rgp->{report}};
129 0 my $def=$epp->default_parameters();
130 0 my @d;
131 0 push @d,['rgp:preData',$r{predata}]; ## XML data is possible in the RFC, but not here ?!
132 0 push @d,['rgp:postData',$r{postdata}]; ## ditto
133  
134 0 Net::DRI::Util::check_isa($r{deltime},'DateTime');
135 0 push @d,['rgp:delTime',$r{deltime}->strftime('%Y-%m-%dT%T.%1NZ')];
136 0 Net::DRI::Util::check_isa($r{restime},'DateTime');
137 0 push @d,['rgp:resTime',$r{restime}->strftime('%Y-%m-%dT%T.%1NZ')];
138 0 push @d,['rgp:resReason',$r{reason}];
139 0 ▶ push @d,['rgp:statement',$r{statement1},exists $r{statement1_lang} ? {lang => $r{statement1_lang}} : ()];
Branch: 1 branch
BranchTrueFalseTotal
exists $r{'statement1_lang'} ? : 0 0 0
140 0 ▶ push @d,['rgp:statement',$r{statement2},exists $r{statement2_lang} ? {lang => $r{statement2_lang}} : ()];
Branch: 1 branch
BranchTrueFalseTotal
exists $r{'statement2_lang'} ? : 0 0 0
141 0 ▶ push @d,['rgp:other',$r{other}] if exists $r{other};
Branch: 1 branch
BranchTrueFalseTotal
if exists $r{"other"} 0 0 0
142 0 $mes->command_extension($eid,['rgp:restore',['rgp:report',@d],{ op => $op }]);
143 }
144 0 return;
145 }
146  
147 sub update_parse
148 {
149 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine update_parse: not called CC=3 SCAR=24.8
Pod undocumented
150 0 my $mes=$po->message();
151 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
152  
153 0 my $updata=$mes->get_extension('rgp', 'upData');
154 0 ▶ return unless defined $updata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $updata 0 0 0
155  
156 ## We do nothing, since the rgpStatus alone is useless
157 ## (we do not have the other status)
158 0 return;
159 }
160  
161 ####################################################################################################
162 1 1;
« DRI/Protocol/EPP/Extensions/VeriSign/ZoneManagement.pm ↑ Summary DRI/Protocol/EPP/Extensions/LU/Domain.pm »