DRI/Protocol/EPP/Extensions/AllocationToken.pm

filter: Statementstmt 33.3% 16 / 48 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 45.4% 5 / 11 Podpod 0.0% 0 / 6 totaltotal 24.4% 21 / 86 CC 10 SCAR 34.4
CC
10
Cov
24%
command
72.0
info_parse
12.0
register_commands
2.0
CRAP 31.2
« DRI/Protocol/RRP/Connection.pm ↑ Summary DRI/Transport/SOAP.pm »
1 ## Allocation Token Mapping for EPP (RFC8495)
2 ##
3 ## Copyright (c) 2015,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::AllocationToken;
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  
30 0 state $rd = { info => [ \&command, \&info_parse ] };
31 0 $rd->{check} = $rd->{check_multi} = $rd->{create} = $rd->{transfer_request} = [ \&command, undef ];
32  
33 0 state $cmds = { 'domain' => $rd };
34 0 return $cmds;
35 }
36  
37 0 ▶sub capabilities_add { return ['domain_update','allocation_token',['set']]; }
Subroutine capabilities_add: not called CC=1 SCAR=6.9
Pod undocumented
38  
39 sub setup
40 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
41 0 my ($class,$po,$version)=@_;
42  
43 0 state $ns = { 'allocationToken' => 'urn:ietf:params:xml:ns:allocationToken-1.0' };
44 0 $po->ns($ns);
45 0 return;
46 }
47  
48 0 ▶sub implements { return 'https://tools.ietf.org/html/rfc8495'; }
Subroutine implements: not called CC=1 SCAR=6.9
Pod undocumented
49  
50 ####################################################################################################
51  
52 sub command
53 0 ▶{
Subroutine command: not called CC=8 SCAR=42.8
Pod undocumented
54 0 my ($epp,$domain,$rd)=@_;
55 0 my $mes=$epp->message();
56 0 my $operation=$mes->operation()->[1];
57 0 my $token;
58  
59 0 ▶ if ($operation eq 'info')
Branch: 1 branch
BranchTrueFalseTotal
if ($operation eq 'info') { } 0 0 0
60 {
61 0 ▶ return unless Net::DRI::Util::has_key($rd,'allocation_token') && $rd->{allocation_token}; ## any true value will be enough for us here
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rd, "allocation_token") and $rd->{"allocation_token"} 0 0 0
Condition0%0/3
Net::DRI::Util::has_key($rd, "allocation_token") and $rd->{"allocation_token"}
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_key($rd, "allocation_token") and $rd->{"allocation_token"}
Net::DRI::Util::has_key($rd, "allocation_token") $rd->{"allocation_token"}
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rd, "allocation_token")B= $rd->{"allocation_token"}
ABresult
0X0
100
111
62 } else
63 {
64 0 $token = $epp->extract_argument('allocation_token', $rd);
65 0 ▶ return unless defined $token;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $token 0 0 0
66 }
67  
68 0 ▶ my @d = ($operation eq 'info' ? 'info' : 'allocationToken');
Branch: 1 branch
BranchTrueFalseTotal
$operation eq 'info' ? : 0 0 0
69 0 ▶ if (defined $token)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $token) 0 0 0
70 {
71 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid syntax for allocation token: '.$token) unless Net::DRI::Util::xml_is_token($token, 1);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::xml_is_token($token, 1) 0 0 0
72 0 push @d, $token;
73 }
74  
75 0 $mes->command_extension('allocationToken', \@d);
76  
77 0 return;
78 }
79  
80 sub info_parse
81 0 ▶{
Subroutine info_parse: not called CC=3 SCAR=24.8
Pod undocumented
82 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
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 $data=$mes->get_extension('allocationToken','allocationToken');
87 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
88 0 $rinfo->{domain}->{$oname}->{allocation_token}=$data->textContent();
89  
90 0 return;
91 }
92  
93 ####################################################################################################
94 1 1;
95  
96 __END__
« DRI/Protocol/RRP/Connection.pm ↑ Summary DRI/Transport/SOAP.pm »