File Coverage

blib/lib/Net/DRI/Protocol/EPP/Extensions/CentralNic/WebForwarding.pm
Criterion Covered Total %
statement 6 33 18.1
branch 0 10 0.0
condition 0 3 0.0
subroutine 2 6 33.3
pod 0 4 0.0
total 8 56 14.2


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, CentralNic Web Forwarding EPP extension
2             ## (http://labs.centralnic.com/epp/ext/wf.php)
3             ##
4             ## Copyright (c) 2007,2008,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::CentralNic::WebForwarding;
17              
18 1     1   664 use strict;
  1         2  
  1         22  
19 1     1   3 use warnings;
  1         1  
  1         270  
20              
21             =pod
22              
23             =head1 NAME
24              
25             Net::DRI::Protocol::EPP::Extensions::CentralNic::WebForwarding - EPP WebForwarding CentralNic extension commands for Net::DRI
26              
27             =head1 DESCRIPTION
28              
29             Please see the README file for details.
30              
31             =head1 SUPPORT
32              
33             For now, support questions should be sent to:
34              
35             Enetdri@dotandco.comE
36              
37             Please also see the SUPPORT file in the distribution.
38              
39             =head1 SEE ALSO
40              
41             Ehttp://www.dotandco.com/services/software/Net-DRI/E
42              
43             =head1 AUTHOR
44              
45             Patrick Mevzek, Enetdri@dotandco.comE
46              
47             =head1 COPYRIGHT
48              
49             Copyright (c) 2007,2008,2013 Patrick Mevzek .
50             All rights reserved.
51              
52             This program is free software; you can redistribute it and/or modify
53             it under the terms of the GNU General Public License as published by
54             the Free Software Foundation; either version 2 of the License, or
55             (at your option) any later version.
56              
57             See the LICENSE file that comes with this distribution for more details.
58              
59             =cut
60              
61             ####################################################################################################
62              
63             sub register_commands
64             {
65 0     0 0   my ($class,$version)=@_;
66 0           my %tmp=( create => [ \&create ],
67             update => [ \&update ],
68             info => [ undef, \&info_parse ],
69             );
70 0           return { 'domain' => \%tmp };
71             }
72              
73             ####################################################################################################
74             ########### Query commands
75              
76             sub info_parse
77             {
78 0     0 0   my ($po,$otype,$oaction,$oname,$rinfo)=@_;
79 0           my $mes=$po->message();
80 0 0         return unless $mes->is_success();
81              
82 0           my $infdata=$mes->get_extension('wf','infData');
83 0 0         return unless $infdata;
84              
85 0           my @c=$infdata->getChildrenByTagNameNS($mes->ns('wf'),'url');
86 0 0         return unless @c;
87              
88 0           $rinfo->{domain}->{$oname}->{web_forwarding}=$c[0]->getFirstChild()->getData();
89 0           return;
90             }
91              
92             ############ Transform commands
93              
94             sub create
95             {
96 0     0 0   my ($epp,$domain,$rd)=@_;
97 0           my $mes=$epp->message();
98              
99 0 0 0       return unless (exists($rd->{web_forwarding}) && defined($rd->{web_forwarding}));
100              
101 0           my $eid=$mes->command_extension_register('wf:create',sprintf('xmlns:wf="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('wf')));
102 0           my @n=(['wf:url',$rd->{web_forwarding}]);
103 0           $mes->command_extension($eid,\@n);
104 0           return;
105             }
106              
107             sub update
108             {
109 0     0 0   my ($epp,$domain,$todo)=@_;
110 0           my $mes=$epp->message();
111              
112 0           my $toset=$todo->set('web_forwarding');
113 0 0         return unless defined($toset);
114              
115 0           my $eid=$mes->command_extension_register('wf:update',sprintf('xmlns:wf="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('wf')));
116 0           my @n=(['wf:url',$toset]);
117 0           $mes->command_extension($eid,\@n);
118 0           return;
119             }
120              
121             ####################################################################################################
122             1;