SOAP.pm

filter: Statementstmt 49.3% 38 / 77 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 12 / 20 Podpod 25.0% 2 / 8 totaltotal 49.5% 52 / 105 CC 2 SCAR 5.9
CC
2
Cov
49%
getItemByCategory
6.0
getAPI
2.0
new
2.0
CRAP 1.8
« SOAP/JavaDouble.pm ↑ Summary SOAP/Exception.pm »
1 package jBilling::Client::SOAP;
2  
3 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use jBilling::Client::SOAP::API;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use jBilling::Client::SOAP::OrderWS;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use jBilling::Client::SOAP::OrderLineWS;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use jBilling::Client::SOAP::MetaFieldValueWS;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use jBilling::Client::SOAP::ItemDTOEx;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use jBilling::Client::SOAP::ItemTypeWS;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use jBilling::Client::SOAP::PriceModelWS;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use jBilling::Client::SOAP::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Scalar::Util qw(looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 our $VERSION = 0.06;
17 1 my $API;
18  
19 0 ▶sub getAPI {
Subroutine getAPI: not called CC=1 SCAR=6.9
Pod documented
20  
21 # Expects a hash containing URL, Username and Password
22 0 my $self = shift;
23 0 my %args = @_;
24 0 $self->{'API'} = jBilling::Client::SOAP::API->new(%args);
25  
26 }
27  
28 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
29 0 my $class = shift;
30 0 my $self = {};
31 0 bless( $self, $class );
32 0 return $self;
33 }
34  
35 0 ▶sub createOrder {
Subroutine createOrder: not called CC=1 SCAR=6.9
Pod undocumented
36 0 my $self = shift;
37 0 my $orderWS = shift;
38  
39 # Pass the Order through to the API
40 0 my $response = $self->{'API'}->createOrder( SOAP::Data->value($orderWS) );
41 0 return $response->valueof('//return');
42  
43 }
44  
45 0 ▶sub createUpdateOrder {
Subroutine createUpdateOrder: not called CC=1 SCAR=6.9
Pod undocumented
46 0 my $self = shift;
47 0 my $orderWS = shift;
48  
49 # Pass the Order through to the API
50 my $response =
51 0 $self->{'API'}->createUpdateOrder( SOAP::Data->value($orderWS) );
52 0 return $response->valueof('//return');
53  
54 }
55  
56 0 ▶sub getOrder {
Subroutine getOrder: not called CC=1 SCAR=6.9
Pod undocumented
57 0 my $self = shift;
58 0 my $orderId = shift;
59 my $response =
60 0 $self->{'API'}->getOrder(
61 SOAP::Data->new( name => 'arg0', value => $orderId, type => 'xsd:int' )
62 );
63  
64 0 my $order = jBilling::Client::SOAP::OrderWS->new();
65  
66 # Populate a new OrderWS Object
67 0 $order->load( $response->valueof('//return') );
68 0 return $order;
69 }
70  
71 0 ▶sub getAllItems {
Subroutine getAllItems: not called CC=1 SCAR=6.9
Pod undocumented
72 0 my $self = shift;
73 0 my @items;
74  
75 0 my $response = $self->{'API'}->getAllItems();
76 0 print $response->valueof('//return');
77 }
78  
79 0 ▶sub getItemByCategory {
Subroutine getItemByCategory: not called CC=2 SCAR=17.9
Pod undocumented
80 0 my $self = shift;
81 0 my $type_id = shift;
82 0 my @items;
83  
84 my $response =
85 0 $self->{'API'}->getItemByCategory(
86 SOAP::Data->new( name => 'arg0', value => $type_id, type => 'xsd:int' )
87 );
88 0 my @returned = $response->valueof('//return');
89 0 foreach (@returned) {
90 0 my $itemDTOEx = jBilling::Client::SOAP::ItemDTOEx->new();
91 0 $itemDTOEx->load( \%{$_} );
92 0 push @items, $itemDTOEx;
93 }
94 0 return @items;
95 }
96  
97 0 ▶sub updateOrderLine {
Subroutine updateOrderLine: not called CC=1 SCAR=6.9
Pod undocumented
98 0 my $self = shift;
99 0 my @data = @_;
100  
101 my $response =
102 0 $self->{'API'}
103 ->updateOrderLine( SOAP::Data->new( name => 'arg0', value => \@data ) );
104 }
105  
106 1 1;
107  
108 =pod
109  
110 =head1 NAME
111  
112 jBilling::Client::SOAP - Communicate with jBilling
113  
114 =head1 VERSION
115  
116 Version 0.06
117  
118 =head1 SYNOPSIS
119  
120 This module acts as an interface for functionality exposed by the
121 jBilling SOAP API.
122  
123 =head2 Initialise the library
124  
125 C<< use jBilling::Client::SOAP;
126 my $jb = jBilling::Client::SOAP->new();
127 $jb->getAPI(
128 'username' => 'yourusername',
129 'password' => 'yourpassword',
130 'url' => 'http://yourservername:yourserverport/jbilling/services/api'
131 ); # Initialise the API
132 >>
133  
134 =head1 EXAMPLES
135
136 L<Retrieve an Order|https://bitbucket.org/guisea/jbilling-client-soap/src/c566a04ce73c78c52e5986873b899a5373730263/examples/RetrieveOrder.pl?at=master>
137  
138 L<Create a new order|https://bitbucket.org/guisea/jbilling-client-soap/src/c566a04ce73c78c52e5986873b899a5373730263/examples/CreateOrder.pl?at=master>
139  
140 =head1 SUBROUTINES/METHODS
141  
142 =head2 getAPI
143  
144 This method initiates a SOAP::Lite object for later re-use
145  
146 =head2 new
147  
148 Constructs the jBilling::Client::SOAP object
149  
150 =cut
« SOAP/JavaDouble.pm ↑ Summary SOAP/Exception.pm »