Class: UspsApi::FacilityType
- Inherits:
-
Object
- Object
- UspsApi::FacilityType
- Defined in:
- lib/usps_api/models/facility_type.rb
Overview
This is the type of facility at the location.
Constant Summary collapse
- FACILITY_TYPE =
[ # TODO: Write general description for POST_OFFICE POST_OFFICE = 'POST_OFFICE'.freeze, # TODO: Write general description for EXPRESS_MAIL_COLLECTION_BOX EXPRESS_MAIL_COLLECTION_BOX = 'EXPRESS_MAIL_COLLECTION_BOX'.freeze, # TODO: Write general description for AIR_MAIL_FACILITY AIR_MAIL_FACILITY = 'AIR_MAIL_FACILITY'.freeze, # TODO: Write general description for CONTRACT_POSTAL_UNIT CONTRACT_POSTAL_UNIT = 'CONTRACT_POSTAL_UNIT'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = POST_OFFICE) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/usps_api/models/facility_type.rb', line 29 def self.from_value(value, default_value = POST_OFFICE) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'post_office' then POST_OFFICE when 'express_mail_collection_box' then EXPRESS_MAIL_COLLECTION_BOX when 'air_mail_facility' then AIR_MAIL_FACILITY when 'contract_postal_unit' then CONTRACT_POSTAL_UNIT else default_value end end |
.validate(value) ⇒ Object
23 24 25 26 27 |
# File 'lib/usps_api/models/facility_type.rb', line 23 def self.validate(value) return false if value.nil? FACILITY_TYPE.include?(value) end |