| 1 | # vim: sw=4 ts=4 ft=perl | ||
| 2 | |||
| 3 | package WebService::Braintree::_::Address; | ||
| 4 | 22 | $WebService::Braintree::_::Address::VERSION = '1.7'; | |
| 5 | 22 | ▶ | use 5.010_001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 22 | ▶ | use strictures 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | WebService::Braintree::_::Address | ||
| 11 | |||
| 12 | =head1 PURPOSE | ||
| 13 | |||
| 14 | This class represents an address. | ||
| 15 | |||
| 16 | This class will only be created as part of a L<response|WebService::Braintree::Result> or L<error response|WebService::Braintree::ErrorResult>. | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | 22 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | 22 | ▶ | use MooX::Aliases; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | 22 | extends 'WebService::Braintree::_'; | |
| 24 | |||
| 25 | =head1 ATTRIBUTES | ||
| 26 | |||
| 27 | =cut | ||
| 28 | |||
| 29 | |||
| 30 | =head2 company() | ||
| 31 | |||
| 32 | This is the company for this address. | ||
| 33 | |||
| 34 | =cut | ||
| 35 | |||
| 36 | 22 | has company => ( | |
| 37 | is => 'ro', | ||
| 38 | ); | ||
| 39 | |||
| 40 | =head2 country_code_alpha2() | ||
| 41 | |||
| 42 | This is the country_code_alpha2 for this address. | ||
| 43 | |||
| 44 | =cut | ||
| 45 | |||
| 46 | 22 | has country_code_alpha2 => ( | |
| 47 | is => 'ro', | ||
| 48 | ); | ||
| 49 | |||
| 50 | =head2 country_code_alpha3() | ||
| 51 | |||
| 52 | This is the country_code_alpha3 for this address. | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | 22 | has country_code_alpha3 => ( | |
| 57 | is => 'ro', | ||
| 58 | ); | ||
| 59 | |||
| 60 | =head2 country_code_numeric() | ||
| 61 | |||
| 62 | This is the country_code_numeric for this address. | ||
| 63 | |||
| 64 | =cut | ||
| 65 | |||
| 66 | 22 | has country_code_numeric => ( | |
| 67 | is => 'ro', | ||
| 68 | ); | ||
| 69 | |||
| 70 | =head2 country_name() | ||
| 71 | |||
| 72 | This is the country name for this address. | ||
| 73 | |||
| 74 | =cut | ||
| 75 | |||
| 76 | 22 | has country_name => ( | |
| 77 | is => 'ro', | ||
| 78 | ); | ||
| 79 | |||
| 80 | =head2 created_at() | ||
| 81 | |||
| 82 | This is when this address was created. | ||
| 83 | |||
| 84 | =cut | ||
| 85 | |||
| 86 | # Coerce this to Datetime | ||
| 87 | 22 | has created_at => ( | |
| 88 | is => 'ro', | ||
| 89 | ); | ||
| 90 | |||
| 91 | =head2 customer_id() | ||
| 92 | |||
| 93 | This is the customer (if any) for this address. | ||
| 94 | |||
| 95 | =cut | ||
| 96 | |||
| 97 | 22 | has customer_id => ( | |
| 98 | is => 'ro', | ||
| 99 | ); | ||
| 100 | |||
| 101 | =head2 extended_address() | ||
| 102 | |||
| 103 | This is the extended_address for this address. | ||
| 104 | |||
| 105 | =cut | ||
| 106 | |||
| 107 | 22 | has extended_address => ( | |
| 108 | is => 'ro', | ||
| 109 | ); | ||
| 110 | |||
| 111 | =head2 first_name() | ||
| 112 | |||
| 113 | This is the first name for this address. This defaults to "". | ||
| 114 | |||
| 115 | =cut | ||
| 116 | |||
| 117 | has first_name => ( | ||
| 118 | is => 'ro', | ||
| 119 | 0 | ▶ | default => sub { '' }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 120 | 22 | ); | |
| 121 | |||
| 122 | =head2 id() | ||
| 123 | |||
| 124 | This is the id for this address. | ||
| 125 | |||
| 126 | =cut | ||
| 127 | |||
| 128 | 22 | has id => ( | |
| 129 | is => 'ro', | ||
| 130 | ); | ||
| 131 | |||
| 132 | =head2 last_name() | ||
| 133 | |||
| 134 | This is the last name for this address. This defaults to "". | ||
| 135 | |||
| 136 | =cut | ||
| 137 | |||
| 138 | has last_name => ( | ||
| 139 | is => 'ro', | ||
| 140 | 0 | ▶ | default => sub { '' }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 141 | 22 | ); | |
| 142 | |||
| 143 | =head2 locality() | ||
| 144 | |||
| 145 | This is the locality for this address. | ||
| 146 | |||
| 147 | =cut | ||
| 148 | |||
| 149 | 22 | has locality => ( | |
| 150 | is => 'ro', | ||
| 151 | ); | ||
| 152 | |||
| 153 | =head2 postal_code() | ||
| 154 | |||
| 155 | This is the postal code for this address. | ||
| 156 | |||
| 157 | C<< zip_code() >> is an alias for this attribute. | ||
| 158 | |||
| 159 | =cut | ||
| 160 | |||
| 161 | 22 | has postal_code => ( | |
| 162 | is => 'ro', | ||
| 163 | alias => 'zip_code', | ||
| 164 | ); | ||
| 165 | |||
| 166 | =head2 region() | ||
| 167 | |||
| 168 | This is the region for this address. | ||
| 169 | |||
| 170 | =cut | ||
| 171 | |||
| 172 | 22 | has region => ( | |
| 173 | is => 'ro', | ||
| 174 | ); | ||
| 175 | |||
| 176 | =head2 street_address() | ||
| 177 | |||
| 178 | This is the street address for this address. | ||
| 179 | |||
| 180 | =cut | ||
| 181 | |||
| 182 | 22 | has street_address => ( | |
| 183 | is => 'ro', | ||
| 184 | ); | ||
| 185 | |||
| 186 | =head2 updated_at() | ||
| 187 | |||
| 188 | This is when this address was last updated. | ||
| 189 | |||
| 190 | =cut | ||
| 191 | |||
| 192 | # Coerce this to Datetime | ||
| 193 | 22 | has updated_at => ( | |
| 194 | is => 'ro', | ||
| 195 | ); | ||
| 196 | |||
| 197 | =head1 METHODS | ||
| 198 | |||
| 199 | =head2 full_name() | ||
| 200 | |||
| 201 | This returns the full name of this address. This is the first_name and the | ||
| 202 | last_name concatenated with a space. | ||
| 203 | |||
| 204 | =cut | ||
| 205 | |||
| 206 | 1 | ▶ | sub full_name { |
|
Subroutine
full_name: called CC=1 SCAR=0.0
Pod
documented
| |||
| 207 | 1 | my $self = shift; | |
| 208 | 1 | return $self->first_name . " " . $self->last_name | |
| 209 | } | ||
| 210 | |||
| 211 | 22 | __PACKAGE__->meta->make_immutable; | |
| 212 | |||
| 213 | 22 | 1; | |
| 214 | __END__ | ||