Class: UspsApi::LocationType
- Inherits:
-
Object
- Object
- UspsApi::LocationType
- Defined in:
- lib/usps_api/models/location_type.rb
Overview
Type of location (e.g., USPS, CUSTOMER, NON_USPS).
Constant Summary collapse
- LOCATION_TYPE =
[ # TODO: Write general description for USPS USPS = 'USPS'.freeze, # TODO: Write general description for CUSTOMER CUSTOMER = 'CUSTOMER'.freeze, # TODO: Write general description for NON_USPS NON_USPS = 'NON_USPS'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = USPS) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/usps_api/models/location_type.rb', line 26 def self.from_value(value, default_value = USPS) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'usps' then USPS when 'customer' then CUSTOMER when 'non_usps' then NON_USPS else default_value end end |
.validate(value) ⇒ Object
20 21 22 23 24 |
# File 'lib/usps_api/models/location_type.rb', line 20 def self.validate(value) return false if value.nil? LOCATION_TYPE.include?(value) end |