DRI/Protocol/EPP/Extensions/ICANN/RegistrarExpirationDate.pm

filter: Statementstmt 34.0% 16 / 47 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 41.6% 5 / 12 Podpod 0.0% 0 / 7 totaltotal 21.4% 21 / 98 CC 13 SCAR 36.4
CC
13
Cov
22%
build
90.0
parse
20.0
build_update
6.0
CRAP 38.1
« DRI/Protocol/EPP/Extensions/SIDN/Contact.pm ↑ Summary DRI/Protocol/EPP/Extensions/Nomulus/Superuser.pm »
1 ## Domain Registry Interface, Registrar Registration Expiration Date for EPP
2 ##
3 ## Copyright (c) 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::ICANN::RegistrarExpirationDate;
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 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 ####################################################################################################
25  
26 sub register_commands
27 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
28 0 my ($class,$version)=@_;
29 0 state $rmcds = { 'domain' => { 'info' => [ undef, \&parse ],
30 'create' => [ \&build, undef ],
31 'renew' => [ \&build, undef ],
32 'update' => [ \&build_update, undef ],
33 },
34 };
35 0 return $rmcds;
36 }
37  
38  
39 sub setup
40 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
41 0 my ($class,$po,$version)=@_;
42 0 state $rns = { 'rrExDate' => 'urn:ietf:params:xml:ns:rrExDate-1.0' };
43 0 $po->ns($rns);
44 0 return;
45 }
46  
47 0 ▶sub capabilities_add { state $rcaps = ['domain_update','registrar_expiration_date',['set']]; return $rcaps; }
Subroutine capabilities_add: not called CC=1 SCAR=6.9
Pod undocumented
48  
49 0 ▶sub implements { return 'https://tools.ietf.org/html/draft-lozano-ietf-regext-registrar-expiration-date-00'; }
Subroutine implements: not called CC=1 SCAR=6.9
Pod undocumented
50  
51 ####################################################################################################
52  
53 sub parse
54 0 ▶{
Subroutine parse: not called CC=4 SCAR=30.0
Pod undocumented
55 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
56 0 my $mes=$po->message();
57 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
58  
59 0 my $ns = $mes->ns('rrExDate');
60 0 my $data = $mes->get_extension('rrExDate', 'rrExDateData');
61 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
62  
63 0 $data = Net::DRI::Util::xml_traverse($data, $ns, 'syncRyRrExpDate');
64 0 my $sync = Net::DRI::Util::xml_parse_boolean($data->getAttribute('flag'));
65 0 ▶ $rinfo->{$otype}->{$oname}->{registrar_expiration_date} = $sync ? 'sync' : $po->parse_iso8601(Net::DRI::Util::xml_child_content($data, $ns, 'exDate'));
Branch: 1 branch
BranchTrueFalseTotal
$sync ? : 0 0 0
66  
67 0 return;
68 }
69  
70 sub build
71 0 ▶{
Subroutine build: not called CC=9 SCAR=45.0
Pod undocumented
72 0 my ($epp,$domain,$rd)=@_;
73  
74 0 ▶ return unless Net::DRI::Util::has_key($rd,'registrar_expiration_date');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rd, "registrar_expiration_date") 0 0 0
75 0 my $date = $rd->{'registrar_expiration_date'};
76 0 ▶ $date = $date->clone()->set_time_zone('UTC')->strftime('%FT%T.%1NZ') if (ref $date && Net::DRI::Util::check_isa($date,'DateTime'));
Branch: 1 branch
BranchTrueFalseTotal
if ref $date and Net::DRI::Util::check_isa($date, "DateTime") 0 0 0
Condition0%0/3
ref $date and Net::DRI::Util::check_isa($date, "DateTime")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $date and Net::DRI::Util::check_isa($date, "DateTime")
ref $date Net::DRI::Util::check_isa($date, "DateTime")
Truth table0%0/3
A and B
A= ref $dateB= Net::DRI::Util::check_isa($date, "DateTime")
ABresult
0X0
100
111
77 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid date specification for "registrar_expiration_date": '.$date) unless $date eq '' || $date eq 'sync' || $date=~m/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $date eq "" or $date eq "sync" or $date =~ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/ 0 0 0
Condition0%0/6
$date eq "" or $date eq "sync" or $date =~ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/
l!l&&r!l&&!r
000
$date eq "" or $date eq "sync"
l!l&&r!l&&!r
000
MC/DC0%0/3
$date eq "" or $date eq "sync" or $date =~ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/
$date eq "" $date eq "sync" $date =~ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/
Truth table0%0/4
A or B or C
A= $date eq ""B= $date eq "sync"C= $date =~ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/
ABCresult
1XX1
01X1
0011
0000
78  
79 0 ▶ $epp->message()->command_extension('rrExDate', ['rrExDateData', [ 'rrExDate:syncRyRrExpDate', { flag => $date eq 'sync' ? 1 : 0}, $date=~m/^\d{4}/ ? [ 'rrExDate:exDate', $date ] : () ]]);
Branch: 2 branches
BranchTrueFalseTotal
$date eq 'sync' ? : 0 0 0
$date =~ /^\d{4}/ ? : 0 0 0
80  
81 0 return;
82 }
83  
84 sub build_update
85 0 ▶{
Subroutine build_update: not called CC=2 SCAR=17.9
Pod undocumented
86 0 my ($epp,$domain,$todo)=@_;
87 0 my $toset=$todo->set('registrar_expiration_date');
88 0 ▶ return unless defined $toset;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $toset 0 0 0
89 0 return build($epp,$domain,{registrar_expiration_date => $toset});
90 }
91  
92 ####################################################################################################
93 1 1;
94  
95 __END__
« DRI/Protocol/EPP/Extensions/SIDN/Contact.pm ↑ Summary DRI/Protocol/EPP/Extensions/Nomulus/Superuser.pm »