summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2008-06-27 00:30:07 +0000
committerivan <ivan>2008-06-27 00:30:07 +0000
commit090a3e47b2880ff5b15027d2bcd29b0a448e2a9b (patch)
tree009a7cc9a65b0e7063ed867409fb7623824baaa4
parent1ed8df25cb58e83f7470c714062a946b8d19ae07 (diff)
slightly more testing/debugging. basically working
-rw-r--r--lib/Net/GlobalPOPs/MediaServicesAPI.pm26
-rw-r--r--t/41-auditDIDs.t38
2 files changed, 50 insertions, 14 deletions
diff --git a/lib/Net/GlobalPOPs/MediaServicesAPI.pm b/lib/Net/GlobalPOPs/MediaServicesAPI.pm
index 0f0a940..6b671fd 100644
--- a/lib/Net/GlobalPOPs/MediaServicesAPI.pm
+++ b/lib/Net/GlobalPOPs/MediaServicesAPI.pm
@@ -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;
}
diff --git a/t/41-auditDIDs.t b/t/41-auditDIDs.t
index 4bb8907..1a1f43e 100644
--- a/t/41-auditDIDs.t
+++ b/t/41-auditDIDs.t
@@ -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' );
+