| 1 | package Nitesi::Address; | ||
| 2 | |||
| 3 | use Moo; | ||
| 4 | use Sub::Quote; | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | Nitesi::Address - Address class for Nitesi Shop Machine | ||
| 9 | |||
| 10 | =head1 ATTRIBUTES | ||
| 11 | |||
| 12 | =head2 aid | ||
| 13 | |||
| 14 | Adress identifier. | ||
| 15 | |||
| 16 | =cut | ||
| 17 | |||
| 18 | has aid => ( | ||
| 19 | is => 'rw', | ||
| 20 | ); | ||
| 21 | |||
| 22 | =head2 uid | ||
| 23 | |||
| 24 | User identifier for this address. | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | has uid => ( | ||
| 29 | is => 'rw', | ||
| 30 | ); | ||
| 31 | |||
| 32 | =head2 type | ||
| 33 | |||
| 34 | Address type (shipping, billing, ...). | ||
| 35 | |||
| 36 | =cut | ||
| 37 | |||
| 38 | has type => ( | ||
| 39 | is => 'rw', | ||
| 40 | lazy => 1, | ||
| 41 | default => quote_sub q{return '';}, | ||
| 42 | ); | ||
| 43 | |||
| 44 | =head2 first_name | ||
| 45 | |||
| 46 | First name for this address. | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | has first_name => ( | ||
| 51 | is => 'rw', | ||
| 52 | ); | ||
| 53 | |||
| 54 | =head2 last_name | ||
| 55 | |||
| 56 | Last name for this address. | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | has last_name => ( | ||
| 61 | is => 'rw', | ||
| 62 | ); | ||
| 63 | |||
| 64 | =head2 company | ||
| 65 | |||
| 66 | Company name for this address (optional). | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | has company => ( | ||
| 71 | is => 'rw', | ||
| 72 | lazy => 1, | ||
| 73 | default => quote_sub q{"";}, | ||
| 74 | ); | ||
| 75 | |||
| 76 | =head2 street_address | ||
| 77 | |||
| 78 | Street address. | ||
| 79 | |||
| 80 | =cut | ||
| 81 | |||
| 82 | has street_address => ( | ||
| 83 | is => 'rw', | ||
| 84 | lazy => 1, | ||
| 85 | default => quote_sub q{return '';}, | ||
| 86 | ); | ||
| 87 | |||
| 88 | =head2 zip | ||
| 89 | |||
| 90 | Zip resp. postal code for this address. | ||
| 91 | |||
| 92 | =cut | ||
| 93 | |||
| 94 | has zip => ( | ||
| 95 | is => 'rw', | ||
| 96 | ); | ||
| 97 | |||
| 98 | =head2 city | ||
| 99 | |||
| 100 | City for this address. | ||
| 101 | |||
| 102 | =cut | ||
| 103 | |||
| 104 | has city => ( | ||
| 105 | is => 'rw', | ||
| 106 | ); | ||
| 107 | |||
| 108 | =head2 phone | ||
| 109 | |||
| 110 | Phone number for this address. | ||
| 111 | |||
| 112 | =cut | ||
| 113 | |||
| 114 | has phone => ( | ||
| 115 | is => 'rw', | ||
| 116 | ); | ||
| 117 | |||
| 118 | =head2 state_code | ||
| 119 | |||
| 120 | State code for this address, e.g. FL for Florida. | ||
| 121 | |||
| 122 | =cut | ||
| 123 | |||
| 124 | has state_code => ( | ||
| 125 | is => 'rw', | ||
| 126 | lazy => 1, | ||
| 127 | default => quote_sub q{return 0;}, | ||
| 128 | ); | ||
| 129 | |||
| 130 | =head2 country_code | ||
| 131 | |||
| 132 | Country code for this address, e.g. DE for Germany. | ||
| 133 | |||
| 134 | =cut | ||
| 135 | |||
| 136 | has country_code => ( | ||
| 137 | is => 'rw', | ||
| 138 | ); | ||
| 139 | |||
| 140 | =head2 created | ||
| 141 | |||
| 142 | Date and time of address creation. | ||
| 143 | |||
| 144 | =cut | ||
| 145 | |||
| 146 | has created => ( | ||
| 147 | is => 'rw', | ||
| 148 | ); | ||
| 149 | |||
| 150 | =head2 modified | ||
| 151 | |||
| 152 | Date and time of last modification of this address. | ||
| 153 | |||
| 154 | =cut | ||
| 155 | |||
| 156 | has modified => ( | ||
| 157 | is => 'rw', | ||
| 158 | ); | ||
| 159 | |||
| 160 | =head1 METHODS | ||
| 161 | |||
| 162 | =head2 api_attributes | ||
| 163 | |||
| 164 | API attributes for address class. | ||
| 165 | |||
| 166 | =cut | ||
| 167 | |||
| 168 | has api_attributes => ( | ||
| 169 | is => 'rw', | ||
| 170 | ); | ||
| 171 | |||
| 172 | =head2 api_info | ||
| 173 | |||
| 174 | Returns API information for adress object. | ||
| 175 | |||
| 176 | =cut | ||
| 177 | |||
| 178 | sub api_info { | ||
| 179 | my $self = shift; | ||
| 180 | |||
| 181 | return {base => __PACKAGE__, | ||
| 182 | table => 'addresses', | ||
| 183 | attributes => $self->api_attributes, | ||
| 184 | key => 'aid', | ||
| 185 | }; | ||
| 186 | }; | ||
| 187 | |||
| 188 | =head1 AUTHOR | ||
| 189 | |||
| 190 | Stefan Hornburg (Racke), <racke@linuxia.de> | ||
| 191 | |||
| 192 | =head1 LICENSE AND COPYRIGHT | ||
| 193 | |||
| 194 | Copyright 2011-2013 Stefan Hornburg (Racke) <racke@linuxia.de>. | ||
| 195 | |||
| 196 | This program is free software; you can redistribute it and/or modify it | ||
| 197 | under the terms of either: the GNU General Public License as published | ||
| 198 | by the Free Software Foundation; or the Artistic License. | ||
| 199 | |||
| 200 | See http://dev.perl.org/licenses/ for more information. | ||
| 201 | |||
| 202 | =cut | ||
| 203 | |||
| 204 | 1; |