File Coverage

blib/lib/Net/DRI/Protocol/EPP/Extensions/EURid/Registrar.pm
Criterion Covered Total %
statement 9 37 24.3
branch 0 18 0.0
condition n/a
subroutine 3 7 42.8
pod 0 4 0.0
total 12 66 18.1


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, EURid Registrar EPP extension commands
2             ## (introduced in release 5.6 october 2008)
3             ##
4             ## Copyright (c) 2009,2012,2013 Patrick Mevzek . All rights reserved.
5             ##
6             ## This file is part of Net::DRI
7             ##
8             ## Net::DRI is free software; you can redistribute it and/or modify
9             ## it under the terms of the GNU General Public License as published by
10             ## the Free Software Foundation; either version 2 of the License, or
11             ## (at your option) any later version.
12             ##
13             ## See the LICENSE file that comes with this distribution for more details.
14             ####################################################################################################
15              
16             package Net::DRI::Protocol::EPP::Extensions::EURid::Registrar;
17              
18 1     1   694 use strict;
  1         2  
  1         22  
19 1     1   4 use warnings;
  1         1  
  1         18  
20              
21 1     1   2 use Net::DRI::Util;
  1         1  
  1         316  
22              
23             =pod
24              
25             =head1 NAME
26              
27             Net::DRI::Protocol::EPP::Extensions::EURid::Registrar - EURid EPP Registrar extension commands for Net::DRI
28              
29             =head1 DESCRIPTION
30              
31             Please see the README file for details.
32              
33             =head1 SUPPORT
34              
35             For now, support questions should be sent to:
36              
37             Enetdri@dotandco.comE
38              
39             Please also see the SUPPORT file in the distribution.
40              
41             =head1 SEE ALSO
42              
43             Ehttp://www.dotandco.com/services/software/Net-DRI/E
44              
45             =head1 AUTHOR
46              
47             Patrick Mevzek, Enetdri@dotandco.comE
48              
49             =head1 COPYRIGHT
50              
51             Copyright (c) 2009,2012,2013 Patrick Mevzek .
52             All rights reserved.
53              
54             This program is free software; you can redistribute it and/or modify
55             it under the terms of the GNU General Public License as published by
56             the Free Software Foundation; either version 2 of the License, or
57             (at your option) any later version.
58              
59             See the LICENSE file that comes with this distribution for more details.
60              
61             =cut
62              
63             ####################################################################################################
64              
65             sub register_commands
66             {
67 0     0 0   my ($class,$version)=@_;
68 0           my %tmp=(
69             info => [ \&info, \&info_parse ],
70             );
71              
72 0           return { 'registrar' => \%tmp };
73             }
74              
75             sub setup
76             {
77 0     0 0   my ($class,$po,$version)=@_;
78 0           $po->ns({ 'registrar' => [ 'http://www.eurid.eu/xml/epp/registrar-1.0','registrar-1.0.xsd' ] });
79 0           return;
80             }
81              
82             ####################################################################################################
83              
84             sub info
85             {
86 0     0 0   my ($epp,$domain,$rd)=@_;
87 0           my $mes=$epp->message();
88 0           $mes->command('info','registrar:info',sprintf('xmlns:registrar="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('registrar')));
89 0           return;
90             }
91              
92             sub info_parse
93             {
94 0     0 0   my ($po,$otype,$oaction,$oname,$rinfo)=@_;
95 0           my $mes=$po->message();
96 0 0         return unless $mes->is_success();
97              
98 0           my $infdata=$mes->get_response('registrar','infData');
99 0 0         return unless defined $infdata;
100              
101 0           foreach my $el (Net::DRI::Util::xml_list_children($infdata))
102             {
103 0           my ($name,$c)=@$el;
104 0 0         if ($name eq 'amountAvailable')
    0          
    0          
105             {
106 0           $rinfo->{registrar}->{info}->{amount_available}=0+$c->textContent();
107             } elsif ($name eq 'hitPoints')
108             {
109 0           $rinfo->{registrar}->{info}->{hitpoints}={};
110 0           foreach my $sel (Net::DRI::Util::xml_list_children($c))
111             {
112 0           my ($n,$cc)=@$sel;
113 0 0         if ($n eq 'nbrHitPoints')
    0          
    0          
114             {
115 0           $rinfo->{registrar}->{info}->{hitpoints}->{current_number}=0+$cc->textContent();
116             } elsif ($n eq 'maxNbrHitPoints')
117             {
118 0           $rinfo->{registrar}->{info}->{hitpoints}->{maximum_number}=0+$cc->textContent();
119             } elsif ($n eq 'blockedUntil')
120             {
121 0           $rinfo->{registrar}->{info}->{hitpoints}->{blocked_until}=$po->parse_iso8601($cc->textContent());
122             }
123             }
124             } elsif ($name eq 'credits')
125             {
126 0 0         $rinfo->{registrar}->{info}->{credits}->{$c->getAttribute('type')}=($c->textContent() eq '')? undef : 0+$c->textContent();
127             }
128             }
129 0           return;
130             }
131              
132             ####################################################################################################
133             1;