Class: UspsApi::DpvNostatReasonCode

Inherits:
Object
  • Object
show all
Defined in:
lib/usps_api/models/dpv_nostat_reason_code.rb

Overview

Indicates the reason code for nostat flag. * ‘1` - IDA (Internal Drop Address) - Addresses that do not receive mail directly from the USPS but are delivered to a drop address that services them (e.g., gated community). * `2` - CDS Nostat - Addresses that have not yet become deliverable. For example, a new subdivision where lots and primary numbers have been determined, but no structure exists yet for occupancy. * `4` - CMZ Nostat - College, military, and other types. ZIP + 4® records USPS has incorporated into the data. * `5` - Regular nostat - Indicates addresses not receiving delivery and the addresses are not counted as possible deliveries.

  • ‘6` - Secondary Required - The address requires secondary information

(unconfirmed secondary entered or secondary missing).

Constant Summary collapse

DPV_NOSTAT_REASON_CODE =
[
  # TODO: Write general description for ENUM_1
  ENUM_1 = '1'.freeze,

  # TODO: Write general description for ENUM_2
  ENUM_2 = '2'.freeze,

  # TODO: Write general description for ENUM_4
  ENUM_4 = '4'.freeze,

  # TODO: Write general description for ENUM_5
  ENUM_5 = '5'.freeze,

  # TODO: Write general description for ENUM_6
  ENUM_6 = '6'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ENUM_1) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/usps_api/models/dpv_nostat_reason_code.rb', line 42

def self.from_value(value, default_value = ENUM_1)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'enum_1' then ENUM_1
  when 'enum_2' then ENUM_2
  when 'enum_4' then ENUM_4
  when 'enum_5' then ENUM_5
  when 'enum_6' then ENUM_6
  else
    default_value
  end
end

.validate(value) ⇒ Object



36
37
38
39
40
# File 'lib/usps_api/models/dpv_nostat_reason_code.rb', line 36

def self.validate(value)
  return false if value.nil?

  DPV_NOSTAT_REASON_CODE.include?(value)
end