File Coverage

blib/lib/Business/cXML/Characteristic.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 2 2 100.0
total 31 31 100.0


line stmt bran cond sub pod time code
1             =encoding utf-8
2              
3             =head1 NAME
4              
5             Business::cXML::Characteristic - cXML product item characteristic
6              
7             =head1 SYNOPSIS
8              
9             use Business::cXML::Characteristic;
10              
11             =head1 DESCRIPTION
12              
13             Object representation of a cXML C<Characteristic>.
14              
15             A group of one or more characteristics would specify a configurable product
16             item (for example with colors, sizes, etc.)
17              
18             =head1 METHODS
19              
20             See L<Business::cXML::Object/COMMON METHODS>.
21              
22             =head1 PROPERTY METHODS
23              
24             See L<Business::cXML::Object/PROPERTY METHODS> for how the following operate.
25              
26             =over
27              
28             =cut
29              
30 1     1   1212 use 5.014;
  1         5  
31 1     1   5 use strict;
  1         3  
  1         48  
32              
33             use base qw(Business::cXML::Object);
34 1     1   6  
  1         2  
  1         139  
35             use constant NODENAME => 'Characteristic';
36 1     1   7 use constant PROPERTIES => (
  1         3  
  1         83  
37 1         52 domain => 'size',
38             value => '',
39             code => undef,
40             );
41 1     1   5  
  1         2  
42             use XML::LibXML::Ferry;
43 1     1   6  
  1         3  
  1         147  
44             my ($self, $el) = @_;
45             $el->ferry($self);
46 2     2 1 8 }
47 2         6  
48             my ($self, $doc) = @_;
49             return $doc->create($self->{_nodeName}, undef,
50             domain => $self->{domain},
51 2     2 1 77 value => $self->{value},
52             code => $self->{code},
53             );
54             }
55              
56 2         9 =item C<B<domain>>
57              
58             Mandatory, type of characteristic. For example: C<size> (default),
59             C<sizeCode>, C<color>, C<colorCode>, C<grade>, etc.
60              
61             =item C<B<value>>
62              
63             Mandatory, value for the domain. For example: a size C<70>.
64              
65             =item C<B<code>>
66              
67             Optional, additional information such as currency code or unit of measure.
68             For example, size 70 C<cm>.
69              
70             =back
71              
72             =head1 AUTHOR
73              
74             Stéphane Lavergne L<https://github.com/vphantom>
75              
76             =head1 ACKNOWLEDGEMENTS
77              
78             Graph X Design Inc. L<https://www.gxd.ca/> sponsored this project.
79              
80             =head1 COPYRIGHT & LICENSE
81              
82             Copyright (c) 2017-2018 Stéphane Lavergne L<https://github.com/vphantom>
83              
84             Permission is hereby granted, free of charge, to any person obtaining a copy
85             of this software and associated documentation files (the "Software"), to deal
86             in the Software without restriction, including without limitation the rights
87             to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
88             copies of the Software, and to permit persons to whom the Software is
89             furnished to do so, subject to the following conditions:
90              
91             The above copyright notice and this permission notice shall be included in all
92             copies or substantial portions of the Software.
93              
94             THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
95             IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
96             FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
97             AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
98             LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
99             OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
100             SOFTWARE.
101              
102             =cut
103              
104             1;