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

filter: Statementstmt 32.6% 16 / 49 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.0% 21 / 100 CC 13 SCAR 36.4
CC
13
Cov
21%
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 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 {
28 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
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 {
41 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
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 {
55 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine parse: not called CC=4 SCAR=30.0
Pod undocumented
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 {
72 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine build: not called CC=9 SCAR=45.0
Pod undocumented
73 0 my $mes=$epp->message();
74  
75 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
76 0 my $date = $rd->{'registrar_expiration_date'};
77 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
78 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
79  
80 0 my $eid=$mes->command_extension_register('rrExDate', 'rrExDateData');
81 0 ▶ $mes->command_extension($eid, [ '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
82  
83 0 return;
84 }
85  
86 sub build_update
87 {
88 0 ▶ my ($epp,$domain,$todo)=@_;
Subroutine build_update: not called CC=2 SCAR=17.9
Pod undocumented
89 0 my $toset=$todo->set('registrar_expiration_date');
90 0 ▶ return unless defined $toset;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $toset 0 0 0
91 0 return build($epp,$domain,{registrar_expiration_date => $toset});
92 }
93  
94 ####################################################################################################
95 1 1;
96  
97 __END__
98  
99 =pod
100  
101 =head1 NAME
102  
103 Net::DRI::Protocol::EPP::Extensions::ICANN::RegistrarExpirationDate - ICANN Registrar Registration Expiration Date EPP Extension (draft-lozano-ietf-regext-registrar-expiration-date-00) for Net::DRI
104  
105 =head1 DESCRIPTION
106  
107 Please see the README file for details.
108  
109 =head1 SUPPORT
110  
111 For now, support questions should be sent to:
112  
113 E<lt>netdri@dotandco.comE<gt>
114  
115 Please also see the SUPPORT file in the distribution.
116  
117 =head1 SEE ALSO
118  
119 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
120  
121 =head1 AUTHOR
122  
123 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
124  
125 =head1 COPYRIGHT
126  
127 Copyright (c) 2016,2018 Patrick Mevzek <netdri@dotandco.com>.
128 All rights reserved.
129  
130 This program is free software; you can redistribute it and/or modify
131 it under the terms of the GNU General Public License as published by
132 the Free Software Foundation; either version 2 of the License, or
133 (at your option) any later version.
134  
135 See the LICENSE file that comes with this distribution for more details.
136  
137 =cut
« DRI/Protocol/EPP/Extensions/SIDN/Contact.pm ↑ Summary DRI/Protocol/EPP/Extensions/Nomulus/Superuser.pm »