Class: ThePlaidApi::InvestmentTransactionType

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

Overview

Value is one of the following: ‘buy`: Buying an investment `sell`: Selling an investment `cancel`: A cancellation of a pending transaction `cash`: Activity that modifies a cash position `fee`: A fee on the account `transfer`: Activity which modifies a position, but not through buy/sell activity e.g. options exercise, portfolio transfer For descriptions of possible transaction types and subtypes, see the [Investment transaction types schema](plaid.com/docs/api/accounts/#investment-transaction-types-sc hema).

Constant Summary collapse

INVESTMENT_TRANSACTION_TYPE =
[
  # TODO: Write general description for BUY
  BUY = 'buy'.freeze,

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = BUY) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/the_plaid_api/models/investment_transaction_type.rb', line 43

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

  str = value.to_s.strip

  case str.downcase
  when 'buy' then BUY
  when 'sell' then SELL
  when 'cancel' then CANCEL
  when 'cash' then CASH
  when 'fee' then FEE
  when 'transfer' then TRANSFER
  else
    default_value
  end
end

.validate(value) ⇒ Object



37
38
39
40
41
# File 'lib/the_plaid_api/models/investment_transaction_type.rb', line 37

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

  INVESTMENT_TRANSACTION_TYPE.include?(value)
end