summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevinse <levinse>2011-01-08 05:44:18 +0000
committerlevinse <levinse>2011-01-08 05:44:18 +0000
commit63498d3d6b197e11c376b9532048d385cd8214c4 (patch)
treeb41103955642f0296b0eb4246120cb61b0d9ba5f
parent1c44f99502f6e71b3665faed6317ff770cfbd15d (diff)
Allow use of fax API
-rw-r--r--lib/Net/Vitelity.pm11
1 files changed, 8 insertions, 3 deletions
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,