Class: ThePlaidApi::StandaloneInvestmentTransactionType
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::StandaloneInvestmentTransactionType
- 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
-
#buy ⇒ BuyType
Buying an investment.
-
#cancel ⇒ String
A cancellation of a pending transaction.
-
#cash ⇒ CashType
Activity that modifies a cash position.
-
#fee ⇒ FeeType
Fees on the account, e.g.
-
#sell ⇒ SellType
Selling an investment.
-
#transfer ⇒ TransferType
Activity that modifies a position, but not through buy/sell activity e.g.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(buy:, sell:, cancel:, cash:, fee:, transfer:, additional_properties: nil) ⇒ StandaloneInvestmentTransactionType
constructor
A new instance of StandaloneInvestmentTransactionType.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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
#buy ⇒ BuyType
Buying an investment
16 17 18 |
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 16 def buy @buy end |
#cancel ⇒ String
A cancellation of a pending transaction
24 25 26 |
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 24 def cancel @cancel end |
#cash ⇒ CashType
Activity that modifies a cash position
28 29 30 |
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 28 def cash @cash end |
#fee ⇒ FeeType
Fees on the account, e.g. commission, bookkeeping, options-related.
32 33 34 |
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 32 def fee @fee end |
#sell ⇒ SellType
Selling an investment
20 21 22 |
# File 'lib/the_plaid_api/models/standalone_investment_transaction_type.rb', line 20 def sell @sell end |
#transfer ⇒ TransferType
Activity that modifies a position, but not through buy/sell activity e.g. options exercise, portfolio transfer
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
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 |
.optionals ⇒ Object
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
#inspect ⇒ Object
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_s ⇒ Object
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 |