Class: FdxV660Api::DebtClass2

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

Overview

Classification of debt. One of TREASURY, MUNICIPAL, CORPORATE, OTHER

Constant Summary collapse

DEBT_CLASS2 =
[
  # TODO: Write general description for CORPORATE
  CORPORATE = 'CORPORATE'.freeze,

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = CORPORATE) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fdx_v660_api/models/debt_class2.rb', line 29

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

  str = value.to_s.strip

  case str.downcase
  when 'corporate' then CORPORATE
  when 'municipal' then MUNICIPAL
  when 'other' then OTHER
  when 'treasury' then TREASURY
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/fdx_v660_api/models/debt_class2.rb', line 23

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

  true
end