Class: UspsApi::DpvEnhancedConfirmation

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

Overview

The DPV Confirmation indicator identifies whether the address is delivered to by the USPS. * ‘Y` - All components confirmed. * `D` - Secondary was dropped or trailing alpha on primary was dropped to confirm. * `S` - Address confirmed on primary number but secondary number required for complete address. * `R` - Address DPV Confirmed but USPS does not deliver to the address. * `N` - Primary number not confirmed.

Constant Summary collapse

DPV_ENHANCED_CONFIRMATION =
[
  # TODO: Write general description for Y
  Y = 'Y'.freeze,

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = Y) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/usps_api/models/dpv_enhanced_confirmation.rb', line 37

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

  str = value.to_s.strip

  case str.downcase
  when 'y' then Y
  when 'd' then D
  when 's' then S
  when 'r' then R
  when 'n' then N
  else
    default_value
  end
end

.validate(value) ⇒ Object



31
32
33
34
35
# File 'lib/usps_api/models/dpv_enhanced_confirmation.rb', line 31

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

  DPV_ENHANCED_CONFIRMATION.include?(value)
end