| 1 | ## Domain Registry Interface, Gandi Web Services Message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2008-2010,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::Message; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 Net::DRI::Protocol::ResultStatus; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use base qw(Class::Accessor::Chained::Fast Net::DRI::Protocol::Message); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | __PACKAGE__->mk_accessors(qw(version method params result errcode errmsg)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | Net::DRI::Protocol::Gandi::WS::Message - Gandi Web Services Message 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-2010,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 new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | my ($class,$trid,$otype,$oaction)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my $self={errcode => undef, errmsg => undef}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | bless($self,$class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | $self->params([]); ## empty default | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | sub as_string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | my ($self)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_string: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my @p=@{$self->params()}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my @pr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | foreach my $i (0..$#p) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | push @pr,sprintf 'PARAM%d=%s',$i+1,$p[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | return sprintf "METHOD=%s\n%s\n",$self->method(),join("\n",@pr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | sub add_session | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | my ($self,$sd)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_session: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my $rp=$self->params(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | unshift(@$rp,$sd->{id}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | sub parse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | my ($self,$dr,$rinfo,$otype,$oaction,$sent)=@_; ## $sent is the original message, we could copy its method/params value into this new message | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my ($res)=@{$dr->data()}; ## $dr is a Data::Raw object, type=1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | if (! defined($res->result()) || $res->fault()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $res->result or $res->fault
MC/DC0%0/2
not defined $res->result or $res->fault
not defined $res->result
$res->fault
Truth table0%0/3
not(A) or B
A= not defined $res->resultB= $res->fault
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $self->result(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | $self->errcode($res->faultcode()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | $self->errmsg($res->faultstring()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $self->result($res->result()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $self->errcode(0); ## probably success | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $self->errmsg('No status/msg given'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | sub is_success { return (shift->errcode()==0)? 1 : 0; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_success: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | ## See https://api.ote.gandi.net/#error_description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | sub result_status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_status: not called CC=18 SCAR=58.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my $code=$self->errcode(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | my $msg=$self->errmsg() || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->errmsg || ''
MC/DC0%0/1
$self->errmsg || ''
$self->errmsg
Truth table0%0/2
A
A= $self->errmsg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my $ok=$self->is_success(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | return Net::DRI::Protocol::ResultStatus->new('gandi_ws',$code,'COMMAND_SUCCESSFUL',1,$msg,'en') if $ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my $eppcode='COMMAND_FAILED'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | if ($code=~m/^1/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $eppcode=2400; ## Command failed | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } elsif ($code=~m/^5/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | if ($code=~m/^5001/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 12 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $eppcode=2200; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } elsif ($code=~m/^5002/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $eppcode=2201; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } elsif ($code=~m/00$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | $eppcode=2400; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | ▶ | } elsif ($code=~m/10$/ || $code=~m/20$/) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$code =~ /10$/ or $code =~ /20$/
MC/DC0%0/2
$code =~ /10$/ or $code =~ /20$/
$code =~ /10$/
$code =~ /20$/
Truth table0%0/3
A or B
A= $code =~ /10$/B= $code =~ /20$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $eppcode=2005; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } elsif ($code=~m/30$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | $eppcode=2004; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } elsif ($code=~m/3[14]$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $eppcode=2306; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } elsif ($code=~m/32$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $eppcode=2003; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } elsif ($code=~m/33$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $eppcode=2308; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } elsif ($code=~m/40$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | $eppcode=2303; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } elsif ($code=~m/41$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $eppcode=2302; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } elsif ($code=~m/50$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $eppcode=2201; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } elsif ($code=~m/60$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | $eppcode=2304; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | return Net::DRI::Protocol::ResultStatus->new('gandi_ws',$code,$eppcode,0,$msg,'en'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | #################################################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||