| 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 | 2 | ▶ | use 5.014; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 29 | |||
| 30 | package Business::cXML::ShipTo; | ||
| 31 | 2 | ▶ | use base qw(Business::cXML::Object); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 32 | |||
| 33 | 2 | ▶ | use Business::cXML::Address; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 34 | 2 | ▶ | use Business::cXML::Carrier; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 35 | 2 | ▶ | use Business::cXML::Transport; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | 2 | ▶ | use XML::LibXML::Ferry; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 37 | |||
| 38 | 2 | ▶ | use constant NODENAME => 'ShipTo'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 39 | 2 | ▶ | use constant PROPERTIES => ( |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 40 | address => Business::cXML::Address->new(), | ||
| 41 | carriers => [], | ||
| 42 | transports => [], | ||
| 43 | 2 | ); | |
| 44 | 2 | ▶ | use constant OBJ_PROPERTIES => ( |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 45 | address => 'Business::cXML::Address', | ||
| 46 | carriers => 'Business::cXML::Carrier', | ||
| 47 | transports => 'Business::cXML::Transport', | ||
| 48 | 2 | ); | |
| 49 | |||
| 50 | 2 | ▶ | sub from_node { |
|
Subroutine
from_node: called CC=1 SCAR=0.0
Pod
documented
| |||
| 51 | 2 | my ($self, $el) = @_; | |
| 52 | |||
| 53 | 2 | $el->ferry($self, { | |
| 54 | Address => [ 'address', 'Business::cXML::Address' ], | ||
| 55 | CarrierIdentifier => [ 'carriers', 'Business::cXML::Carrier' ], | ||
| 56 | TransportInformation => [ 'transports', 'Business::cXML::Transport' ], | ||
| 57 | IdReference => '__UNIMPLEMENTED', | ||
| 58 | } | ||
| 59 | ); | ||
| 60 | } | ||
| 61 | |||
| 62 | 1 | ▶ | sub to_node { |
|
Subroutine
to_node: called CC=3 SCAR=11.0
Pod
documented
| |||
| 63 | 1 | my ($self, $doc) = @_; | |
| 64 | 1 | my $node = $doc->create($self->{_nodeName}); | |
| 65 | |||
| 66 | 1 | $node->add($self->{address}->to_node($node)); | |
| 67 | 1 | $node->add($_->to_node($node)) foreach (@{ $self->{carriers} }); | |
| 68 | 1 | $node->add($_->to_node($node)) foreach (@{ $self->{transports} }); | |
| 69 | # UNIMPLEMENTED: IdReference* | ||
| 70 | |||
| 71 | 1 | return $node; | |
| 72 | } | ||
| 73 | |||
| 74 | =item C<B<address>> | ||
| 75 | |||
| 76 | Optional, L<Business::cXML::Address> object | ||
| 77 | |||
| 78 | =item C<B<carriers>[]> | ||
| 79 | |||
| 80 | Optional, L<Business::cXML::Carrier> objects | ||
| 81 | |||
| 82 | =item C<B<transports>[]> | ||
| 83 | |||
| 84 | Optional, L<Business::cXML::Transport> objects | ||
| 85 | |||
| 86 | =back | ||
| 87 | |||
| 88 | =head1 AUTHOR | ||
| 89 | |||
| 90 | Stéphane Lavergne L<https://github.com/vphantom> | ||
| 91 | |||
| 92 | =head1 ACKNOWLEDGEMENTS | ||
| 93 | |||
| 94 | Graph X Design Inc. L<https://www.gxd.ca/> sponsored this project. | ||
| 95 | |||
| 96 | =head1 COPYRIGHT & LICENSE | ||
| 97 | |||
| 98 | Copyright (c) 2017-2018 Stéphane Lavergne L<https://github.com/vphantom> | ||
| 99 | |||
| 100 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 101 | of this software and associated documentation files (the "Software"), to deal | ||
| 102 | in the Software without restriction, including without limitation the rights | ||
| 103 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 104 | copies of the Software, and to permit persons to whom the Software is | ||
| 105 | furnished to do so, subject to the following conditions: | ||
| 106 | |||
| 107 | The above copyright notice and this permission notice shall be included in all | ||
| 108 | copies or substantial portions of the Software. | ||
| 109 | |||
| 110 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 111 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 112 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 113 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 114 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 115 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 116 | SOFTWARE. | ||
| 117 | |||
| 118 | =cut | ||
| 119 | |||
| 120 | 2 | 1; | |