File Coverage

blib/lib/Net/DRI/Protocol/EPP/Extensions/NeuLevel/UIN.pm
Criterion Covered Total %
statement 9 37 24.3
branch 0 6 0.0
condition 0 3 0.0
subroutine 3 6 50.0
pod 0 3 0.0
total 12 55 21.8


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, EPP Extension for .travel UIN
2             ## (ICANN Sponsored TLD Registry Agreement, Part IV)
3             ##
4             ## Copyright (c) 2008,2013 Tonnerre Lombard .
5             ## All rights reserved.
6             ##
7             ## This file is part of Net::DRI
8             ##
9             ## Net::DRI is free software; you can redistribute it and/or modify
10             ## it under the terms of the GNU General Public License as published by
11             ## the Free Software Foundation; either version 2 of the License, or
12             ## (at your option) any later version.
13             ##
14             ## See the LICENSE file that comes with this distribution for more details.
15             ####################################################################################################
16              
17             package Net::DRI::Protocol::EPP::Extensions::NeuLevel::UIN;
18              
19 1     1   1177 use strict;
  1         1  
  1         41  
20 1     1   5 use warnings;
  1         1  
  1         58  
21              
22 1     1   6 use Net::DRI::Util;
  1         2  
  1         599  
23              
24             =pod
25              
26             =head1 NAME
27              
28             Net::DRI::Protocol::EPP::Extensions::NeuLevel::UIN - EPP Extension for .TRAVEL UIN for Net::DRI
29              
30             =head1 DESCRIPTION
31              
32             Please see the README file for details.
33              
34             =head1 SUPPORT
35              
36             For now, support questions should be sent to:
37              
38             Etonnerre.lombard@sygroup.chE
39              
40             Please also see the SUPPORT file in the distribution.
41              
42             =head1 SEE ALSO
43              
44             Ehttp://oss.bsdprojects.net/projects/netdri/E
45              
46             =head1 AUTHOR
47              
48             Tonnerre Lombard, Etonnerre.lombard@sygroup.chE
49              
50             =head1 COPYRIGHT
51              
52             Copyright (c) 2008,2013 Tonnerre Lombard .
53             All rights reserved.
54              
55             This program is free software; you can redistribute it and/or modify
56             it under the terms of the GNU General Public License as published by
57             the Free Software Foundation; either version 2 of the License, or
58             (at your option) any later version.
59              
60             See the LICENSE file that comes with this distribution for more details.
61              
62             =cut
63              
64              
65             ####################################################################################################
66              
67             sub register_commands
68             {
69 0     0 0   my ($class, $version) = @_;
70 0           my %tmp = (
71             create => [ \&add_uin, undef ],
72             transfer_request => [ \&add_uin, undef ],
73             renew => [ \&renew, undef ],
74             );
75              
76 0           return { 'domain' => \%tmp };
77             }
78              
79             ####################################################################################################
80              
81             ############ Transform commands
82              
83             sub add_uin
84             {
85 0     0 0   my ($epp, $domain, $rd) = @_;
86 0           my $mes = $epp->message();
87              
88 0 0         return unless Net::DRI::Util::has_key($rd,'uin');
89              
90 0           my $eid = $mes->command_extension_register('neulevel:extension',
91             'xmlns:neulevel="urn:ietf:params:xml:ns:neulevel-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:neulevel-1.0 neulevel-1.0.xsd"');
92 0           $mes->command_extension($eid, ['neulevel:unspec', 'UIN=' . $rd->{uin}]);
93 0           return;
94             }
95              
96             sub renew
97             {
98 0     0 0   my ($epp, $domain, $rd) = @_;
99 0           my $mes = $epp->message();
100 0           my @vals = qw(RestoreReasonCode RestoreComment TrueData ValidUse UIN);
101 0           my %info;
102             my $comment;
103              
104 0 0 0       if (defined($rd->{rgp}) && ref($rd->{rgp}) eq 'HASH')
105             {
106 0           $info{TrueData} = 'Y';
107 0           $info{ValidUse} = 'Y';
108 0           $info{RestoreReasonCode} = $rd->{rgp}->{code};
109 0           $comment = $rd->{rgp}->{comment};
110 0           $comment = join('', map { ucfirst($_) } split(/\s+/, $comment));
  0            
111 0           $info{RestoreComment} = $comment;
112             }
113              
114 0 0         if (Net::DRI::Util::has_key($rd,'uin'))
115             {
116 0           $info{UIN} = $rd->{uin};
117             }
118              
119 0           my $eid = $mes->command_extension_register('neulevel:extension',
120             'xmlns:neulevel="urn:ietf:params:xml:ns:neulevel-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:neulevel-1.0 neulevel-1.0.xsd"');
121 0           $mes->command_extension($eid, ['neulevel:unspec', join(' ', map { $_ . '=' . $info{$_} } grep { defined($info{$_}) } @vals)]);
  0            
  0            
122 0           return;
123             }
124              
125             ####################################################################################################
126             1;