Class: EVSS::PCIUAddress::MilitaryAddress
- Defined in:
- lib/evss/pciu_address/military_address.rb
Overview
Model for military addresses
Constant Summary collapse
- MILITARY_POST_OFFICE_TYPES =
%w[APO FPO DPO].freeze
- MILITARY_STATE_CODES =
%w[AA AE AP].freeze
Constants inherited from Address
Address::ADDRESS_TYPES, Address::ZIP_CODE_REGEX, Address::ZIP_SUFFIX_REGEX
Instance Attribute Summary collapse
-
#military_post_office_type_code ⇒ String
The type of military post office; one of %w[APO FPO DPO].
-
#military_state_code ⇒ Object
return [String] The military state code; one of %w[AA AE AP].
-
#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
#military_post_office_type_code ⇒ String
Returns The type of military post office; one of %w[APO FPO DPO].
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/evss/pciu_address/military_address.rb', line 19 class MilitaryAddress < Address MILITARY_POST_OFFICE_TYPES = %w[APO FPO DPO].freeze MILITARY_STATE_CODES = %w[AA AE AP].freeze attribute :military_post_office_type_code, String attribute :military_state_code, String attribute :zip_code, String attribute :zip_suffix, String validates :zip_code, presence: true validates :military_post_office_type_code, presence: true, inclusion: { in: MILITARY_POST_OFFICE_TYPES } validates :military_state_code, presence: true, inclusion: { in: MILITARY_STATE_CODES } validates_format_of :zip_code, with: ZIP_CODE_REGEX validates_format_of :zip_suffix, with: ZIP_SUFFIX_REGEX, allow_blank: true end |
#military_state_code ⇒ Object
return [String] The military state code; one of %w[AA AE AP]
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/evss/pciu_address/military_address.rb', line 19 class MilitaryAddress < Address MILITARY_POST_OFFICE_TYPES = %w[APO FPO DPO].freeze MILITARY_STATE_CODES = %w[AA AE AP].freeze attribute :military_post_office_type_code, String attribute :military_state_code, String attribute :zip_code, String attribute :zip_suffix, String validates :zip_code, presence: true validates :military_post_office_type_code, presence: true, inclusion: { in: MILITARY_POST_OFFICE_TYPES } validates :military_state_code, presence: true, inclusion: { in: MILITARY_STATE_CODES } 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).
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/evss/pciu_address/military_address.rb', line 19 class MilitaryAddress < Address MILITARY_POST_OFFICE_TYPES = %w[APO FPO DPO].freeze MILITARY_STATE_CODES = %w[AA AE AP].freeze attribute :military_post_office_type_code, String attribute :military_state_code, String attribute :zip_code, String attribute :zip_suffix, String validates :zip_code, presence: true validates :military_post_office_type_code, presence: true, inclusion: { in: MILITARY_POST_OFFICE_TYPES } validates :military_state_code, presence: true, inclusion: { in: MILITARY_STATE_CODES } 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).
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/evss/pciu_address/military_address.rb', line 19 class MilitaryAddress < Address MILITARY_POST_OFFICE_TYPES = %w[APO FPO DPO].freeze MILITARY_STATE_CODES = %w[AA AE AP].freeze attribute :military_post_office_type_code, String attribute :military_state_code, String attribute :zip_code, String attribute :zip_suffix, String validates :zip_code, presence: true validates :military_post_office_type_code, presence: true, inclusion: { in: MILITARY_POST_OFFICE_TYPES } validates :military_state_code, presence: true, inclusion: { in: MILITARY_STATE_CODES } validates_format_of :zip_code, with: ZIP_CODE_REGEX validates_format_of :zip_suffix, with: ZIP_SUFFIX_REGEX, allow_blank: true end |