Class: ThePlaidApi::AssetHoldingType

Inherits:
Object
  • Object
show all
Defined in:
lib/the_plaid_api/models/asset_holding_type.rb

Overview

Type of holding (e.g. bond, stock, crypto, other)

Constant Summary collapse

ASSET_HOLDING_TYPE =
[
  # TODO: Write general description for BOND
  BOND = 'Bond'.freeze,

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = BOND) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'bond' then BOND
  when 'stock' then STOCK
  when 'crypto' then CRYPTO
  when 'other' then OTHER
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/the_plaid_api/models/asset_holding_type.rb', line 23

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

  ASSET_HOLDING_TYPE.include?(value)
end