DRI/Protocol/EPP/Extensions/CentralNic/RegType.pm

filter: Statementstmt 29.0% 16 / 55 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 5 / 15 Podpod 0.0% 0 / 8 totaltotal 23.3% 21 / 90 CC 7 SCAR 16.8
CC
7
Cov
24%
_regtype
12.0
info_parse
12.0
_build
6.0
CRAP 5.4
« DRI/Protocol/DAS/AdamsNames/Domain.pm ↑ Summary DRI/Protocol/BookMyName/WS/Account.pm »
1 ## Domain Registry Interface, Registration Type Extension Mapping 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::CentralNic::RegType;
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 $rcmds = { 'domain' => {
30 'check' => [ \&check, undef ],
31 'check_multi' => [ \&check, undef ],
32 'info' => [ undef, \&info_parse ],
33 'create' => [ \&create, undef ],
34 'update' => [ \&update, undef ],
35 },
36 };
37 0 return $rcmds;
38 }
39  
40 sub setup
41 {
42 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
43 0 state $rns = { 'regType' => 'urn:ietf:params:xml:ns:regtype-0.2' };
44 0 $po->ns($rns);
45 0 return;
46 }
47  
48 0 ▶sub capabilities_add { return ('domain_update', 'registration_type', [qw/set/]); }
Subroutine capabilities_add: not called CC=1 SCAR=6.9
Pod undocumented
49  
50 0 ▶sub implements { return 'https://gitlab.centralnic.com/centralnic/epp-registration-type-extension/blob/e210c27730c8926324e502efff4d0ad77190d7c2/draft-brown-regtype.txt'; }
Subroutine implements: not called CC=1 SCAR=6.9
Pod undocumented
51  
52 ####################################################################################################
53  
54 sub _regtype
55 {
56 0 ▶ my ($rd) = @_;
Subroutine _regtype: not called CC=3 SCAR=24.8
57 0 ▶ return unless Net::DRI::Util::has_key($rd, 'registration_type');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rd, "registration_type") 0 0 0
58 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('registration_type must be an XML token with at least one character') unless Net::DRI::Util::xml_is_token($rd->{registration_type},1);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::xml_is_token($rd->{"registration_type"}, 1) 0 0 0
59 0 return $rd->{registration_type};
60 }
61  
62 sub _build
63 {
64 0 ▶ my ($epp,$domain,$rd,$command)=@_;
Subroutine _build: not called CC=2 SCAR=17.9
65 0 my $regtype = _regtype($rd);
66 0 ▶ return unless defined $regtype;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $regtype 0 0 0
67  
68 0 my $mes=$epp->message();
69 0 my $eid=$mes->command_extension_register('regType', $command);
70 0 $mes->command_extension($eid, ['regType:type', $regtype]);
71 0 return;
72 }
73  
74 sub check
75 {
76 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine check: not called CC=1 SCAR=6.9
Pod undocumented
77 0 return _build($epp,$domain,$rd,'check');
78 }
79  
80 sub info_parse
81 {
82 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=3 SCAR=24.8
Pod undocumented
83 0 my $mes=$po->message();
84 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
85  
86 0 my $ns=$mes->ns('regType');
87 0 my $data=$mes->get_extension('regType', 'infData');
88 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
89  
90 0 $rinfo->{domain}->{$oname}->{registration_type}=Net::DRI::Util::xml_child_content($data, $ns, 'type');
91  
92 0 return;
93 }
94  
95 sub create
96 {
97 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine create: not called CC=1 SCAR=6.9
Pod undocumented
98 0 return _build($epp,$domain,$rd,'create');
99 }
100  
101 sub update
102 {
103 0 ▶ my ($epp,$domain,$todo)=@_;
Subroutine update: not called CC=2 SCAR=17.9
Pod undocumented
104  
105 0 my $regtype = _regtype({ registration_type => $todo->set('registration_type') });
106 0 ▶ return unless defined $regtype;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $regtype 0 0 0
107  
108 0 my $mes=$epp->message();
109 0 my $eid=$mes->command_extension_register('regType', 'update');
110 0 $mes->command_extension($eid, ['regType:chg',['regType:type', $regtype]]);
111 0 return;
112 }
113  
114 ####################################################################################################
115 1 1;
116  
117 __END__
118  
119 =pod
120  
121 =head1 NAME
122  
123 Net::DRI::Protocol::EPP::Extensions::CentralNic::RegType - EPP Registration Type Extension mapping (draft-brown-epp-regtype-00) for Net::DRI
124  
125 =head1 DESCRIPTION
126  
127 Please see the README file for details.
128  
129 =head1 SUPPORT
130  
131 For now, support questions should be sent to:
132  
133 E<lt>netdri@dotandco.comE<gt>
134  
135 Please also see the SUPPORT file in the distribution.
136  
137 =head1 SEE ALSO
138  
139 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
140  
141 =head1 AUTHOR
142  
143 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
144  
145 =head1 COPYRIGHT
146  
147 Copyright (c) 2016,2018 Patrick Mevzek <netdri@dotandco.com>.
148 All rights reserved.
149  
150 This program is free software; you can redistribute it and/or modify
151 it under the terms of the GNU General Public License as published by
152 the Free Software Foundation; either version 2 of the License, or
153 (at your option) any later version.
154  
155 See the LICENSE file that comes with this distribution for more details.
156  
157 =cut
« DRI/Protocol/DAS/AdamsNames/Domain.pm ↑ Summary DRI/Protocol/BookMyName/WS/Account.pm »