Class: VAProfile::Models::V3::BaseAddress

Inherits:
Base
  • Object
show all
Includes:
Concerns::Defaultable, Concerns::Expirable
Defined in:
lib/va_profile/models/v3/base_address.rb

Direct Known Subclasses

Address, ValidationAddress

Constant Summary collapse

VALID_ALPHA_REGEX =
/[a-zA-Z ]+/
VALID_NUMERIC_REGEX =
/[0-9]+/
ADDRESS_FIELD_LIMIT =
35
RESIDENCE =
'RESIDENCE'
CORRESPONDENCE =
'CORRESPONDENCE'
ADDRESS_POUS =
[RESIDENCE, CORRESPONDENCE].freeze
DOMESTIC =
'DOMESTIC'
INTERNATIONAL =
'INTERNATIONAL'
MILITARY =
'OVERSEAS MILITARY'
ADDRESS_TYPES =
[DOMESTIC, INTERNATIONAL, MILITARY].freeze

Constants inherited from Base

Base::SOURCE_SYSTEM

Instance Method Summary collapse

Methods included from Concerns::Expirable

#effective_end_date_has_passed

Methods included from Concerns::Defaultable

#set_defaults

Instance Method Details

#ascii_onlyObject



128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/va_profile/models/v3/base_address.rb', line 128

def ascii_only
  address = [
    address_line1,
    address_line2,
    address_line3,
    city,
    province,
    international_postal_code
  ].join

  errors.add(:address, 'must contain ASCII characters only') unless address.ascii_only?
end

#zip_plus_fourObject



141
142
143
144
145
# File 'lib/va_profile/models/v3/base_address.rb', line 141

def zip_plus_four
  return if zip_code.blank?

  [zip_code, zip_code_suffix].compact.join('-')
end