From: levinse Date: Sat, 8 Jan 2011 05:44:18 +0000 (+0000) Subject: Allow use of fax API X-Git-Url: http://git.freeside.biz/gitweb/?p=Net-Vitelity.git;a=commitdiff_plain;h=63498d3d6b197e11c376b9532048d385cd8214c4 Allow use of fax API --- diff --git a/lib/Net/Vitelity.pm b/lib/Net/Vitelity.pm index 1259820..2e6dc53 100644 --- a/lib/Net/Vitelity.pm +++ b/lib/Net/Vitelity.pm @@ -16,8 +16,6 @@ Version 0.02 our $VERSION = '0.02'; -our $URL = 'http://64.74.178.105/api.php'; - our $AUTOLOAD; =head1 SYNOPSIS @@ -37,6 +35,7 @@ sub new { my ($class,%data) = @_; die "missing user and/or password" unless defined $data{'login'} && defined $data{'pass'}; my $self = { 'login' => $data{'login'}, 'pass' => $data{'pass'} }; + $self->{apitype} = $data{'apitype'} ? $data{'apitype'} : 'api'; bless $self, $class; return $self; } @@ -52,7 +51,13 @@ sub AUTOLOAD { #XXX md5 encrypt pass - my $response = $ua->post($URL, { + my $URL_API = 'http://64.74.178.105/api.php'; + my $URL_FAX = 'http://64.74.178.105/fax.php'; + + my $url = $URL_API; + $url = $URL_FAX if $self->{apitype} eq 'fax'; + + my $response = $ua->post($url, { login => $self->{login}, pass => $self->{pass}, cmd => $cmd,