Class: UspsApi::PriceType11
- Inherits:
-
Object
- Object
- UspsApi::PriceType11
- Defined in:
- lib/usps_api/models/price_type11.rb
Overview
The type of price applied. * Valid Options for Domestic Prices include: ‘RETAIL’,‘COMMERCIAL’ & ‘CONTRACT’ * Valid Options for International Prices include: ‘RETAIL’, ‘COMMERCIAL’, ‘COMMERCIAL_BASE’, ‘COMMERCIAL_PLUS’ & ‘CONTRACT’
Constant Summary collapse
- PRICE_TYPE11 =
[ # 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
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/usps_api/models/price_type11.rb', line 35 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
29 30 31 32 33 |
# File 'lib/usps_api/models/price_type11.rb', line 29 def self.validate(value) return false if value.nil? PRICE_TYPE11.include?(value) end |