DRI/Protocol/Gandi/WS/Domain.pm

filter: Statementstmt 24.2% 16 / 66 Branchbran 0.0% 0 / 26 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 45.4% 5 / 11 Podpod 0.0% 0 / 6 totaltotal 17.6% 21 / 119 CC 16 SCAR 35.3
CC
16
Cov
16%
info_parse
72.0
build_msg
30.0
check_parse
30.0
CRAP 34.1
« DRI/Protocol/EPP/Extensions/CloudRegistry/LaunchPhase.pm ↑ Summary DRI/Protocol/EPP/Extensions/AusRegistry/Price.pm »
1 ## Domain Registry Interface, Gandi Web Services Domain commands
2 ##
3 ## Copyright (c) 2008,2009,2013 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::Gandi::WS::Domain;
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 DateTime::Format::ISO8601;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 =pod
26  
27 =head1 NAME
28  
29 Net::DRI::Protocol::Gandi::WS::Domain - Gandi Web Services Domain commands for Net::DRI
30  
31 =head1 DESCRIPTION
32  
33 Please see the README file for details.
34  
35 =head1 SUPPORT
36  
37 For now, support questions should be sent to:
38  
39 E<lt>netdri@dotandco.comE<gt>
40  
41 Please also see the SUPPORT file in the distribution.
42  
43 =head1 SEE ALSO
44  
45 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
46  
47 =head1 AUTHOR
48  
49 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
50  
51 =head1 COPYRIGHT
52  
53 Copyright (c) 2008,2009,2013 Patrick Mevzek <netdri@dotandco.com>.
54 All rights reserved.
55  
56 This program is free software; you can redistribute it and/or modify
57 it under the terms of the GNU General Public License as published by
58 the Free Software Foundation; either version 2 of the License, or
59 (at your option) any later version.
60  
61 See the LICENSE file that comes with this distribution for more details.
62  
63 =cut
64  
65 ####################################################################################################
66  
67 sub register_commands
68 {
69 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
70 0 my %tmp=(
71 info => [\&info, \&info_parse ],
72 check => [\&check, \&check_parse ],
73 );
74  
75 0 return { 'domain' => \%tmp };
76 }
77  
78 sub build_msg
79 {
80 0 ▶ my ($msg,$command,$domain)=@_;
Subroutine build_msg: not called CC=5 SCAR=34.0
Pod undocumented
81 0 ▶ Net::DRI::Exception->die(1,'protocol/gandi/ws',2,'Domain name needed') unless defined($domain) && $domain;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $domain and $domain 0 0 0
Condition0%0/3
defined $domain and $domain
!ll&&!rl&&r
000
MC/DC0%0/2
defined $domain and $domain
defined $domain $domain
Truth table0%0/3
A and B
A= defined $domainB= $domain
ABresult
0X0
100
111
82 0 ▶ Net::DRI::Exception->die(1,'protocol/gandi/ws',10,'Invalid domain name') unless Net::DRI::Util::is_hostname($domain);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::is_hostname($domain) 0 0 0
83  
84 0 ▶ $msg->method($command) if defined($command);
Branch: 1 branch
BranchTrueFalseTotal
if defined $command 0 0 0
85 0 return;
86 }
87  
88 sub info
89 {
90 0 ▶ my ($po,$domain)=@_;
Subroutine info: not called CC=1 SCAR=6.9
Pod undocumented
91 0 my $msg=$po->message();
92 0 build_msg($msg,'domain_info',$domain);
93 0 $msg->params([$domain]);
94 0 return;
95 }
96  
97 sub info_parse
98 {
99 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=8 SCAR=42.8
Pod undocumented
100 0 my $mes=$po->message();
101 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
102  
103 0 my $r=$mes->result();
104 0 ▶ Net::DRI::Exception->die(1,'protocol/gandi/ws',1,'Unexpected reply for domain_info: '.$r) unless (ref($r) eq 'HASH');
Branch: 1 branch
BranchTrueFalseTotal
unless ref $r eq "HASH" 0 0 0
105  
106 0 my %r=%$r;
107 0 $rinfo->{domain}->{$oname}->{action}='info';
108 0 $rinfo->{domain}->{$oname}->{exist}=1;
109 0 my %d=(registry_creation_date => 'crDate', registry_last_update => 'upDate', registry_expiration_date => 'exDate', registrar_creation_date => 'trDate');
110 0 ▶ while (my ($k,$v)=each(%d))
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %d) 0 0 0
111 {
112 0 ▶ next unless exists($r{$k});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $r{$k} 0 0 0
113 0 $rinfo->{domain}->{$oname}->{$v}=$po->parse_iso8601($r{$k});
114 }
115 0 my %c=(owner_handle => 'registrant', admin_handle => 'admin', tech_handle => 'tech', billing_handle => 'billing');
116 0 my $cs=$po->create_local_object('contactset');
117 0 ▶ while (my ($k,$v)=each(%c))
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %c) 0 0 0
118 {
119 0 ▶ next unless exists($r{$k});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $r{$k} 0 0 0
120 0 my $c=$po->create_local_object('contact')->srid($r{$k});
121 0 $cs->add($c,$v);
122 }
123 0 $rinfo->{domain}->{$oname}->{contact}=$cs;
124 0 $rinfo->{domain}->{$oname}->{auth}={pw => $r{authorization_code}};
125  
126 0 ▶ if ($r{locked})
Branch: 1 branch
BranchTrueFalseTotal
if ($r{'locked'}) { } 0 0 0
127 {
128 0 $rinfo->{domain}->{$oname}->{status}=$po->create_local_object('status')->add('clientTransferProhibited'); ## ?
129 } else
130 {
131 0 $rinfo->{domain}->{$oname}->{status}=$po->create_local_object('status')->add('ok');
132 }
133  
134 ## And what about nameservers ? No information in documentation, only separate functions for that: domain_ns_*
135 # $rinfo->{domain}->{$oname}->{ns}=??
136 0 return;
137 }
138  
139 sub check
140 {
141 0 ▶ my ($po,$domain)=@_;
Subroutine check: not called CC=1 SCAR=6.9
Pod undocumented
142 0 my $msg=$po->message();
143 0 build_msg($msg,'domain_available',$domain);
144 0 $msg->params([$domain]);
145 0 return;
146 }
147  
148 sub check_parse
149 {
150 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine check_parse: not called CC=5 SCAR=34.0
Pod undocumented
151 0 my $mes=$po->message();
152 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
153  
154 0 my $r=$mes->result();
155 0 ▶ Net::DRI::Exception->die(1,'protocol/gandi/ws',1,'Unexpected reply for domain_check: '.$r) unless (ref($r) eq 'HASH');
Branch: 1 branch
BranchTrueFalseTotal
unless ref $r eq "HASH" 0 0 0
156  
157 0 $rinfo->{domain}->{$oname}->{action}='check';
158 0 ▶ $rinfo->{domain}->{$oname}->{exist}=(exists($r->{$oname}) && $r->{$oname}==1)? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
exists $r->{$oname} && $r->{$oname} == 1 ? : 0 0 0
Condition0%0/3
exists $r->{$oname} and $r->{$oname} == 1
!ll&&!rl&&r
000
MC/DC0%0/2
exists $r->{$oname} and $r->{$oname} == 1
exists $r->{$oname} $r->{$oname} == 1
Truth table0%0/3
A and B
A= exists $r->{$oname}B= $r->{$oname} == 1
ABresult
0X0
100
111
159 0 return;
160 }
161  
162 ####################################################################################################
163 1 1;
« DRI/Protocol/EPP/Extensions/CloudRegistry/LaunchPhase.pm ↑ Summary DRI/Protocol/EPP/Extensions/AusRegistry/Price.pm »