« DRI/Protocol/EPP/Extensions/CentralNic/AuxContact.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 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 69 | 0 | my ($class,$version)=@_; | |||||||||||||||||||||||||||
| 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 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
build_msg: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 80 | 0 | my ($msg,$command,$domain)=@_; | |||||||||||||||||||||||||||
| 81 | 0 | ▶ | Net::DRI::Exception->die(1,'protocol/gandi/ws',2,'Domain name needed') unless defined($domain) && $domain; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $domain and $domain
MC/DC0%0/2
defined $domain and $domain
defined $domain
$domain
Truth table0%0/3
A and B
A= defined $domainB= $domain
| |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | Net::DRI::Exception->die(1,'protocol/gandi/ws',10,'Invalid domain name') unless Net::DRI::Util::is_hostname($domain); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 0 | ▶ | $msg->method($command) if defined($command); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | 0 | return; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | sub info | ||||||||||||||||||||||||||||
| 89 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
info: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 90 | 0 | my ($po,$domain)=@_; | |||||||||||||||||||||||||||
| 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 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
info_parse: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 99 | 0 | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | |||||||||||||||||||||||||||
| 100 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 101 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 111 | { | ||||||||||||||||||||||||||||
| 112 | 0 | ▶ | next unless exists($r{$k}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 118 | { | ||||||||||||||||||||||||||||
| 119 | 0 | ▶ | next unless exists($r{$k}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
check: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 141 | 0 | my ($po,$domain)=@_; | |||||||||||||||||||||||||||
| 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 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
check_parse: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 150 | 0 | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | |||||||||||||||||||||||||||
| 151 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 152 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
exists $r->{$oname} and $r->{$oname} == 1
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
| |||||||||||||||||||||||||||||
| 159 | 0 | return; | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | #################################################################################################### | ||||||||||||||||||||||||||||
| 163 | 1 | 1; | |||||||||||||||||||||||||||