Business-LiveDrive
view release on metacpan or search on metacpan
lib/Business/LiveDrive.pm view on Meta::CPAN
sub adduserwithlimit {
my ($self, %args) = @_;
my @params = ();
foreach (qw/email password confirmPassword subDomain
BriefcaseCapacity BackupCapacity isSharing hasWebApps
firstName lastName cardVerificationValue productType/) {
croak("You must pass the $_ parameter") unless $args{$_};
push @params, $args{$_};
}
my $res = $self->_call("AddUserWithLimit", @params);
if ( $res->{Header}->{Code} ne 'UserAdded' ) {
croak($res->{Header}->{Description});
}
delete $res->{Header};
return $res;
}
=head2 getuser
$livedrive->getuser('123456');
Returns a hashref with details of the specified user account.
=cut
sub getuser {
my ($self, $id) = @_;
croak("Your must supply the customer id") unless $id;
my $res = $self->_call("GetUser", qq/$id/);
if ( $res->{Header}->{Code} ne 'UserFound' ) {
croak($res->{Header}->{Description});
}
delete $res->{Header};
return $res;
}
=head2 getusers
$livedrive->getusers($page_number);
Returns a paged list of user records. Returns first page unless
$page_number (int) is specified in which case that page is returned.
=cut
sub getusers {
my ($self, $page) = @_;
$page = 1 unless $page;
my $res = $self->_call("GetUsers", qq/$page/);
return unless $res->{Header}->{Code} eq 'UsersFound';
delete $res->{Header};
return $res;
}
=head2 updateuser
Updates user details.
=cut
sub updateuser {
my ($self, %args) = @_;
my @params = ();
foreach (qw/userID firstName lastName email password confirmPassword
subDomain isSharing hasWebApps/) {
croak("You must pass the $_ parameter") unless $args{$_} ||
$_ =~ /assword/; # Password is not compulsory
push @params, $args{$_};
}
my $res = $self->_call("UpdateUser", @params);
if ( $res->{Header}->{Code} ne 'UserUpdated' ) {
croak($res->{Header}->{Description});
}
delete $res->{Header};
return $res;
}
=head2 upgradeuser
Adds briefcase to the user or upgrades a user to a briefcase of a given size.
Parameters:
userID : The ID of the customer account
capacity : HalfTeraByte or OneTeraByte or OneAndAHalfTeraBytes or TwoTeraBytes
cardVerificationValue : the CV2 of the card used to register the reseller account
=cut
sub upgradeuser {
my ($self, %args) = @_;
my @params = ();
foreach (qw/userID capacity cardVerificationValue/) {
croak("You must pass the $_ parameter") unless $args{$_};
push @params, $args{$_};
}
my $res = $self->_call("UpgradeUser", @params);
if ( $res->{Header}->{Code} ne 'UserUpgraded' ) {
croak($res->{Header}->{Description});
}
delete $res->{Header};
return $res;
}
=head1 SEE ALSO
http://www.livedrive.com/ for the API documentation
=head1 AUTHOR
Jason Clifford, E<lt>jason@ukfsn.orgE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2010 by Jason Clifford
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 or later.
=cut
1;
( run in 0.539 second using v1.01-cache-2.11-cpan-7fcb06a456a )