File Coverage

blib/lib/Net/DRI/Protocol/EPP/Extensions/CloudRegistry/LaunchPhase.pm
Criterion Covered Total %
statement 9 52 17.3
branch 0 28 0.0
condition 0 3 0.0
subroutine 3 8 37.5
pod 0 5 0.0
total 12 96 12.5


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, Cloud Registry LaunchPhase EPP Extension for managing Sunrise and Landrush
2             ##
3             ## Copyright (c) 2009-2011,2013 Cloud Registry Pty Ltd . 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::EPP::Extensions::CloudRegistry::LaunchPhase;
16              
17 1     1   1422 use strict;
  1         1  
  1         28  
18 1     1   4 use warnings;
  1         1  
  1         21  
19              
20 1     1   4 use Net::DRI::Util;
  1         1  
  1         722  
21              
22             =pod
23              
24             =head1 NAME
25              
26             Net::DRI::Protocol::EPP::Extensions::CloudRegistry::LaunchPhase - Cloud Registry LaunchPhase (Sunrise and Land Rush) EPP Extension for Net::DRI
27              
28             =head1 DESCRIPTION
29              
30             Please see the README file for details.
31              
32             =head1 SUPPORT
33              
34             Please use the issue tracker
35              
36             Ehttps://github.com/cloudregistry/net-dri/issuesE
37              
38             Please also see the SUPPORT file in the distribution.
39              
40             =head1 SEE ALSO
41              
42             Ehttp://www.cloudregistry.net/E and
43             Ehttp://www.dotandco.com/services/software/Net-DRI/E
44              
45             =head1 AUTHOR
46              
47             Wil Tan Ewil@cloudregistry.netE
48              
49             =head1 COPYRIGHT
50              
51             Copyright (c) 2009-2011,2013 Cloud Registry Pty Ltd .
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             create => [ \&create, \&create_parse ],
70             info => [ \&info, \&info_parse ],
71             );
72              
73 0           return { 'domain' => \%tmp };
74             }
75              
76             ####################################################################################################
77              
78             sub create
79             {
80 0     0 0   my ($epp,$domain,$rd)=@_;
81 0           my $mes=$epp->message();
82              
83 0 0         return unless Net::DRI::Util::has_key($rd,'lp');
84              
85 0           my @lpdata;
86 0 0         push @lpdata, ['lp:trademark_name', $rd->{lp}->{trademark_name}] if exists $rd->{lp}->{trademark_name};
87 0 0         push @lpdata, ['lp:trademark_number', $rd->{lp}->{trademark_number}] if exists $rd->{lp}->{trademark_number};
88 0 0         push @lpdata, ['lp:trademark_locality', $rd->{lp}->{trademark_locality}] if exists $rd->{lp}->{trademark_locality};
89 0 0         push @lpdata, ['lp:trademark_entitlement', $rd->{lp}->{trademark_entitlement}] if exists $rd->{lp}->{trademark_entitlement};
90 0 0         push @lpdata, ['lp:pvrc', $rd->{lp}->{pvrc}] if exists $rd->{lp}->{pvrc};
91 0 0         push @lpdata, ['lp:phase', $rd->{lp}->{phase}] if exists $rd->{lp}->{phase};
92              
93 0           my $eid=$mes->command_extension_register('lp:create',sprintf('xmlns:lp="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('lp')));
94 0           $mes->command_extension($eid,[@lpdata]);
95 0           return;
96             }
97              
98             sub create_parse
99             {
100 0     0 0   my ($po, $otype, $oaction, $oname, $rinfo) = @_;
101 0           my $mes = $po->message();
102 0           my $creData = $mes->get_extension('lp','creData');
103              
104 0 0         return unless defined $creData;
105              
106 0           my $c = $creData->getElementsByTagNameNS($mes->ns('lp'), 'application_id');
107 0 0 0       $rinfo->{$otype}->{$oname}->{lp} = {application_id=>$c->get_node(1)->textContent()} if defined $c && $c->size();
108 0           return;
109             }
110              
111             sub info
112             {
113 0     0 0   my ($epp,$domain,$rd)=@_;
114 0           my $mes=$epp->message();
115              
116 0 0         return unless Net::DRI::Util::has_key($rd,'lp');
117              
118 0           my @lpdata;
119 0 0         push @lpdata, ['lp:application_id', $rd->{lp}->{application_id}] if exists $rd->{lp}->{application_id};
120 0 0         push @lpdata, ['lp:phase', $rd->{lp}->{phase}] if exists $rd->{lp}->{phase};
121              
122 0           my $eid=$mes->command_extension_register('lp:info',sprintf('xmlns:lp="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('lp')));
123 0           $mes->command_extension($eid,[@lpdata]);
124 0           return;
125             }
126              
127             sub info_parse
128             {
129 0     0 0   my ($po,$otype,$oaction,$oname,$rinfo)=@_;
130 0           my $mes=$po->message();
131 0           my $infdata=$mes->get_extension('lp','infData');
132              
133 0 0         return unless defined $infdata;
134              
135 0           my %lpdata;
136 0           my $ns=$mes->ns('lp');
137 0           foreach my $el (qw/trademark_name trademark_number trademark_locality trademark_entitlement pvrc phase/)
138             {
139 0           my $v=Net::DRI::Util::xml_child_content($infdata,$ns,$el);
140 0 0         $lpdata{$el}=$v if defined $v;
141             }
142 0           $rinfo->{$otype}->{$oname}->{lp} = \%lpdata;
143 0           return;
144             }
145              
146             ####################################################################################################
147             1;