File Coverage

blib/lib/Business/LiveDriveAPI.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package LiveDriveAPI;
2             # XXX - WARNING this has been altered.
3             # XXX tns data types changed to string
4             # XXX default_ns set
5              
6             # Generated by SOAP::Lite (v0.710.10) for Perl -- soaplite.com
7             # Copyright (C) 2000-2006 Paul Kulchenko, Byrne Reese
8             # -- generated at [Tue Nov 16 19:22:52 2010]
9             # -- generated from http://www.livedrive.com/ResellersService/ResellerAPI.asmx?WSDL
10             my %methods = (
11             GetUsers => {
12             endpoint => 'http://www.livedrive.com/ResellersService/ResellerAPI.asmx',
13             soapaction => 'http://www.livedrive.com/GetUsers',
14             namespace => 'http://www.livedrive.com/',
15             parameters => [
16             SOAP::Data->new(name => 'apiKey', type => 's:string', attr => {}),
17             SOAP::Data->new(name => 'page', type => 's:int', attr => {}),
18             ], # end parameters
19             }, # end GetUsers
20             UpgradeUser => {
21             endpoint => 'http://www.livedrive.com/ResellersService/ResellerAPI.asmx',
22             soapaction => 'http://www.livedrive.com/UpgradeUser',
23             namespace => 'http://www.livedrive.com/',
24             parameters => [
25             SOAP::Data->new(name => 'apiKey', type => 's:string', attr => {}),
26             SOAP::Data->new(name => 'userID', type => 's:int', attr => {}),
27             SOAP::Data->new(name => 'capacity', type => 's:string', attr => {}),
28             SOAP::Data->new(name => 'cardVerificationValue', type => 's:string', attr => {}),
29             ], # end parameters
30             }, # end UpgradeUser
31             AddBackup => {
32             endpoint => 'http://www.livedrive.com/ResellersService/ResellerAPI.asmx',
33             soapaction => 'http://www.livedrive.com/AddBackup',
34             namespace => 'http://www.livedrive.com/',
35             parameters => [
36             SOAP::Data->new(name => 'apiKey', type => 's:string', attr => {}),
37             SOAP::Data->new(name => 'userID', type => 's:int', attr => {}),
38             ], # end parameters
39             }, # end AddBackup
40             UpdateUser => {
41             endpoint => 'http://www.livedrive.com/ResellersService/ResellerAPI.asmx',
42             soapaction => 'http://www.livedrive.com/UpdateUser',
43             namespace => 'http://www.livedrive.com/',
44             parameters => [
45             SOAP::Data->new(name => 'apiKey', type => 's:string', attr => {}),
46             SOAP::Data->new(name => 'userID', type => 's:int', attr => {}),
47             SOAP::Data->new(name => 'firstName', type => 's:string', attr => {}),
48             SOAP::Data->new(name => 'lastName', type => 's:string', attr => {}),
49             SOAP::Data->new(name => 'email', type => 's:string', attr => {}),
50             SOAP::Data->new(name => 'password', type => 's:string', attr => {}),
51             SOAP::Data->new(name => 'confirmPassword', type => 's:string', attr => {}),
52             SOAP::Data->new(name => 'subDomain', type => 's:string', attr => {}),
53             SOAP::Data->new(name => 'isSharing', type => 's:boolean', attr => {}),
54             SOAP::Data->new(name => 'hasWebApps', type => 's:boolean', attr => {}),
55             ], # end parameters
56             }, # end UpdateUser
57             AddUserWithLimit => {
58             endpoint => 'http://www.livedrive.com/ResellersService/ResellerAPI.asmx',
59             soapaction => 'http://www.livedrive.com/AddUserWithLimit',
60             namespace => 'http://www.livedrive.com/',
61             parameters => [
62             SOAP::Data->new(name => 'apiKey', type => 's:string', attr => {}),
63             SOAP::Data->new(name => 'email', type => 's:string', attr => {}),
64             SOAP::Data->new(name => 'password', type => 's:string', attr => {}),
65             SOAP::Data->new(name => 'confirmPassword', type => 's:string', attr => {}),
66             SOAP::Data->new(name => 'subDomain', type => 's:string', attr => {}),
67             SOAP::Data->new(name => 'BriefcaseCapacity', type => 's:string', attr => {}),
68             SOAP::Data->new(name => 'BackupCapacity', type => 's:string', attr => {}),
69             SOAP::Data->new(name => 'isSharing', type => 's:boolean', attr => {}),
70             SOAP::Data->new(name => 'hasWebApps', type => 's:boolean', attr => {}),
71             SOAP::Data->new(name => 'firstName', type => 's:string', attr => {}),
72             SOAP::Data->new(name => 'lastName', type => 's:string', attr => {}),
73             SOAP::Data->new(name => 'cardVerificationValue', type => 's:string', attr => {}),
74             SOAP::Data->new(name => 'productType', type => 's:string', attr => {}),
75             ], # end parameters
76             }, # end AddUserWithLimit
77             AddUser => {
78             endpoint => 'http://www.livedrive.com/ResellersService/ResellerAPI.asmx',
79             soapaction => 'http://www.livedrive.com/AddUser',
80             namespace => 'http://www.livedrive.com/',
81             parameters => [
82             SOAP::Data->new(name => 'apiKey', type => 's:string', attr => {}),
83             SOAP::Data->new(name => 'email', type => 's:string', attr => {}),
84             SOAP::Data->new(name => 'password', type => 's:string', attr => {}),
85             SOAP::Data->new(name => 'confirmPassword', type => 's:string', attr => {}),
86             SOAP::Data->new(name => 'subDomain', type => 's:string', attr => {}),
87             SOAP::Data->new(name => 'capacity', type => 's:string', attr => {}),
88             SOAP::Data->new(name => 'isSharing', type => 's:boolean', attr => {}),
89             SOAP::Data->new(name => 'hasWebApps', type => 's:boolean', attr => {}),
90             SOAP::Data->new(name => 'firstName', type => 's:string', attr => {}),
91             SOAP::Data->new(name => 'lastName', type => 's:string', attr => {}),
92             SOAP::Data->new(name => 'cardVerificationValue', type => 's:string', attr => {}),
93             SOAP::Data->new(name => 'productType', type => 's:string', attr => {}),
94             ], # end parameters
95             }, # end AddUser
96             AddBackupWithLimit => {
97             endpoint => 'http://www.livedrive.com/ResellersService/ResellerAPI.asmx',
98             soapaction => 'http://www.livedrive.com/AddBackupWithLimit',
99             namespace => 'http://www.livedrive.com/',
100             parameters => [
101             SOAP::Data->new(name => 'apiKey', type => 's:string', attr => {}),
102             SOAP::Data->new(name => 'userID', type => 's:int', attr => {}),
103             SOAP::Data->new(name => 'capacity', type => 's:string', attr => {}),
104             ], # end parameters
105             }, # end AddBackupWithLimit
106             GetUser => {
107             endpoint => 'http://www.livedrive.com/ResellersService/ResellerAPI.asmx',
108             soapaction => 'http://www.livedrive.com/GetUser',
109             namespace => 'http://www.livedrive.com/',
110             parameters => [
111             SOAP::Data->new(name => 'apiKey', type => 's:string', attr => {}),
112             SOAP::Data->new(name => 'userID', type => 's:int', attr => {}),
113             ], # end parameters
114             }, # end GetUser
115             ); # end my %methods
116              
117 1     1   927 use SOAP::Lite;
  0            
  0            
118             use Exporter;
119             use Carp ();
120              
121             use vars qw(@ISA $AUTOLOAD @EXPORT_OK %EXPORT_TAGS);
122             @ISA = qw(Exporter SOAP::Lite);
123             @EXPORT_OK = (keys %methods);
124             %EXPORT_TAGS = ('all' => [@EXPORT_OK]);
125              
126             sub _call {
127             my ($self, $method) = (shift, shift);
128             my $name = UNIVERSAL::isa($method => 'SOAP::Data') ? $method->name : $method;
129             my %method = %{$methods{$name}};
130             $self->proxy($method{endpoint} || Carp::croak "No server address (proxy) specified")
131             unless $self->proxy;
132             my @templates = @{$method{parameters}};
133             my @parameters = ();
134             foreach my $param (@_) {
135             if (@templates) {
136             my $template = shift @templates;
137             my ($prefix,$typename) = SOAP::Utils::splitqname($template->type);
138             my $method = 'as_'.$typename;
139             # TODO - if can('as_'.$typename) {...}
140             my $result = $self->serializer->$method($param, $template->name, $template->type, $template->attr);
141             push(@parameters, $template->value($result->[2]));
142             }
143             else {
144             push(@parameters, $param);
145             }
146             }
147              
148             $self->endpoint($method{endpoint})
149             ->ns($method{namespace})
150             ->on_action(sub{qq!"$method{soapaction}"!});
151              
152             $self->default_ns('http://www.livedrive.com/');
153              
154             $self->serializer->register_ns("http://microsoft.com/wsdl/mime/textMatching/","tm");
155             $self->serializer->register_ns("http://schemas.xmlsoap.org/wsdl/soap12/","soap12");
156             $self->serializer->register_ns("http://schemas.xmlsoap.org/wsdl/mime/","mime");
157             $self->serializer->register_ns("http://www.w3.org/2001/XMLSchema","s");
158             # $self->serializer->register_ns("http://schemas.xmlsoap.org/wsdl/soap/","soap");
159             $self->serializer->register_ns("http://schemas.xmlsoap.org/wsdl/","wsdl");
160             $self->serializer->register_ns("http://schemas.xmlsoap.org/soap/encoding/","soapenc");
161             $self->serializer->register_ns("http://schemas.xmlsoap.org/wsdl/http/","http");
162              
163             $self->serializer->register_ns("http://www.livedrive.com/","tns");
164              
165             my $som = $self->SUPER::call($method => @parameters);
166             if ($self->want_som) {
167             return $som;
168             }
169             UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ? $som->paramsall : $som->result : $som;
170             }
171              
172             sub BEGIN {
173             no strict 'refs';
174             for my $method (qw(want_som)) {
175             my $field = '_' . $method;
176             *$method = sub {
177             my $self = shift->new;
178             @_ ? ($self->{$field} = shift, return $self) : return $self->{$field};
179             }
180             }
181             }
182             no strict 'refs';
183             for my $method (@EXPORT_OK) {
184             my %method = %{$methods{$method}};
185             *$method = sub {
186             my $self = UNIVERSAL::isa($_[0] => __PACKAGE__)
187             ? ref $_[0]
188             ? shift # OBJECT
189             # CLASS, either get self or create new and assign to self
190             : (shift->self || __PACKAGE__->self(__PACKAGE__->new))
191             # function call, either get self or create new and assign to self
192             : (__PACKAGE__->self || __PACKAGE__->self(__PACKAGE__->new));
193             $self->_call($method, @_);
194             }
195             }
196              
197             sub AUTOLOAD {
198             my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2);
199             return if $method eq 'DESTROY' || $method eq 'want_som';
200             die "Unrecognized method '$method'. List of available method(s): @EXPORT_OK\n";
201             }
202              
203             1;