Ikano/XMLUtil.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Ikano.pm ↑ Summary
1 package Net::Ikano::XMLUtil;
2  
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use base 'XML::Simple';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 use Data::Dumper;
7 use Switch;
8  
9 =head1 DESCRIPTION
10
11 Unfortunately the Ikano API schema has xs:sequence everywhere, so we need to have most elements in a particular order.
12 This class solves this problem by extending XML::Simple and overriding sorted_keys to provide the element order for each request.
13  
14 This is a helper class which should not be used directly. It requires particular options in the constructor (SuppressEmpty) which differ for XMLin and XMLout.
15  
16 =cut
17  
18 sub sorted_keys {
19 my ($self,$name,$hashref) = @_;
20  
21 switch ($name) {
22  
23 # quals
24 return qw( AddressLine1 AddressUnitType AddressUnitValue AddressCity
25 AddressState ZipCode Country LocationType ) case 'Address';
26 return qw( Address PhoneNumber CheckNetworks RequestClientIP ) case 'PreQual';
27  
28 # orders
29 return qw( type ProductCustomId DSLPhoneNumber VirtualPhoneNumber Password
30 TermsId PrequalId CompanyName FirstName MiddleName LastName
31 ContactMethod ContactPhoneNumber ContactEmail ContactFax DateToOrder
32 RequestClientIP IspChange IspPrevious CurrentProvider ) case 'Order';
33  
34 # password change
35 return qw( DSLPhoneNumber NewPassword ) case 'PasswordChange';
36  
37 # account status change
38 return qw( type DSLServiceId DSLPhoneNumber ) case 'AccountStatusChange';
39  
40 }
41 return $self->SUPER::sorted_keys($name, $hashref);
42 }
43  
44 1;
« Ikano.pm ↑ Summary