DRI/DRD/OpenSRS.pm

filter: Statementstmt 31.9% 23 / 72 Branchbran 5.0% 1 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 45.0% 9 / 20 Podpod 26.6% 4 / 15 totaltotal 29.1% 37 / 127 CC 11 SCAR 20.6
CC
11
Cov
26%
domain_info
20.0
domain_is_mine
20.0
domain_update
12.0
CRAP 7.8
« DRI/Protocol/Whois/Domain/NAME.pm ↑ Summary DRI/Protocol/DAS/AU/Message.pm »
1 ## Domain Registry Interface, OpenSRS Registry Driver
2 ##
3 ## Copyright (c) 2008-2014 Patrick Mevzek <netdri@dotandco.com>. 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::DRD::OpenSRS;
16  
17 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 2 ▶use base qw/Net::DRI::DRD/;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 2 ▶use DateTime::Duration;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 =pod
26  
27 =head1 NAME
28  
29 Net::DRI::DRD::OpenSRS - OpenSRS Registry driver for Net::DRI
30  
31 =head1 DESCRIPTION
32  
33 Please see the README file for details.
34  
35 =head2 CURRENT LIMITATIONS
36  
37 Only domain_info and account_list_domains are available.
38  
39 =head1 SUPPORT
40  
41 For now, support questions should be sent to:
42  
43 E<lt>netdri@dotandco.comE<gt>
44  
45 Please also see the SUPPORT file in the distribution.
46  
47 =head1 SEE ALSO
48  
49 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
50  
51 =head1 AUTHOR
52  
53 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
54  
55 =head1 COPYRIGHT
56  
57 Copyright (c) 2008-2014 Patrick Mevzek <netdri@dotandco.com>.
58 All rights reserved.
59  
60 This program is free software; you can redistribute it and/or modify
61 it under the terms of the GNU General Public License as published by
62 the Free Software Foundation; either version 2 of the License, or
63 (at your option) any later version.
64  
65 See the LICENSE file that comes with this distribution for more details.
66  
67 =cut
68  
69 ####################################################################################################
70  
71 sub new
72 {
73 1 ▶ my $class=shift;
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
74 1 my $self=$class->SUPER::new(@_);
75 1 return $self;
76 }
77  
78 0 ▶sub periods { return map { DateTime::Duration->new(years => $_) } (1..10); }
Subroutine periods: not called CC=1 SCAR=6.9
Pod documented
79 1 ▶sub name { return 'OpenSRS'; }
Subroutine name: called CC=1 SCAR=0.0
Pod documented
80 ## See http://opensrs.com/site/services/domains/pricing
81 1 ▶sub tlds { return (qw/com net org info biz mobi pro name asia tel/,
Subroutine tlds: called CC=1 SCAR=0.0
Pod documented
82 qw/co me pw tv ws xxx jobs aero coop/,
83 qw/ac ag ai ar br bz ca cc cl ec gd gs gy hn ht lc ms mx pe pm pr sr sx tc us uy vc ve vg/,
84 qw/at be ch cz de dk es eu fi fr gr gg gl hr hu im is it je li lt lu lv md nl no pl pt ro ru se si ua uk/,
85 qw/af am cn hk in io jp kg kr la mn my ph qa sg tl tm tw/,
86 qw/ae cd cm il ly ma mu re sc sh so st to yt za/,
87 qw/as au cx fm hm ki nu nz sb tf tk wf/,
88 ); }
89 0 ▶sub object_types { return ('domain','ns'); }
Subroutine object_types: not called CC=1 SCAR=6.9
Pod documented
90 0 ▶sub profile_types { return qw/xcp/; }
Subroutine profile_types: not called CC=1 SCAR=6.9
Pod undocumented
91  
92 sub transport_protocol_default
93 {
94 1 ▶ my ($self,$type)=@_;
Subroutine transport_protocol_default: called CC=2 SCAR=8.1
Pod undocumented
95  
96 1 ▶ return ('Net::DRI::Transport::HTTP',{},'Net::DRI::Protocol::OpenSRS::XCP',{}) if $type eq 'xcp';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "xcp" 1 0 1
97 0 return;
98 }
99  
100 ####################################################################################################
101  
102 sub domain_operation_needs_is_mine
103 {
104 0 ▶ my ($self,$ndr,$domain,$op)=@_;
Subroutine domain_operation_needs_is_mine: not called CC=1 SCAR=6.9
Pod undocumented
105 0 return;
106 }
107  
108 sub account_list_domains
109 {
110 0 ▶ my ($self,$ndr)=@_;
Subroutine account_list_domains: not called CC=2 SCAR=17.9
Pod undocumented
111 0 my $rc=$ndr->try_restore_from_cache('account','domains','list');
112 0 ▶ if (! defined $rc) { $rc=$ndr->process('account','list_domains'); }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $rc) 0 0 0
113 0 return $rc;
114 }
115  
116 sub domain_info
117 {
118 0 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_info: not called CC=4 SCAR=30.0
Pod undocumented
119 0 $self->enforce_domain_name_constraints($ndr,$domain,'info');
120  
121 0 my $rc=$ndr->try_restore_from_cache('domain',$domain,'info');
122 0 ▶ if (! defined $rc)
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $rc) 0 0 0
123 {
124 ## First grab a cookie, if needed
125 0 ▶ unless (Net::DRI::Util::has_key($rd,'cookie'))
Branch: 1 branch
BranchTrueFalseTotal
unless (Net::DRI::Util::has_key($rd, "cookie")) 0 0 0
126 {
127 0 $rd=Net::DRI::Util::create_params('domain_info',$rd); ## will fail in set_cookie because other params needed, but at least this will be ok for next line ; otherwise do true checks of value needed
128 0 $rd->{domain}=$domain;
129 0 $rc=$ndr->process('session','set_cookie',[$rd]);
130 0 ▶ return $rc unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
131 0 $rd->{cookie}=$ndr->get_info('value','session','cookie'); ## Store cookie somewhere (taking into account date of expiry or some TTLs) ?
132 }
133 ## Now do the real info
134 0 $rc=$ndr->process('domain','info',[$domain,$rd]); ## the $domain is not really used here, as it was used during set_cookie above
135 }
136 0 return $rc;
137 }
138  
139 sub domain_update
140 {
141 0 ▶ my ($self,$ndr,$domain,$changes,$rd)=@_;
Subroutine domain_update: not called CC=3 SCAR=24.8
Pod undocumented
142 0 $self->enforce_domain_name_constraints($ndr,$domain,'update');
143  
144 ## First grab a cookie, if needed
145 0 ▶ unless (Net::DRI::Util::has_key($rd,'cookie'))
Branch: 1 branch
BranchTrueFalseTotal
unless (Net::DRI::Util::has_key($rd, "cookie")) 0 0 0
146 {
147 0 $rd=Net::DRI::Util::create_params('domain_update',$rd); ## will fail in set_cookie because other params needed, but at least this will be ok for next line ; otherwise do true checks of value needed
148 0 $rd->{domain}=$domain;
149 0 my $rc=$ndr->process('session','set_cookie',[$rd]);
150 0 ▶ return $rc unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
151 0 $rd->{cookie}=$ndr->get_info('value','session','cookie'); ## Store cookie somewhere (taking into account date of expiry or some TTLs) ?
152 }
153 ## Now do the real update
154 0 my $rc=$ndr->process('domain','update',[$domain,$changes,$rd]); ## the $domain is not really used here, as it was used during set_cookie above
155 0 return $rc;
156 }
157  
158 sub domain_is_mine
159 {
160 0 ▶ my ($self,$ndr,$domain,$rd)=@_;
Subroutine domain_is_mine: not called CC=4 SCAR=30.0
Pod undocumented
161 0 my $clid=$self->info('client_id');
162 0 ▶ return unless defined $clid;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $clid 0 0 0
163 0 my $rc=$ndr->process('domain','is_mine',[$domain,$rd]);
164 0 ▶ return unless $rc->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $rc->is_success 0 0 0
165 0 my $mine=$ndr->get_info('mine');
166 0 ▶ return unless defined $mine;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mine 0 0 0
167 0 return $mine;
168 }
169  
170 sub domain_send_authcode
171 {
172 0 ▶ my ($self,$ndr,$domain)=@_;
Subroutine domain_send_authcode: not called CC=1 SCAR=6.9
Pod undocumented
173 0 my $rc=$ndr->process('domain','send_authcode',[$domain]);
174 0 return $rc;
175 }
176  
177 sub host_registry_check
178 {
179 0 ▶ my ($self,$ndr,$hostname,$registry)=@_;
Subroutine host_registry_check: not called CC=1 SCAR=6.9
Pod undocumented
180  
181 0 return $ndr->process('nameserver', 'registry_check', [$hostname, $registry]);
182 }
183  
184 sub host_registry_add
185 {
186 0 ▶ my ($self,$ndr,$hostname,$rd)=@_;
Subroutine host_registry_add: not called CC=1 SCAR=6.9
Pod undocumented
187  
188 0 return $ndr->process('nameserver', 'registry_add', [$hostname, $rd]);
189 }
190  
191 ####################################################################################################
192 2 1;
« DRI/Protocol/Whois/Domain/NAME.pm ↑ Summary DRI/Protocol/DAS/AU/Message.pm »