Class: EVSS::PCIUAddress::DomesticAddress
- Defined in:
- lib/evss/pciu_address/domestic_address.rb
Overview
Model for addresses within the United States
Constant Summary
Constants inherited from Address
Address::ADDRESS_TYPES, Address::ZIP_CODE_REGEX, Address::ZIP_SUFFIX_REGEX
Instance Attribute Summary collapse
-
#city ⇒ String
City name, under 30 characters.
-
#country_name ⇒ String
Country name.
-
#state_code ⇒ String
Two-letter state abbreviation, e.g.
-
#zip_code ⇒ String
Zip code (exactly 5 digits).
-
#zip_suffix ⇒ String
Zip code suffix (exactly 4 digits with optional leading dash).
Attributes inherited from Address
#address_effective_date, #address_one, #address_three, #address_two, #type
Instance Attribute Details
#city ⇒ String
Returns City name, under 30 characters.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/evss/pciu_address/domestic_address.rb', line 21 class DomesticAddress < Address attribute :city, String attribute :state_code, String attribute :country_name, String attribute :zip_code, String attribute :zip_suffix, String validates :city, pciu_address_line: true, presence: true, length: { maximum: 30 } validates :state_code, presence: true validates :zip_code, presence: true validates_format_of :zip_code, with: ZIP_CODE_REGEX validates_format_of :zip_suffix, with: ZIP_SUFFIX_REGEX, allow_blank: true end |
#country_name ⇒ String
Returns Country name.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/evss/pciu_address/domestic_address.rb', line 21 class DomesticAddress < Address attribute :city, String attribute :state_code, String attribute :country_name, String attribute :zip_code, String attribute :zip_suffix, String validates :city, pciu_address_line: true, presence: true, length: { maximum: 30 } validates :state_code, presence: true validates :zip_code, presence: true validates_format_of :zip_code, with: ZIP_CODE_REGEX validates_format_of :zip_suffix, with: ZIP_SUFFIX_REGEX, allow_blank: true end |
#state_code ⇒ String
Returns Two-letter state abbreviation, e.g. VA for Virginia.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/evss/pciu_address/domestic_address.rb', line 21 class DomesticAddress < Address attribute :city, String attribute :state_code, String attribute :country_name, String attribute :zip_code, String attribute :zip_suffix, String validates :city, pciu_address_line: true, presence: true, length: { maximum: 30 } validates :state_code, presence: true validates :zip_code, presence: true validates_format_of :zip_code, with: ZIP_CODE_REGEX validates_format_of :zip_suffix, with: ZIP_SUFFIX_REGEX, allow_blank: true end |
#zip_code ⇒ String
Returns Zip code (exactly 5 digits).
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/evss/pciu_address/domestic_address.rb', line 21 class DomesticAddress < Address attribute :city, String attribute :state_code, String attribute :country_name, String attribute :zip_code, String attribute :zip_suffix, String validates :city, pciu_address_line: true, presence: true, length: { maximum: 30 } validates :state_code, presence: true validates :zip_code, presence: true validates_format_of :zip_code, with: ZIP_CODE_REGEX validates_format_of :zip_suffix, with: ZIP_SUFFIX_REGEX, allow_blank: true end |
#zip_suffix ⇒ String
Returns Zip code suffix (exactly 4 digits with optional leading dash).
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/evss/pciu_address/domestic_address.rb', line 21 class DomesticAddress < Address attribute :city, String attribute :state_code, String attribute :country_name, String attribute :zip_code, String attribute :zip_suffix, String validates :city, pciu_address_line: true, presence: true, length: { maximum: 30 } validates :state_code, presence: true validates :zip_code, presence: true validates_format_of :zip_code, with: ZIP_CODE_REGEX validates_format_of :zip_suffix, with: ZIP_SUFFIX_REGEX, allow_blank: true end |