slightly more testing/debugging. basically working
authorivan <ivan>
Fri, 27 Jun 2008 00:30:07 +0000 (00:30 +0000)
committerivan <ivan>
Fri, 27 Jun 2008 00:30:07 +0000 (00:30 +0000)
lib/Net/GlobalPOPs/MediaServicesAPI.pm
t/41-auditDIDs.t

index 0f0a940..6b671fd 100644 (file)
@@ -109,7 +109,7 @@ sub AUTOLOAD {
   $w->xmlDecl('ISO-8859-1');
   $w->doctype('request', undef, $URL);
 
-  $w->startTag('request', 'id' => '1');  #XXX request ID???
+  $w->startTag('request', 'id' => '');  #XXX request ID???
     $w->startTag('header');
       $w->startTag('sender');
 
@@ -144,7 +144,7 @@ sub AUTOLOAD {
 
   $w->endTag('request');
 
-  $output =~ s/\n\n/\n/g;
+  #$output =~ s/\n+/\n/g;
 
   warn "XML Request for $function function:\n$output"
     if $self->{'debug'};
@@ -152,9 +152,12 @@ sub AUTOLOAD {
   my( $page, $response, %reply_headers ) = https_post(
     'host'         => $HOST,
     'path'         => $PATH,
-    'content'      => $output,
-    'Content-Type' => 'text/plain',
-    'headers' => {},
+    'args'         => { 'apidata' => $output, },
+    #'content'      => $output,
+    #'Content-Type' => 'text/plain',
+    #'Content-Type' => 'text/xml',
+    #'Content-Type' => 'application/xml',
+    #'headers' => {},
     'debug'        => $self->{'debug'},
   );
 
@@ -166,12 +169,17 @@ sub AUTOLOAD {
   warn "XML Response for $function function:\n: $page"
     if $self->{'debug'};
 
-  my $hashref = XMLin $page;
+  my $hashref = XMLin( $page );
 
-  warn "Parsed response for $function funtion:\n: ". Dumper($hashref)
-    if $self->{'debug'}
+  warn "Parsed response for $function funtion:\n". Dumper($hashref)
+    if $self->{'debug'};
+
+  my $return = $hashref->{'body'};
+
+  warn "Returning data:\n". Dumper($return)
+    if $self->{'debug'};
 
-  %$hashref;
+  $return;
 
 }
 
index 4bb8907..1a1f43e 100644 (file)
@@ -1,13 +1,11 @@
 #!/usr/bin/perl -w
-#
-$Net::SSLeay::ssl_version = 10;
 
 use Test::More; # skip_all => 'wtf';
 
 require 't/lib/test_account.pl';
 
 my($login, $password) = test_account_or_skip();
-plan tests => 2;
+plan tests => 4;
 
 use_ok 'Net::GlobalPOPs::MediaServicesAPI';
 
@@ -20,7 +18,37 @@ my $gp = Net::GlobalPOPs::MediaServicesAPI->new( 'login'    => $login,
 my $return = $gp->auditDIDs();
 
 use Data::Dumper;
-diag( Dumper($return) ) if $debug;
+#diag( Dumper($return) ) if $debug;
 
-#XXX test some things about the return...
 ok( $return, 'auditDIDs returned something' );
+
+#         'did' => [
+#                   {
+#                     'statuscode' => '100',
+#                     'status' => 'Number currently assigned to you with refid  rewritten as \'\' to endpoint 521',
+#                     'cnam' => 'False',
+#                     'expire_seconds' => {},
+#                     'availability' => 'assigned',
+#                     'tn' => '2137851430',
+#                     'rewrite' => {},
+#                     'endpoint' => '521',
+#                     'refid' => {}
+#                   },
+#                   {
+#                     'statuscode' => '100',
+#                     'status' => 'Number currently assigned to you with refid  rewritten as \'\' to endpoint 521',
+#                     'cnam' => 'False',
+#                     'expire_seconds' => {},
+#                     'availability' => 'assigned',
+#                     'tn' => '5109626974',
+#                     'rewrite' => {},
+#                     'endpoint' => '521',
+#                     'refid' => {}
+#                   }
+#                 ]
+
+
+ok( $return->{'did'}, 'auditDIDs returned did data' );
+
+ok( ref($return->{'did'}) eq 'ARRAY', 'auditDIDs did data is a list' );
+