Class: UspsApi::PaymentTransactionType1
- Inherits:
-
Object
- Object
- UspsApi::PaymentTransactionType1
- Defined in:
- lib/usps_api/models/payment_transaction_type1.rb
Overview
Payment transaction type for the return label fee assessed to the package
Constant Summary collapse
- PAYMENT_TRANSACTION_TYPE1 =
[ # TODO: Write general description for ADJUSTMENT ADJUSTMENT = 'ADJUSTMENT'.freeze, # TODO: Write general description for PURCHASE PURCHASE = 'PURCHASE'.freeze, # TODO: Write general description for REFUND REFUND = 'REFUND'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = ADJUSTMENT) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/usps_api/models/payment_transaction_type1.rb', line 26 def self.from_value(value, default_value = ADJUSTMENT) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'adjustment' then ADJUSTMENT when 'purchase' then PURCHASE when 'refund' then REFUND else default_value end end |
.validate(value) ⇒ Object
20 21 22 23 24 |
# File 'lib/usps_api/models/payment_transaction_type1.rb', line 20 def self.validate(value) return false if value.nil? PAYMENT_TRANSACTION_TYPE1.include?(value) end |