initial version appears to be hooked up and working against dev sandbox
authorIvan Kohler <ivan@freeside.biz>
Sun, 26 Jan 2014 00:53:20 +0000 (16:53 -0800)
committerIvan Kohler <ivan@freeside.biz>
Sun, 26 Jan 2014 00:53:20 +0000 (16:53 -0800)
Changes
MANIFEST
MYMETA.yml
Makefile.PL
README
lib/Net/VoIP_Innovations.pm
t/01-login.t [deleted file]
t/61-getDID.t
t/62-getDIDs.t
t/lib/test_account.pl

diff --git a/Changes b/Changes
index 95c439c..1651732 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for Net-VoIP_Innovations
 
 Revision history for Net-VoIP_Innovations
 
+3.00    unreleased
+        - rewrite for VoIP Innovations API 3.0
+
 2.00    unreleased
         - update for VoIP Innovations API 2.0, rename to Net::VoIP_Innovations
 
 2.00    unreleased
         - update for VoIP Innovations API 2.0, rename to Net::VoIP_Innovations
 
index 60ec711..ee82687 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -4,7 +4,7 @@ Makefile.PL
 README
 lib/Net/VoIP_Innovations.pm
 t/00-load.t
 README
 lib/Net/VoIP_Innovations.pm
 t/00-load.t
-t/01-login.t
+t/01-new.t
 t/41-auditDIDs.t
 t/61-getDID.t
 t/62-getDIDs.t
 t/41-auditDIDs.t
 t/61-getDID.t
 t/62-getDIDs.t
index b1501c1..74c0307 100644 (file)
@@ -6,9 +6,8 @@ build_requires:
   ExtUtils::MakeMaker: 0
 configure_requires:
   ExtUtils::MakeMaker: 0
   ExtUtils::MakeMaker: 0
 configure_requires:
   ExtUtils::MakeMaker: 0
-distribution_type: module
 dynamic_config: 0
 dynamic_config: 0
-generated_by: 'ExtUtils::MakeMaker version 6.57_05'
+generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921'
 license: unknown
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
 license: unknown
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -19,8 +18,7 @@ no_index:
     - t
     - inc
 requires:
     - t
     - inc
 requires:
-  Net::HTTPS::Any: 0.1
+  Data::Dumper: 0
+  SOAP::Lite: 0
   Test::More: 0
   Test::More: 0
-  XML::Simple: 0
-  XML::Writer: 0
-version: 2.00
+version: 3.00_01
index 74049bb..202d858 100644 (file)
@@ -10,9 +10,8 @@ WriteMakefile(
     PL_FILES            => {},
     PREREQ_PM => {
         'Test::More'      => 0,
     PL_FILES            => {},
     PREREQ_PM => {
         'Test::More'      => 0,
-        'XML::Simple'     => 0,
-        'XML::Writer'     => 0,
-        'Net::HTTPS::Any' => 0.10
+        'Data::Dumper'    => 0,
+        'SOAP::Lite'      => 0,
     },
     dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
     clean               => { FILES => 'Net-VoIP_Innovations-*' },
     },
     dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
     clean               => { FILES => 'Net-VoIP_Innovations-*' },
diff --git a/README b/README
index 0f64da5..6d47d84 100644 (file)
--- a/README
+++ b/README
@@ -1,8 +1,8 @@
 Net-VoIP_Innovations
 
 Net-VoIP_Innovations
 
-This is an interface to the VoIP Innovations (formerly GlobalPOPs) API for
-wholesale DID (phone number) provisioning.  It is only useful if you have an
-account with GlobalPOPs wholesale VoIP service.
+This is an interface to the VoIP Innovations API for wholesale DID (phone
+number) provisioning.  It is only useful if you have an account with
+VoIP Innovations.
 
 
 INSTALLATION
 
 
 INSTALLATION
@@ -39,7 +39,7 @@ You can also look for information at:
 
 COPYRIGHT AND LICENCE
 
 
 COPYRIGHT AND LICENCE
 
-Copyright (C) 2008 Freeside Internet Services, Inc. (http://freeside.biz/)
+Copyright (C) 2014 Freeside Internet Services, Inc. (http://freeside.biz/)
 
 This program is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.
 
 This program is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.
index bd56c8b..01affe2 100644 (file)
@@ -3,9 +3,8 @@ package Net::VoIP_Innovations;
 use warnings;
 use strict;
 use Data::Dumper;
 use warnings;
 use strict;
 use Data::Dumper;
-use XML::Simple;
-use XML::Writer;
-use Net::HTTPS::Any qw( 0.10 https_post );
+use SOAP::Lite;
+#SOAP::Lite->import(+trace=>'debug');
 
 =head1 NAME
 
 
 =head1 NAME
 
@@ -13,19 +12,16 @@ Net::VoIP_Innovations - Interface to VoIP_Innovations API
 
 =cut
 
 
 =cut
 
-our $VERSION = '2.00';
-our $URL     = 'https://www.loginto.us/VOIP/api2.pl';
-#could be parsed from URL, if it mattered...
-our $HOST    = 'www.loginto.us';
-our $PATH    = '/VOIP/api2.pl';
-our $PORT    = 443; #to allow testing to override
+our $VERSION = '3.00_01';
+our $URI     = 'http://dev.voipinnovations.com/VOIP/Services/APIService.asmx';
+our $NS      = 'http://tempuri.org'; #nice one
 
 our $AUTOLOAD;
 our $errstr = '';
 
 =head1 SYNOPSIS
 
 
 our $AUTOLOAD;
 our $errstr = '';
 
 =head1 SYNOPSIS
 
-    use Net::VoIP_Innovations;
+    use Net::VoIP_Innovations 3;
 
     my $handle = Net::VoIP_Innovations->new(
         'login'    => 'tofu',
 
     my $handle = Net::VoIP_Innovations->new(
         'login'    => 'tofu',
@@ -42,6 +38,9 @@ our $errstr = '';
     #releaseDID
 
     #911 Functions
     #releaseDID
 
     #911 Functions
+    #insert911
+    #update911
+    #remove911
 
     #Locator Functions
 
 
     #Locator Functions
 
@@ -58,9 +57,9 @@ as a hash reference or a flat list of names and values.
 
 =item login (required)
 
 
 =item login (required)
 
-=item password (required)
+=item password (secret) (required)
 
 
-=item login (required)
+=item debug
 
 =back
 
 
 =back
 
@@ -101,7 +100,26 @@ sub AUTOLOAD {
   $AUTOLOAD =~ /(^|::)(\w+)$/ or die "unparsable AUTOLOAD: $AUTOLOAD";
   my $function = $2;
 
   $AUTOLOAD =~ /(^|::)(\w+)$/ or die "unparsable AUTOLOAD: $AUTOLOAD";
   my $function = $2;
 
-  my $output;
+  $opts->{'login'}  ||= $self->{'login'};
+  $opts->{'secret'} ||= $self->{'password'};
+  my @soap_opts = map { SOAP::Data->name($_)->value( $opts->{$_} ) }
+                    keys %$opts;
+
+  my $result = SOAP::Lite
+                 ->proxy($URI)
+                 #->uri($NS)
+                 ->default_ns($NS)
+                 ->on_action( sub { join '/', @_ } )
+                 ->$function( @soap_opts )
+                 ->result();
+
+  #warn Dumper($result);
+
+}
+
+=cut 
+
+sub PROTOTYPE_AUTOLOAD {
   my $w = new XML::Writer(OUTPUT => \$output, DATA_MODE => 1, DATA_INDENT => 3);
 
   $w->xmlDecl('ISO-8859-1');
   my $w = new XML::Writer(OUTPUT => \$output, DATA_MODE => 1, DATA_INDENT => 3);
 
   $w->xmlDecl('ISO-8859-1');
@@ -232,7 +250,7 @@ L<http://search.cpan.org/dist/Net-VoIP_Innovations>
 
 =head1 COPYRIGHT & LICENSE
 
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2008-2012 Freeside Internet Services, Inc. (http://freeside.biz/)
+Copyright 2014 Freeside Internet Services, Inc. (http://freeside.biz/)
 
 This program is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.
 
 This program is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.
@@ -249,4 +267,4 @@ http://freeside.biz/freeside/
 
 =cut
 
 
 =cut
 
-1; # End of Net::VoIP_Innovations
+1;
diff --git a/t/01-login.t b/t/01-login.t
deleted file mode 100644 (file)
index 2642b59..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/perl -w
-
-use Test::More;
-require 't/lib/test_account.pl';
-
-my($login, $password) = test_account_or_skip;
-plan tests => 2;
-
-use_ok 'Net::VoIP_Innovations';
-
-my $gp = Net::VoIP_Innovations->new('login'    => $login,
-                                    'password' => $password );
-
-#eww.  what is the right, TEST_VERBOSE-aware way to do this
-warn Net::VoIP_Innovations->errstr unless $gp;
-
-ok( $gp, 'Login sucessful' );
index 15dfe54..cd1b8d9 100644 (file)
@@ -22,7 +22,8 @@ my $gp = Net::VoIP_Innovations->new( 'login'    => $login,
 my $return = $gp->getDID();
 
 use Data::Dumper;
 my $return = $gp->getDID();
 
 use Data::Dumper;
-diag( Dumper($return) ) if $debug;
 
 
-#XXX test some things about the return...
-ok( $return, 'getDID returned something' );
+#test some things about the return...
+ok( $return->{type} ne 'Error', 'getDID returned no error' );
+diag( Dumper($return) ) if $return->{type} eq 'Error';
+
index 52f0170..79c33e7 100644 (file)
@@ -18,6 +18,7 @@ my $debug = $ENV{TEST_VERBOSE};
 
 my $gp = Net::VoIP_Innovations->new( 'login'    => $login,
                                      'password' => $password,
 
 my $gp = Net::VoIP_Innovations->new( 'login'    => $login,
                                      'password' => $password,
+                                     #'debug' => 2,
                                      #'debug'    => $debug,
                                    );
 my $return = $gp->getDIDs(
                                      #'debug'    => $debug,
                                    );
 my $return = $gp->getDIDs(
@@ -28,7 +29,8 @@ my $return = $gp->getDIDs(
 );
 
 use Data::Dumper;
 );
 
 use Data::Dumper;
-diag( Dumper($return) ); # if $debug;
 
 
-#XXX test some things about the return...
-ok( $return, 'getDIDs returned something' );
+#test some things about the return...
+ok( $return->{type} ne 'Error', 'getDIDs returned no error' );
+diag( Dumper($return) ) if $return->{type} eq 'Error';
+
index c52067d..b4ce640 100644 (file)
@@ -15,13 +15,13 @@ sub test_account {
     my($login, $password, $hostport) = <TEST_ACCOUNT>;
     chomp $login;
     chomp $password;
     my($login, $password, $hostport) = <TEST_ACCOUNT>;
     chomp $login;
     chomp $password;
-    chomp $hostport;
+    #chomp $hostport;
 
 
-    if ( $hostport =~ /^\s*([\w\.]+)(:(\d+))?\s*$/ ) {
-      my($host, $port) = ($1, $3);
-      $Net::VoIP_Innovations::HOST = $host;
-      $Net::VoIP_Innovations::PORT = $port;
-    }
+    #if ( $hostport =~ /^\s*([\w\.]+)(:(\d+))?\s*$/ ) {
+    #  my($host, $port) = ($1, $3);
+    #  $Net::VoIP_Innovations::HOST = $host;
+    #  $Net::VoIP_Innovations::PORT = $port;
+    #}
 
     return($login, $password);
 }
 
     return($login, $password);
 }