Class: UspsApi::LacsLinkIndicator

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

Overview

Indicates if a match was found from LACSLink. * ‘Y` - LACSLink address found. * `N` - LACSLink address not found. * `S` - LACSLink address converted but secondary dropped. * `F` - LACSLink false positive address encountered.

Constant Summary collapse

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = Y) ⇒ Object



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

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 'n' then N
  when 's' then S
  when 'f' then F
  else
    default_value
  end
end

.validate(value) ⇒ Object



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

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

  LACS_LINK_INDICATOR.include?(value)
end