Class: FdxV660Api::TransactionReason2

Inherits:
Object
  • Object
show all
Defined in:
lib/fdx_v660_api/models/transaction_reason2.rb

Overview

Reason for this transaction; CALL (the debt was called), SELL (the debt was sold), MATURITY (the debt reached maturity)

Constant Summary collapse

TRANSACTION_REASON2 =
[
  # TODO: Write general description for CALL
  CALL = 'CALL'.freeze,

  # TODO: Write general description for MATURITY
  MATURITY = 'MATURITY'.freeze,

  # TODO: Write general description for SELL
  SELL = 'SELL'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = CALL) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fdx_v660_api/models/transaction_reason2.rb', line 27

def self.from_value(value, default_value = CALL)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'call' then CALL
  when 'maturity' then MATURITY
  when 'sell' then SELL
  else
    default_value
  end
end

.validate(value) ⇒ Object



21
22
23
24
25
# File 'lib/fdx_v660_api/models/transaction_reason2.rb', line 21

def self.validate(value)
  return false if value.nil?

  true
end