File Coverage

blib/lib/Business/cXML/ShipTo.pm
Criterion Covered Total %
statement 39 39 100.0
branch n/a
condition n/a
subroutine 12 12 100.0
pod 2 2 100.0
total 53 53 100.0


line stmt bran cond sub pod time code
1             =encoding utf-8
2              
3             =head1 NAME
4              
5             Business::cXML::ShipTo - cXML ship-to address
6              
7             =head1 SYNOPSIS
8              
9             use Business::cXML::ShipTo;
10              
11             =head1 DESCRIPTION
12              
13             Object representation of a cXML ship-to address with transport details.
14              
15             =head1 METHODS
16              
17             See L<Business::cXML::Object/COMMON METHODS>.
18              
19             =head1 PROPERTY METHODS
20              
21             See L<Business::cXML::Object/PROPERTY METHODS> for how the following operate.
22              
23             =over
24              
25             =cut
26              
27 7     7   140986 use 5.014;
  7         32  
28 7     7   38 use strict;
  7         15  
  7         211  
29              
30             use base qw(Business::cXML::Object);
31 7     7   30  
  7         13  
  7         812  
32             use Business::cXML::Address;
33 7     7   2167 use Business::cXML::Carrier;
  7         14  
  7         182  
34 7     7   2112 use Business::cXML::Transport;
  7         22  
  7         151  
35 7     7   2527 use XML::LibXML::Ferry;
  7         18  
  7         156  
36 7     7   39  
  7         49  
  7         121  
37             use constant NODENAME => 'ShipTo';
38 7     7   30 use constant PROPERTIES => (
  7         12  
  7         411  
39 7         53 address => Business::cXML::Address->new(),
40             carriers => [],
41             transports => [],
42             );
43 7     7   44 use constant OBJ_PROPERTIES => (
  7         11  
44 7         1226 address => 'Business::cXML::Address',
45             carriers => 'Business::cXML::Carrier',
46             transports => 'Business::cXML::Transport',
47             );
48 7     7   43  
  7         15  
49             my ($self, $el) = @_;
50              
51 14     14 1 42 $el->ferry($self, {
52             Address => [ 'address', 'Business::cXML::Address' ],
53 14         98 CarrierIdentifier => [ 'carriers', 'Business::cXML::Carrier' ],
54             TransportInformation => [ 'transports', 'Business::cXML::Transport' ],
55             IdReference => '__UNIMPLEMENTED',
56             }
57             );
58             }
59              
60             my ($self, $doc) = @_;
61             my $node = $doc->create($self->{_nodeName});
62              
63 6     6 1 60 $node->add($self->{address}->to_node($node));
64 6         42 $node->add($_->to_node($node)) foreach (@{ $self->{carriers} });
65             $node->add($_->to_node($node)) foreach (@{ $self->{transports} });
66 6         100 # UNIMPLEMENTED: IdReference*
67 6         101  
  6         85  
68 6         256 return $node;
  6         40  
69             }
70              
71 6         251 =item C<B<address>>
72              
73             Optional, L<Business::cXML::Address> object
74              
75             =item C<B<carriers>[]>
76              
77             Optional, L<Business::cXML::Carrier> objects
78              
79             =item C<B<transports>[]>
80              
81             Optional, L<Business::cXML::Transport> objects
82              
83             =back
84              
85             =head1 AUTHOR
86              
87             Stéphane Lavergne L<https://github.com/vphantom>
88              
89             =head1 ACKNOWLEDGEMENTS
90              
91             Graph X Design Inc. L<https://www.gxd.ca/> sponsored this project.
92              
93             =head1 COPYRIGHT & LICENSE
94              
95             Copyright (c) 2017-2018 Stéphane Lavergne L<https://github.com/vphantom>
96              
97             Permission is hereby granted, free of charge, to any person obtaining a copy
98             of this software and associated documentation files (the "Software"), to deal
99             in the Software without restriction, including without limitation the rights
100             to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
101             copies of the Software, and to permit persons to whom the Software is
102             furnished to do so, subject to the following conditions:
103              
104             The above copyright notice and this permission notice shall be included in all
105             copies or substantial portions of the Software.
106              
107             THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
108             IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
109             FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
110             AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
111             LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
112             OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
113             SOFTWARE.
114              
115             =cut
116              
117             1;