Class: UspsApi::InternationalPriceType
- Inherits:
-
Object
- Object
- UspsApi::InternationalPriceType
- Defined in:
- lib/usps_api/models/international_price_type.rb
Overview
Price type can be * ‘RETAIL’ * ‘COMMERCIAL’ * ‘COMMERCIAL_BASE’ * ‘COMMERCIAL_PLUS’ * ‘CONTRACT’
Constant Summary collapse
- INTERNATIONAL_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 COMMERCIAL_BASE COMMERCIAL_BASE = 'COMMERCIAL_BASE'.freeze, # TODO: Write general description for COMMERCIAL_PLUS COMMERCIAL_PLUS = 'COMMERCIAL_PLUS'.freeze, # TODO: Write general description for CONTRACT CONTRACT = 'CONTRACT'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = RETAIL) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/usps_api/models/international_price_type.rb', line 33 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 'commercial_base' then COMMERCIAL_BASE when 'commercial_plus' then COMMERCIAL_PLUS when 'contract' then CONTRACT else default_value end end |
.validate(value) ⇒ Object
27 28 29 30 31 |
# File 'lib/usps_api/models/international_price_type.rb', line 27 def self.validate(value) return false if value.nil? INTERNATIONAL_PRICE_TYPE.include?(value) end |