Allow use of fax API
authorlevinse <levinse>
Sat, 8 Jan 2011 05:44:18 +0000 (05:44 +0000)
committerlevinse <levinse>
Sat, 8 Jan 2011 05:44:18 +0000 (05:44 +0000)
lib/Net/Vitelity.pm

index 1259820..2e6dc53 100644 (file)
@@ -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,