Class: UspsApi::PricesPriceType
- Inherits:
-
Object
- Object
- UspsApi::PricesPriceType
- Defined in:
- lib/usps_api/models/prices_price_type.rb
Overview
Price type can be * ‘RETAIL’ * ‘COMMERCIAL’ * ‘CONTRACT’ * ‘NSA’ (deprecated)
Constant Summary collapse
- PRICES_PRICE_TYPE =
[ # TODO: Write general description for RETAIL RETAIL = 'RETAIL'.freeze, # TODO: Write general description for COMMERCIAL COMMERCIAL = 'COMMERCIAL'.freeze, # TODO: Write general description for CONTRACT CONTRACT = 'CONTRACT'.freeze, # TODO: Write general description for NSA NSA = 'NSA'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = RETAIL) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/usps_api/models/prices_price_type.rb', line 30 def self.from_value(value, default_value = RETAIL) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'retail' then RETAIL when 'commercial' then COMMERCIAL when 'contract' then CONTRACT when 'nsa' then NSA else default_value end end |
.validate(value) ⇒ Object
24 25 26 27 28 |
# File 'lib/usps_api/models/prices_price_type.rb', line 24 def self.validate(value) return false if value.nil? PRICES_PRICE_TYPE.include?(value) end |