| 1 | =encoding utf-8 | ||||||||||
| 2 | |||||||||||
| 3 | =head1 NAME | ||||||||||
| 4 | |||||||||||
| 5 | Business::cXML::Transport - cXML transport information | ||||||||||
| 6 | |||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||
| 8 | |||||||||||
| 9 | use Business::cXML::Transport; | ||||||||||
| 10 | |||||||||||
| 11 | =head1 DESCRIPTION | ||||||||||
| 12 | |||||||||||
| 13 | Object representation of a cXML transport information. | ||||||||||
| 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::Transport; | ||||||||||
| 31 | 2 | ▶ | use base qw(Business::cXML::Object); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 32 | |||||||||||
| 33 | 2 | ▶ | use constant NODENAME => 'TransportInformation'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 34 | 2 | ▶ | use constant PROPERTIES => ( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 35 | method => 'unknown', | ||||||||||
| 36 | means => undef, | ||||||||||
| 37 | start => undef, | ||||||||||
| 38 | end => undef, | ||||||||||
| 39 | contacts => [], | ||||||||||
| 40 | contract => undef, | ||||||||||
| 41 | instructions => undef, | ||||||||||
| 42 | 2 | ); | |||||||||
| 43 | 2 | ▶ | use constant OBJ_PROPERTIES => ( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 44 | contacts => 'Business::cXML::Contact', | ||||||||||
| 45 | instructions => 'Business::cXML::Description', | ||||||||||
| 46 | 2 | ); | |||||||||
| 47 | |||||||||||
| 48 | 2 | ▶ | use Business::cXML::Contact; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 49 | 2 | ▶ | use XML::LibXML::Ferry; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 50 | |||||||||||
| 51 | 2 | ▶ | sub from_node { | ||||||||
|
Subroutine
from_node: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 52 | 2 | my ($self, $el) = @_; | |||||||||
| 53 | |||||||||||
| 54 | 2 | $el->ferry($self, { | |||||||||
| 55 | Route => { | ||||||||||
| 56 | startDate => 'start', | ||||||||||
| 57 | endDate => 'end', | ||||||||||
| 58 | Contact => [ 'contacts', 'Business::cXML::Contact' ], | ||||||||||
| 59 | }, | ||||||||||
| 60 | ShippingContractNumber => 'contract', | ||||||||||
| 61 | ShippingInstructions => { | ||||||||||
| 62 | Description => [ 'instructions', 'Business::cXML::Description' ], | ||||||||||
| 63 | }, | ||||||||||
| 64 | } | ||||||||||
| 65 | ); | ||||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | 2 | ▶ | sub to_node { | ||||||||
|
Subroutine
to_node: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 69 | 2 | my ($self, $doc) = @_; | |||||||||
| 70 | 2 | my $node = $doc->create($self->{_nodeName}); | |||||||||
| 71 | my $route = $node->add('Route', undef, | ||||||||||
| 72 | method => $self->{method}, | ||||||||||
| 73 | means => $self->{means}, | ||||||||||
| 74 | startDate => $self->{start}, | ||||||||||
| 75 | endDate => $self->{end}, | ||||||||||
| 76 | 2 | ); | |||||||||
| 77 | 2 | $route->add($_->to_node($node)) foreach (@{ $self->{contacts} }); | |||||||||
| 78 | 2 | ▶ | $node->add('ShippingContractNumber', $self->{contract}) if defined $self->{contract}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 79 | 2 | ▶ | $node->add('ShippingInstructions')->add($self->{instructions}->to_node($node)) if defined $self->{instructions}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 80 | |||||||||||
| 81 | 2 | return $node; | |||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | =item C<B<method>> | ||||||||||
| 85 | |||||||||||
| 86 | Mandatory, one of: C<air>, C<motor>, C<rail>, C<ship>, C<mail>, C<multimodal>, | ||||||||||
| 87 | C<fixedTransport>, C<inlandWater>, C<unknown> (default), C<custom> | ||||||||||
| 88 | |||||||||||
| 89 | =item C<B<means>> | ||||||||||
| 90 | |||||||||||
| 91 | Optional, particular vessel | ||||||||||
| 92 | |||||||||||
| 93 | =item C<B<start>> | ||||||||||
| 94 | |||||||||||
| 95 | Optional, start date with timezone | ||||||||||
| 96 | |||||||||||
| 97 | =item C<B<stop>> | ||||||||||
| 98 | |||||||||||
| 99 | Optional, end date with timezone | ||||||||||
| 100 | |||||||||||
| 101 | =item C<B<contacts>[]> | ||||||||||
| 102 | |||||||||||
| 103 | Optional, L<Business::cXML::Contact> objects | ||||||||||
| 104 | |||||||||||
| 105 | =item C<B<contract>> | ||||||||||
| 106 | |||||||||||
| 107 | Optional, number or description of shipping contract | ||||||||||
| 108 | |||||||||||
| 109 | =item C<B<instructions>> | ||||||||||
| 110 | |||||||||||
| 111 | Optional, shipping instructions in a L<Business::cXML::Description> object | ||||||||||
| 112 | |||||||||||
| 113 | =back | ||||||||||
| 114 | |||||||||||
| 115 | =head1 AUTHOR | ||||||||||
| 116 | |||||||||||
| 117 | Stéphane Lavergne L<https://github.com/vphantom> | ||||||||||
| 118 | |||||||||||
| 119 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 120 | |||||||||||
| 121 | Graph X Design Inc. L<https://www.gxd.ca/> sponsored this project. | ||||||||||
| 122 | |||||||||||
| 123 | =head1 COPYRIGHT & LICENSE | ||||||||||
| 124 | |||||||||||
| 125 | Copyright (c) 2017-2018 Stéphane Lavergne L<https://github.com/vphantom> | ||||||||||
| 126 | |||||||||||
| 127 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||||||||||
| 128 | of this software and associated documentation files (the "Software"), to deal | ||||||||||
| 129 | in the Software without restriction, including without limitation the rights | ||||||||||
| 130 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||||||||
| 131 | copies of the Software, and to permit persons to whom the Software is | ||||||||||
| 132 | furnished to do so, subject to the following conditions: | ||||||||||
| 133 | |||||||||||
| 134 | The above copyright notice and this permission notice shall be included in all | ||||||||||
| 135 | copies or substantial portions of the Software. | ||||||||||
| 136 | |||||||||||
| 137 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||||||||
| 138 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||||||
| 139 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||||||||
| 140 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||||||||
| 141 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||||||||
| 142 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||||||||
| 143 | SOFTWARE. | ||||||||||
| 144 | |||||||||||
| 145 | =cut | ||||||||||
| 146 | |||||||||||
| 147 | 2 | 1; | |||||||||