Business-LiveDrive

 view release on metacpan or  search on metacpan

lib/Business/LiveDrive.pm  view on Meta::CPAN

    my ($self, $method, @args) = @_;
    my ($result, $status, $error) = 
        LiveDriveAPI->$method($self->apiKey, @args);
    if ( $error ) { croak($error); }
    if ( ! $result ) {
        croak("Unable to connect to LiveDrive API");
    }
    return $result;
}

=head2 addbackup

    $livedrive->addbackup('123456');

Upgrades a user account to include Backup. The account is specified by 
passing the account user ID.

Returns details for the upgraded account.

=cut

sub addbackup {
    my ($self, $id) = @_;
    croak('You must pass the cutomer ID') unless $id;
    my $res = $self->_call("AddBackup", $id);
    if ( $res->{Header}->{Code} ne 'UserUpgraded' ) {
        croak($res->{Header}->{Description});
    }
    delete $res->{Header};
    return $res;
}

=head2 addbackupwithlimit

    $livedrive->addbackupwithlimit( userID => '123456', 
        capacity => 'OneTeraByte');

Upgrades a user account to include Backup with a limit as specified

Parameters:
    UserID      : the user account ID
    capacity    : one of HalfTeraByte, OneTeraByte, OneAndAHalfTeraBytes or TwoTeraBytes

Returns a hashref with the new details for the account

=cut

sub addbackupwithlimit {
    my ($self, %args) = @_;
    my @params = ();
    foreach (qw/userID capacity/) {
        croak("You must pass the $_ parameter") unless $args{$_};
        push @params, $_;
    }
    my $res = $self->_call("AddBackupWithLimit", @params);
    if ( $res->{Header}->{Code} ne 'UserUpgraded' ) {
        croak($res->{Header}->{Description});
    }



( run in 0.498 second using v1.01-cache-2.11-cpan-49f99fa48dc )