Class: UspsApi::DestinationEntryFacilityType2

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

Overview

Types of Facilities. * NONE - Translate to Destination Rate Indicator of N in USPS® Pub 205 * INTERNATIONAL_SERVICE_CENTER - Translate to Destination Rate Indicator of I in USPS® Pub 205

Constant Summary collapse

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = NONE) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/usps_api/models/destination_entry_facility_type2.rb', line 25

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

  str = value.to_s.strip

  case str.downcase
  when 'none' then NONE
  when 'international_service_center' then INTERNATIONAL_SERVICE_CENTER
  else
    default_value
  end
end

.validate(value) ⇒ Object



19
20
21
22
23
# File 'lib/usps_api/models/destination_entry_facility_type2.rb', line 19

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

  DESTINATION_ENTRY_FACILITY_TYPE2.include?(value)
end