File Coverage

blib/lib/Interchange6/Schema/Result/ShipmentRate.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1 2     2   1138 use utf8;
  2         6  
  2         14  
2              
3             package Interchange6::Schema::Result::ShipmentRate;
4              
5             =head1 NAME
6              
7             Interchange6::Schema::Result::ShipmentRate
8              
9             =cut
10              
11 2         16 use Interchange6::Schema::Candy -components =>
12 2     2   111 [qw(InflateColumn::DateTime TimeStamp)];
  2         5  
13              
14             =head1 DESCRIPTION
15              
16             In the context of shipment the rate is the value give for a shipping method based on
17             desination zone_id and weight.
18              
19             =over 4
20              
21             =item * Flat rate shipping
22              
23             If min_weight and max_weight are set to 0 for a shipping method and zone flate rate will be
24             assumed. If min_weight is set and max_weight is 0 max weight is assumed as infinite.
25              
26             =back
27              
28             =head1 ACCESSORS
29              
30             =head2 shipment_rates_id
31              
32             Primary key.
33              
34             =cut
35              
36             primary_column shipment_rates_id =>
37             { data_type => "integer", is_auto_increment => 1 };
38              
39             =head2 zones_id
40              
41             FK on L<Interchange6::Schema::Result::Zone/zones_id>
42              
43             =cut
44              
45             column zones_id =>
46             { data_type => "integer" };
47              
48             =head2 shipment_methods_id
49              
50             FK on L<Interchange6::Schema::Result::ShipmentMethod/shipment_methods_id>
51              
52             =cut
53              
54             column shipment_methods_id =>
55             { data_type => "integer" };
56              
57             =head2 value_type
58              
59             Type of value stored in </min_value> and </max_value>, e.g.: weight, volume
60              
61             Is nullable.
62              
63             =cut
64              
65             column value_type => {
66             data_type => "varchar",
67             size => 64,
68             is_nullable => 1,
69             };
70              
71             =head2 value_unit
72              
73             Unit of measurement for L</value_type>, e.g.: kg, meter, cubic meter, lb, oz
74              
75             Is nullable.
76              
77             =cut
78              
79             column value_unit => {
80             data_type => "varchar",
81             size => 64,
82             is_nullable => 1,
83             };
84              
85             =head2 min_value
86              
87             Minimum value of L</value_type>.
88              
89             =cut
90              
91             column min_value => {
92             data_type => "numeric",
93             default_value => 0,
94             size => [ 10, 2 ]
95             };
96              
97             =head2 max_value
98              
99             Maximum value of L</value_type>.
100              
101             =cut
102              
103             column max_value => {
104             data_type => "numeric",
105             default_value => 0,
106             size => [ 10, 2 ]
107             };
108              
109             =head2 price
110              
111             Price.
112              
113             =cut
114              
115             column price => {
116             data_type => "numeric",
117             default_value => 0,
118             size => [ 21, 3 ],
119             };
120              
121             =head2 valid_from
122              
123             Date from which rate is valid. Defaults to time record is created.
124              
125             =cut
126              
127             column valid_from => { data_type => "date", set_on_create => 1 };
128              
129             =head2 valid_to
130              
131             Final date on which rate is valid.
132              
133             Is nullable.
134              
135             =cut
136              
137             column valid_to => { data_type => "date", is_nullable => 1 };
138              
139             =head2 created
140              
141              
142             Date and time when this record was created returned as L<DateTime> object.
143             Value is auto-set on insert.
144              
145             =cut
146              
147             column created =>
148             { data_type => "datetime", set_on_create => 1 };
149              
150             =head2 last_modified
151              
152             Date and time when this record was last modified returned as L<DateTime> object.
153             Value is auto-set on insert and update.
154              
155             =cut
156              
157             column last_modified => {
158             data_type => "datetime",
159             set_on_create => 1,
160             set_on_update => 1,
161             };
162              
163             =head1 RELATIONS
164              
165             =head2 zone
166              
167             Type: belongs_to
168              
169             Related object: L<Interchange6::Schema::Result::Zone>
170              
171             =cut
172              
173             belongs_to
174             zone => "Interchange6::Schema::Result::Zone",
175             "zones_id",
176             { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" };
177              
178             =head2 shipment_method
179              
180             Type: belongs_to
181              
182             Related object: L<Interchange6::Schema::Result::ShipmentMethod>
183              
184             =cut
185              
186             belongs_to
187             shipment_method => "Interchange6::Schema::Result::ShipmentMethod",
188             "shipment_methods_id",
189             { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" };
190              
191             1;