Shipment/Purolator/WSDL/Interfaces/ShippingService/ShippingServiceEndpoint.pm untested

filter: Statementstmt 0.0% 0 / 89 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 129 CC 9 SCAR 23.2
CC
9
Cov
0%
START
30.0
CreateShipment
6.0
VoidShipment
6.0
CRAP 10.2
1 package Shipment::Purolator::WSDL::Interfaces::ShippingService::ShippingServiceEndpoint;
2 $Shipment::Purolator::WSDL::Interfaces::ShippingService::ShippingServiceEndpoint::VERSION = '3.11';
3 use strict;
4 use warnings;
5 use Class::Std::Fast::Storable;
6 use Scalar::Util qw(blessed);
7 use base qw(SOAP::WSDL::Client::Base);
8  
9  
10 # only load if it hasn't been loaded before
11 require Shipment::Purolator::WSDL::Typemaps::ShippingService
12 if
13 not Shipment::Purolator::WSDL::Typemaps::ShippingService->can('get_class');
14  
15  
16 sub START {
17  
18 my $proxy_domain = $_[2]->{proxy_domain} || 'devwebservices.purolator.com';
19  
20 $_[0]->set_proxy(
21 'https://' . $proxy_domain . '/EWS/V1/Shipping/ShippingService.asmx')
22 if not $_[2]->{proxy};
23  
24 $_[0]->set_class_resolver(
25 'Shipment::Purolator::WSDL::Typemaps::ShippingService')
26 if not $_[2]->{class_resolver};
27  
28 $_[0]->set_prefix($_[2]->{use_prefix}) if exists $_[2]->{use_prefix};
29  
30 my $options = $_[2];
31 ## provide credentials
32 eval { use SOAP::Lite; };
33 if ($@) {
34 warn "SOAP::Lite not installed, using builtin SOAP::WSDL Transport";
35 *SOAP::WSDL::Transport::HTTP::get_basic_credentials =
36 sub { return ($options->{key}, $options->{password}); };
37 }
38 else {
39 *SOAP::Transport::HTTP::Client::get_basic_credentials =
40 sub { return ($options->{key}, $options->{password}); };
41 }
42 }
43  
44 sub CreateShipment {
45 my ($self, $body, $header) = @_;
46 die "CreateShipment must be called as object method (\$self is <$self>)"
47 if not blessed($self);
48 return $self->SUPER::call(
49 { operation => 'CreateShipment',
50 soap_action =>
51 'http://purolator.com/pws/service/v1/CreateShipment',
52 style => 'document',
53 body => {
54  
55  
56 'use' => 'literal',
57 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
58 encodingStyle => '',
59 parts => [
60 qw( Shipment::Purolator::WSDL::Elements::CreateShipmentRequest )
61 ],
62 },
63 header => {
64  
65 'use' => 'literal',
66 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
67 encodingStyle => '',
68 parts =>
69 [qw( Shipment::Purolator::WSDL::Elements::RequestContext )],
70  
71 },
72 headerfault => {
73  
74 },
75 response => {
76 header => {
77  
78  
79 'use' => 'literal',
80 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
81 encodingStyle => '',
82 parts => [
83 qw( Shipment::Purolator::WSDL::Elements::ResponseContext )
84 ],
85 },
86 body => {
87  
88  
89 'use' => 'literal',
90 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
91 encodingStyle => '',
92 parts => [
93 qw( Shipment::Purolator::WSDL::Elements::CreateShipmentResponse )
94 ],
95 },
96 }
97 },
98 $body,
99 $header
100 );
101 }
102  
103  
104 sub VoidShipment {
105 my ($self, $body, $header) = @_;
106 die "VoidShipment must be called as object method (\$self is <$self>)"
107 if not blessed($self);
108 return $self->SUPER::call(
109 { operation => 'VoidShipment',
110 soap_action => 'http://purolator.com/pws/service/v1/VoidShipment',
111 style => 'document',
112 body => {
113  
114  
115 'use' => 'literal',
116 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
117 encodingStyle => '',
118 parts => [
119 qw( Shipment::Purolator::WSDL::Elements::VoidShipmentRequest )
120 ],
121 },
122 header => {
123  
124 'use' => 'literal',
125 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
126 encodingStyle => '',
127 parts =>
128 [qw( Shipment::Purolator::WSDL::Elements::RequestContext )],
129  
130 },
131 headerfault => {
132  
133 },
134 response => {
135 header => {
136  
137  
138 'use' => 'literal',
139 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
140 encodingStyle => '',
141 parts => [
142 qw( Shipment::Purolator::WSDL::Elements::ResponseContext )
143 ],
144 },
145 body => {
146  
147  
148 'use' => 'literal',
149 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
150 encodingStyle => '',
151 parts => [
152 qw( Shipment::Purolator::WSDL::Elements::VoidShipmentResponse )
153 ],
154 },
155 }
156 },
157 $body,
158 $header
159 );
160 }
161  
162  
163 sub ValidateShipment {
164 my ($self, $body, $header) = @_;
165 die "ValidateShipment must be called as object method (\$self is <$self>)"
166 if not blessed($self);
167 return $self->SUPER::call(
168 { operation => 'ValidateShipment',
169 soap_action =>
170 'http://purolator.com/pws/service/v1/ValidateShipment',
171 style => 'document',
172 body => {
173  
174  
175 'use' => 'literal',
176 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
177 encodingStyle => '',
178 parts => [
179 qw( Shipment::Purolator::WSDL::Elements::ValidateShipmentRequest )
180 ],
181 },
182 header => {
183  
184 'use' => 'literal',
185 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
186 encodingStyle => '',
187 parts =>
188 [qw( Shipment::Purolator::WSDL::Elements::RequestContext )],
189  
190 },
191 headerfault => {
192  
193 },
194 response => {
195 header => {
196  
197  
198 'use' => 'literal',
199 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
200 encodingStyle => '',
201 parts => [
202 qw( Shipment::Purolator::WSDL::Elements::ResponseContext )
203 ],
204 },
205 body => {
206  
207  
208 'use' => 'literal',
209 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
210 encodingStyle => '',
211 parts => [
212 qw( Shipment::Purolator::WSDL::Elements::ValidateShipmentResponse )
213 ],
214 },
215 }
216 },
217 $body,
218 $header
219 );
220 }
221  
222  
223 sub Consolidate {
224 my ($self, $body, $header) = @_;
225 die "Consolidate must be called as object method (\$self is <$self>)"
226 if not blessed($self);
227 return $self->SUPER::call(
228 { operation => 'Consolidate',
229 soap_action => 'http://purolator.com/pws/service/v1/Consolidate',
230 style => 'document',
231 body => {
232  
233  
234 'use' => 'literal',
235 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
236 encodingStyle => '',
237 parts => [
238 qw( Shipment::Purolator::WSDL::Elements::ConsolidateRequest )
239 ],
240 },
241 header => {
242  
243 'use' => 'literal',
244 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
245 encodingStyle => '',
246 parts =>
247 [qw( Shipment::Purolator::WSDL::Elements::RequestContext )],
248  
249 },
250 headerfault => {
251  
252 },
253 response => {
254 header => {
255  
256  
257 'use' => 'literal',
258 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
259 encodingStyle => '',
260 parts => [
261 qw( Shipment::Purolator::WSDL::Elements::ResponseContext )
262 ],
263 },
264 body => {
265  
266  
267 'use' => 'literal',
268 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
269 encodingStyle => '',
270 parts => [
271 qw( Shipment::Purolator::WSDL::Elements::ConsolidateResponse )
272 ],
273 },
274 }
275 },
276 $body,
277 $header
278 );
279 }
280  
281  
282 sub _get_name_resolver {
283  
284 my $prefix_1 = {
285 'attribute' => 'Shipment::Purolator::WSDL::Attributes',
286 'typemap' => 'Shipment::Purolator::WSDL::Typemaps',
287 'interface' => 'Shipment::Purolator::WSDL::Interfaces',
288 'type' => 'Shipment::Purolator::WSDL::Types',
289 'server' => 'Shipment::Purolator::WSDL::Server',
290 'element' => 'Shipment::Purolator::WSDL::Elements'
291 };
292  
293  
294 return SOAP::WSDL::Generator::Template::Plugin::XSD->new(
295 { prefix_resolver => SOAP::WSDL::Generator::PrefixResolver->new(
296 { namespace_prefix_map => {
297 'http://www.w3.org/2001/XMLSchema' =>
298 'SOAP::WSDL::XSD::Typelib::Builtin',
299 },
300 namespace_map => {},
301 prefix => $prefix_1,
302 }
303 )
304 }
305 );
306 }
307  
308 1;
309  
310 __END__