Class: UspsApi::DpvNostatReasonCodeDesc

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

Overview

Indicates the reason description for nostat flag. * “IDA (Internal Drop Address)” * “CDS Nostat” * “CMZ Nostat” * “Regular Nostat” * “Secondary Required”

Constant Summary collapse

DPV_NOSTAT_REASON_CODE_DESC =
[
  # TODO: Write general description for INTERNAL_DROP_ADDRESS
  INTERNAL_DROP_ADDRESS = 'INTERNAL_DROP_ADDRESS'.freeze,

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = INTERNAL_DROP_ADDRESS) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/usps_api/models/dpv_nostat_reason_code_desc.rb', line 34

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

  str = value.to_s.strip

  case str.downcase
  when 'internal_drop_address' then INTERNAL_DROP_ADDRESS
  when 'cds_nostat' then CDS_NOSTAT
  when 'cmz_nostat' then CMZ_NOSTAT
  when 'regular_nostat' then REGULAR_NOSTAT
  when 'secondary_required' then SECONDARY_REQUIRED
  else
    default_value
  end
end

.validate(value) ⇒ Object



28
29
30
31
32
# File 'lib/usps_api/models/dpv_nostat_reason_code_desc.rb', line 28

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

  DPV_NOSTAT_REASON_CODE_DESC.include?(value)
end