File Coverage

blib/lib/Net/DRI/Protocol/EPP/Extensions/AT/Contact.pm
Criterion Covered Total %
statement 6 36 16.6
branch 0 14 0.0
condition 0 3 0.0
subroutine 2 6 33.3
pod 0 4 0.0
total 8 63 12.7


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, NIC.AT Contact extension
2             ## Contributed by Michael Braunoeder from NIC.AT
3             ##
4             ## Copyright (c) 2006-2008,2010,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::AT::Contact;
17              
18 1     1   693 use strict;
  1         2  
  1         27  
19 1     1   4 use warnings;
  1         1  
  1         335  
20              
21             our $NS='http://www.nic.at/xsd/at-ext-contact-1.0';
22              
23             =pod
24              
25             =head1 NAME
26              
27             Net::DRI::Protocol::EPP::Extensions::AT::Contact - NIC.AT Contact Extensions 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) 2006-2008,2010,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 => [ undef, \&parse_info ],
70             update => [ \&update, undef ],
71             create => [ \&create, undef ],
72             );
73              
74 0           return { 'contact' => \%tmp };
75             }
76              
77              
78             sub parse_info
79             {
80 0     0 0   my ($po,$otype,$oaction,$oname,$rinfo)=@_;
81 0           my $mes=$po->message();
82              
83 0 0         return unless $mes->is_success();
84              
85 0           my $c=$rinfo->{contact}->{$oname}->{self};
86 0 0         $c->email(undef) if ($c->email() eq 'n/a');
87              
88 0           my $condata=$mes->get_extension($NS,'infData');
89 0 0         return unless $condata;
90              
91 0           my @options;
92              
93 0           my $el=$condata->getElementsByTagNameNS($NS,'type');
94 0 0         my $type=$el? $el->get_node(1)->getFirstChild()->getData() : undef;
95              
96 0 0 0       $c->type($type) if (defined($type) && $type);
97             # $rinfo->{contact}->{$oname}->{type}=$type if $type;
98 0           return;
99             }
100              
101             sub create
102             {
103 0     0 0   my ($epp,$contact,$rd)=@_;
104 0           my $mes=$epp->message();
105              
106 0           my $type=$contact->type();
107 0 0         return unless (defined($type));
108              
109 0           my $eid=$mes->command_extension_register('at-ext-contact:create','xmlns:at-ext-contact="'.$NS.'" xsi:schemaLocation="'.$NS.' at-ext-contact-1.0.xsd"');
110 0           $mes->command_extension($eid,['at-ext-contact:type',$type]);
111 0           return;
112             }
113              
114             sub update
115             {
116 0     0 0   my ($epp,$contact,$todo)=@_;
117              
118 0           my $mes=$epp->message();
119 0           my $newc=$todo->set('info');
120              
121 0           my $type=$newc->type();
122 0 0         return unless (defined($type));
123              
124 0           my $eid=$mes->command_extension_register('at-ext-contact:update','xmlns:at-ext-contact="'.$NS.'" xsi:schemaLocation="'.$NS.' at-ext-contact-1.0.xsd"');
125 0           $mes->command_extension($eid,['at-ext-contact:chg',['at-ext-contact:type',$type]]);
126 0           return;
127             }
128              
129             ####################################################################################################
130             1;