SOAP/API.pm

filter: Statementstmt 43.2% 16 / 37 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 62.5% 5 / 8 Podpod 0.0% 0 / 2 totaltotal 29.1% 21 / 72 CC 8 SCAR 33.1
CC
8
Cov
29%
new
56.0
stripURL
6.0
__ANON__
2.0
CRAP 27.4
« SOAP/Object.pm ↑ Summary SOAP/MetaFieldValueWS.pm »
1 package jBilling::Client::SOAP::API;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use jBilling::Client::SOAP::Exception ( VERBOSE => 1 );
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 our $VERSION = 0.02;
7 #use SOAP::Lite +trace => [ transport => sub { print $_[0]->as_string } ];
8 1 ▶use SOAP::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 0 ▶sub new {
Subroutine new: not called CC=7 SCAR=40.3
Pod undocumented
10 0 my $class = shift;
11 0 my $self = {};
12 0 bless( $self, $class );
13 0 my %input = @_;
14
15 0 ▶ if ( (defined($input{'url'}) and $input{'url'} ne '')
Branch: 1 branch
BranchTrueFalseTotal
if (defined $input{'url'} and $input{'url'} ne '' and (defined $input{'username'} and $input{'username'} ne '') and (defined $input{'password'} and $input{'password'} ne '')) { } 0 0 0
Condition0%0/15
defined $input{"url"} and $input{"url"} ne "" and (defined $input{"username"} and $input{"username"} ne "") and (defined $input{"password"} and $input{"password"} ne "")
!ll&&!rl&&r
000
defined $input{"url"} and $input{"url"} ne "" and (defined $input{"username"} and $input{"username"} ne "")
!ll&&!rl&&r
000
defined $input{"url"} and $input{"url"} ne ""
!ll&&!rl&&r
000
defined $input{"username"} and $input{"username"} ne ""
!ll&&!rl&&r
000
defined $input{"password"} and $input{"password"} ne ""
!ll&&!rl&&r
000
MC/DC0%0/6
defined $input{"url"} and $input{"url"} ne "" and (defined $input{"username"} and $input{"username"} ne "") and (defined $input{"password"} and $input{"password"} ne "")
defined $input{"url"} $input{"url"} ne "" defined $input{"username"} $input{"username"} ne "" defined $input{"password"} $input{"password"} ne ""
Truth table0%0/7
A and B and C and D and E and F
A= defined $input{"url"}B= $input{"url"} ne ""C= defined $input{"username"}D= $input{"username"} ne ""E= defined $input{"password"}F= $input{"password"} ne ""
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
16 and (defined($input{'username'}) and $input{'username'} ne '')
17 and (defined($input{'password'}) and $input{'password'} ne '')
18 )
19 {
20
21 # All needed values are supplied
22 0 my %address = $self->stripURL( $input{'url'} ); # Strip the URL Parts
23 my $proxyurl =
24 $address{'protocol'}
25 . $input{'username'} . ':'
26 . $input{'password'} . '@'
27 0 . $address{'url'}; # Assemble the proxy URL
28 my $soap =
29 SOAP::Lite->new->proxy($proxyurl)
30 ->ns( 'http://jbilling.com/', 'jbilling' )
31 ->readable('1')
32 0 ▶ ->on_fault( sub { my($soap, $res) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
33 0 throw jBilling::Client::SOAP::Exception $res->faultstring . " : " . $soap->transport->status; }
34 0 ); # Initiate a new SOAP::Lite object
35 0 return $soap; # Return the object
36 }
37 else {
38 0 throw jBilling::Client::SOAP::Exception 'Username, Password and URL are needed but not supplied!';
39 }
40 }
41
42
43 0 ▶sub stripURL {
Subroutine stripURL: not called CC=2 SCAR=17.9
Pod undocumented
44
45 # This function stips HTTP/S etc from url and stores for re-assembly
46 0 my $self = shift;
47 0 my $input = shift;
48 0 my %parts;
49 0 $input =~ m/(https:\/\/|http:\/\/)/;
50
51 0 ▶ if ($1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($1) 0 0 0
52
53 # This is the value we are removing so need to put back
54 0 $parts{'protocol'} = $1;
55 }
56 0 $input =~ s/(https:\/\/|http:\/\/)//;
57 0 $parts{'url'} = $input;
58
59 # Return the hash contining the protocol and remaining URL parts.
60 0 return %parts;
61 }
62 1 1;
63
64 =pod
65
66 =encoding UTF-8
67
68 =head1 NAME
69
70 jBilling::Client::SOAP::API
71
72 =head1 VERSION
73
74 version 0.02
75
76 =head1 AUTHOR
77
78 Aaron Guise <guisea@cpan.org>
79
80 =head1 COPYRIGHT AND LICENSE
81
82 This software is copyright (c) 2015 by Aaron Guise.
83
84 This is free software; you can redistribute it and/or modify it under
85 the same terms as the Perl 5 programming language system itself.
86
87 =cut
« SOAP/Object.pm ↑ Summary SOAP/MetaFieldValueWS.pm »