DRI/Protocol/Gandi/WS/Connection.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 38 CC 3 SCAR 16.7
CC
3
Cov
0%
parse_login
12.0
login
2.0
extract_session
2.0
CRAP 5.3
1 ## Domain Registry Interface, Gandi Web Services Connection handling
2 ##
3 ## Copyright (c) 2008,2009,2013 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::Protocol::Gandi::WS::Connection;
16  
17 use strict;
18 use warnings;
19  
20 use XMLRPC::Lite; ## needed to have XMLRPC::Data
21  
22 =pod
23  
24 =head1 NAME
25  
26 Net::DRI::Protocol::Gandi::WS::Connection - Gandi Web Services Connection handling for Net::DRI
27  
28 =head1 DESCRIPTION
29  
30 Please see the README file for details.
31  
32 =head1 SUPPORT
33  
34 For now, support questions should be sent to:
35  
36 E<lt>netdri@dotandco.comE<gt>
37  
38 Please also see the SUPPORT file in the distribution.
39  
40 =head1 SEE ALSO
41  
42 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
43  
44 =head1 AUTHOR
45  
46 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
47  
48 =head1 COPYRIGHT
49  
50 Copyright (c) 2008,2009,2013 Patrick Mevzek <netdri@dotandco.com>.
51 All rights reserved.
52  
53 This program is free software; you can redistribute it and/or modify
54 it under the terms of the GNU General Public License as published by
55 the Free Software Foundation; either version 2 of the License, or
56 (at your option) any later version.
57  
58 See the LICENSE file that comes with this distribution for more details.
59  
60 =cut
61  
62 ####################################################################################################
63  
64 sub login
65 {
66 my ($class,$cm,$id,$pass,$cltrid)=@_;
67 my $mes=$cm->();
68 $mes->method('login');
69 $mes->params([$id,$pass,XMLRPC::Data->type('boolean')->value(0)]);
70 return $mes;
71 }
72  
73 sub parse_login
74 {
75 my ($class,$mes)=@_;
76 $mes->errmsg($mes->is_success()? 'Login OK' : 'Login failed') unless $mes->errmsg();
77 return $mes->result_status();
78 }
79  
80 sub extract_session
81 {
82 my ($class,$mes)=@_;
83 return { id => $mes->value() };
84 }
85  
86 sub transport_default
87 {
88 my ($self,$tname)=@_;
89 return (defer => 1, has_login => 1, has_logout => 0);
90 }
91  
92 ####################################################################################################
93 1;