Class: UspsApi::DestinationDiscountIndicator
- Inherits:
-
Object
- Object
- UspsApi::DestinationDiscountIndicator
- Defined in:
- lib/usps_api/models/destination_discount_indicator.rb
Overview
Indicator whether this is dropship (NO) or origin entry (YES) appointment. Required for Create actions.
Constant Summary collapse
- DESTINATION_DISCOUNT_INDICATOR =
[ # TODO: Write general description for YES YES = 'YES'.freeze, # TODO: Write general description for NO NO = 'NO'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = YES) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/usps_api/models/destination_discount_indicator.rb', line 24 def self.from_value(value, default_value = YES) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'yes' then YES when 'no' then NO else default_value end end |
.validate(value) ⇒ Object
18 19 20 21 22 |
# File 'lib/usps_api/models/destination_discount_indicator.rb', line 18 def self.validate(value) return false if value.nil? DESTINATION_DISCOUNT_INDICATOR.include?(value) end |