DRI/Protocol/EPP/Extensions/GracePeriod.pm

filter: Statementstmt 21.3% 13 / 61 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.5% 17 / 117 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-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::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-2019 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 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
67 0 my ($class,$version)=@_;
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 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
80 0 my ($class,$po,$version)=@_;
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 0 ▶{
Subroutine info_parse: not called CC=4 SCAR=30.0
Pod undocumented
90 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
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 0 ▶{
Subroutine update: not called CC=12 SCAR=50.5
Pod undocumented
111 0 my ($epp,$domain,$todo)=@_;
112  
113 0 my $rgp=$todo->set('rgp');
114 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
115  
116 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
117 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
118 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
119  
120 0 my @restore = ({ op => $op }); # this is enough for op=request
121 0 ▶ if ($op eq 'report')
Branch: 1 branch
BranchTrueFalseTotal
if ($op eq "report") 0 0 0
122 {
123 0 my %r=%{$rgp->{report}};
124 0 my $def=$epp->default_parameters();
125 0 my @d;
126 0 push @d,['rgp:preData',$r{predata}]; ## XML data is possible in the RFC, but not here ?!
127 0 push @d,['rgp:postData',$r{postdata}]; ## ditto
128  
129 0 Net::DRI::Util::check_isa($r{deltime},'DateTime');
130 0 push @d,['rgp:delTime',$r{deltime}->strftime('%Y-%m-%dT%T.%1NZ')];
131 0 Net::DRI::Util::check_isa($r{restime},'DateTime');
132 0 push @d,['rgp:resTime',$r{restime}->strftime('%Y-%m-%dT%T.%1NZ')];
133 0 push @d,['rgp:resReason',$r{reason}];
134 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
135 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
136 0 ▶ push @d,['rgp:other',$r{other}] if exists $r{other};
Branch: 1 branch
BranchTrueFalseTotal
if exists $r{"other"} 0 0 0
137 0 push @restore, ['rgp:report', @d];
138 }
139  
140 0 $epp->message()->command_extension('rgp', ['update', ['restore', @restore]]);
141 0 return;
142 }
143  
144 sub update_parse
145 0 ▶{
Subroutine update_parse: not called CC=3 SCAR=24.8
Pod undocumented
146 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
147 0 my $mes=$po->message();
148 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
149  
150 0 my $updata=$mes->get_extension('rgp', 'upData');
151 0 ▶ return unless defined $updata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $updata 0 0 0
152  
153 ## We do nothing, since the rgpStatus alone is useless
154 ## (we do not have the other status)
155 0 return;
156 }
157  
158 ####################################################################################################
159 1 1;
« DRI/Protocol/EPP/Extensions/VeriSign/ZoneManagement.pm ↑ Summary DRI/Protocol/EPP/Extensions/LU/Domain.pm »