Shipment/Purolator/WSDLV2/Interfaces/EstimatingService/EstimatingServiceEndpoint.pm untested

filter: Statementstmt 0.0% 0 / 65 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 97 CC 7 SCAR 24.1
CC
7
Cov
0%
START
30.0
GetQuickEstimate
6.0
GetFullEstimate
6.0
CRAP 11.2
1 package Shipment::Purolator::WSDLV2::Interfaces::EstimatingService::EstimatingServiceEndpoint;
2 $Shipment::Purolator::WSDLV2::Interfaces::EstimatingService::EstimatingServiceEndpoint::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::WSDLV2::Typemaps::EstimatingService
12 if not Shipment::Purolator::WSDLV2::Typemaps::EstimatingService->can(
13 'get_class');
14  
15  
16 sub START {
17  
18 my $proxy_domain = $_[2]->{proxy_domain} || 'devwebservices.purolator.com';
19  
20 $_[0]->set_proxy('https://'
21 . $proxy_domain
22 . '/EWS/V2/Estimating/EstimatingService.asmx')
23 if not $_[2]->{proxy};
24  
25 $_[0]->set_class_resolver(
26 'Shipment::Purolator::WSDLV2::Typemaps::EstimatingService')
27 if not $_[2]->{class_resolver};
28  
29 $_[0]->set_prefix($_[2]->{use_prefix}) if exists $_[2]->{use_prefix};
30  
31 my $options = $_[2];
32 ## provide credentials
33 eval { use SOAP::Lite; };
34 if ($@) {
35 warn "SOAP::Lite not installed, using builtin SOAP::WSDL Transport";
36 *SOAP::WSDL::Transport::HTTP::get_basic_credentials =
37 sub { return ($options->{key}, $options->{password}); };
38 }
39 else {
40 *SOAP::Transport::HTTP::Client::get_basic_credentials =
41 sub { return ($options->{key}, $options->{password}); };
42 }
43 }
44  
45 sub GetQuickEstimate {
46 my ($self, $body, $header) = @_;
47 die "GetQuickEstimate must be called as object method (\$self is <$self>)"
48 if not blessed($self);
49 return $self->SUPER::call(
50 { operation => 'GetQuickEstimate',
51 soap_action =>
52 'http://purolator.com/pws/service/v2/GetQuickEstimate',
53 style => 'document',
54 body => {
55  
56  
57 'use' => 'literal',
58 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
59 encodingStyle => '',
60 parts => [
61 qw( Shipment::Purolator::WSDLV2::Elements::GetQuickEstimateRequest )
62 ],
63 },
64 header => {
65  
66 'use' => 'literal',
67 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
68 encodingStyle => '',
69 parts => [
70 qw( Shipment::Purolator::WSDLV2::Elements::RequestContext )
71 ],
72  
73 },
74 headerfault => {
75  
76 },
77 response => {
78 header => {
79  
80  
81 'use' => 'literal',
82 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
83 encodingStyle => '',
84 parts => [
85 qw( Shipment::Purolator::WSDLV2::Elements::ResponseContext )
86 ],
87 },
88 body => {
89  
90  
91 'use' => 'literal',
92 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
93 encodingStyle => '',
94 parts => [
95 qw( Shipment::Purolator::WSDLV2::Elements::GetQuickEstimateResponse )
96 ],
97 },
98 }
99 },
100 $body,
101 $header
102 );
103 }
104  
105  
106 sub GetFullEstimate {
107 my ($self, $body, $header) = @_;
108 die "GetFullEstimate must be called as object method (\$self is <$self>)"
109 if not blessed($self);
110 return $self->SUPER::call(
111 { operation => 'GetFullEstimate',
112 soap_action =>
113 'http://purolator.com/pws/service/v2/GetFullEstimate',
114 style => 'document',
115 body => {
116  
117  
118 'use' => 'literal',
119 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
120 encodingStyle => '',
121 parts => [
122 qw( Shipment::Purolator::WSDLV2::Elements::GetFullEstimateRequest )
123 ],
124 },
125 header => {
126  
127 'use' => 'literal',
128 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
129 encodingStyle => '',
130 parts => [
131 qw( Shipment::Purolator::WSDLV2::Elements::RequestContext )
132 ],
133  
134 },
135 headerfault => {
136  
137 },
138 response => {
139 header => {
140  
141  
142 'use' => 'literal',
143 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
144 encodingStyle => '',
145 parts => [
146 qw( Shipment::Purolator::WSDLV2::Elements::ResponseContext )
147 ],
148 },
149 body => {
150  
151  
152 'use' => 'literal',
153 namespace => 'http://schemas.xmlsoap.org/wsdl/soap/',
154 encodingStyle => '',
155 parts => [
156 qw( Shipment::Purolator::WSDLV2::Elements::GetFullEstimateResponse )
157 ],
158 },
159 }
160 },
161 $body,
162 $header
163 );
164 }
165  
166  
167 sub _get_name_resolver {
168  
169 my $prefix_1 = {
170 'attribute' => 'Shipment::Purolator::WSDLV2::Attributes',
171 'typemap' => 'Shipment::Purolator::WSDLV2::Typemaps',
172 'interface' => 'Shipment::Purolator::WSDLV2::Interfaces',
173 'type' => 'Shipment::Purolator::WSDLV2::Types',
174 'server' => 'Shipment::Purolator::WSDLV2::Server',
175 'element' => 'Shipment::Purolator::WSDLV2::Elements'
176 };
177  
178  
179 return SOAP::WSDL::Generator::Template::Plugin::XSD->new(
180 { prefix_resolver => SOAP::WSDL::Generator::PrefixResolver->new(
181 { namespace_prefix_map => {
182 'http://www.w3.org/2001/XMLSchema' =>
183 'SOAP::WSDL::XSD::Typelib::Builtin',
184 },
185 namespace_map => {},
186 prefix => $prefix_1,
187 }
188 )
189 }
190 );
191 }
192  
193 1;
194  
195 __END__