Class: EVSS::PCIUAddress::DomesticAddress

Inherits:
Address
  • Object
show all
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

Attributes inherited from Address

#address_effective_date, #address_one, #address_three, #address_two, #type

Instance Attribute Details

#cityString

Returns City name, under 30 characters.

Returns:

  • (String)

    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_nameString

Returns Country name.

Returns:

  • (String)

    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_codeString

Returns Two-letter state abbreviation, e.g. VA for Virginia.

Returns:

  • (String)

    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_codeString

Returns Zip code (exactly 5 digits).

Returns:

  • (String)

    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_suffixString

Returns Zip code suffix (exactly 4 digits with optional leading dash).

Returns:

  • (String)

    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