Class: UspsApi::LacsLinkReturnCode

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

Overview

The return code from the LACSLink inquiry. * ‘00` - LACSLink no match. * `14` - Multiple LACSLink addresses found, unable to break tie. * `A` - LACSLink address converted without modifications. * `92` - LACSLink address converted but secondary dropped.

Constant Summary collapse

[
  # TODO: Write general description for ENUM_00
  ENUM_00 = '00'.freeze,

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ENUM_00) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/usps_api/models/lacs_link_return_code.rb', line 32

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

  str = value.to_s.strip

  case str.downcase
  when 'enum_00' then ENUM_00
  when 'enum_14' then ENUM_14
  when 'a' then A
  when 'enum_92' then ENUM_92
  else
    default_value
  end
end

.validate(value) ⇒ Object



26
27
28
29
30
# File 'lib/usps_api/models/lacs_link_return_code.rb', line 26

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

  LACS_LINK_RETURN_CODE.include?(value)
end