Class: ThePlaidApi::StandaloneInvestmentTransactionType

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

Overview

Valid values for investment transaction types and subtypes. Note that transactions representing inflow of cash will appear as negative amounts, outflow of cash will appear as positive amounts.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(buy:, sell:, cancel:, cash:, fee:, transfer:, additional_properties: nil) ⇒ StandaloneInvestmentTransactionType

Returns a new instance of StandaloneInvestmentTransactionType.



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 61

def initialize(buy:, sell:, cancel:, cash:, fee:, transfer:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @buy = buy
  @sell = sell
  @cancel = cancel
  @cash = cash
  @fee = fee
  @transfer = transfer
  @additional_properties = additional_properties
end

Instance Attribute Details

#buyBuyType

Buying an investment

Returns:



16
17
18
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 16

def buy
  @buy
end

#cancelString

A cancellation of a pending transaction

Returns:

  • (String)


24
25
26
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 24

def cancel
  @cancel
end

#cashCashType

Activity that modifies a cash position

Returns:



28
29
30
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 28

def cash
  @cash
end

#feeFeeType

Fees on the account, e.g. commission, bookkeeping, options-related.

Returns:



32
33
34
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 32

def fee
  @fee
end

#sellSellType

Selling an investment

Returns:



20
21
22
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 20

def sell
  @sell
end

#transferTransferType

Activity that modifies a position, but not through buy/sell activity e.g. options exercise, portfolio transfer

Returns:



37
38
39
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 37

def transfer
  @transfer
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 76

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  buy = BuyType.from_hash(hash['buy']) if hash['buy']
  sell = SellType.from_hash(hash['sell']) if hash['sell']
  cancel = hash.key?('cancel') ? hash['cancel'] : nil
  cash = CashType.from_hash(hash['cash']) if hash['cash']
  fee = FeeType.from_hash(hash['fee']) if hash['fee']
  transfer = TransferType.from_hash(hash['transfer']) if hash['transfer']

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  StandaloneInvestmentTransactionType.new(buy: buy,
                                          sell: sell,
                                          cancel: cancel,
                                          cash: cash,
                                          fee: fee,
                                          transfer: transfer,
                                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
49
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['buy'] = 'buy'
  @_hash['sell'] = 'sell'
  @_hash['cancel'] = 'cancel'
  @_hash['cash'] = 'cash'
  @_hash['fee'] = 'fee'
  @_hash['transfer'] = 'transfer'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 57

def self.nullables
  []
end

.optionalsObject

An array for optional fields



52
53
54
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 52

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



112
113
114
115
116
117
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 112

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} buy: #{@buy.inspect}, sell: #{@sell.inspect}, cancel: #{@cancel.inspect},"\
  " cash: #{@cash.inspect}, fee: #{@fee.inspect}, transfer: #{@transfer.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



105
106
107
108
109
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 105

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} buy: #{@buy}, sell: #{@sell}, cancel: #{@cancel}, cash: #{@cash}, fee:"\
  " #{@fee}, transfer: #{@transfer}, additional_properties: #{@additional_properties}>"
end