Class: ThePlaidApi::InvestmentsTransactionsOverride
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::InvestmentsTransactionsOverride
- Defined in:
- lib/the_plaid_api/models/investments_transactions_override.rb
Overview
Specify the list of investments transactions on the account.
Instance Attribute Summary collapse
-
#currency ⇒ String
Either a valid ‘iso_currency_code` or `unofficial_currency_code`.
-
#date ⇒ Date
Posting date for the transaction.
-
#fees ⇒ Float
The combined value of all fees applied to this transaction.
-
#name ⇒ String
The institution’s description of the transaction.
-
#price ⇒ Float
The price of the security at which this transaction occurred.
-
#quantity ⇒ Float
The number of units of the security involved in this transaction.
-
#security ⇒ SecurityOverride
Specify the security associated with the holding or investment transaction.
-
#type ⇒ String
The type of the investment transaction.
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(date:, name:, quantity:, price:, type:, currency:, fees: SKIP, security: SKIP, additional_properties: nil) ⇒ InvestmentsTransactionsOverride
constructor
A new instance of InvestmentsTransactionsOverride.
-
#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(date:, name:, quantity:, price:, type:, currency:, fees: SKIP, security: SKIP, additional_properties: nil) ⇒ InvestmentsTransactionsOverride
Returns a new instance of InvestmentsTransactionsOverride.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 84 def initialize(date:, name:, quantity:, price:, type:, currency:, fees: SKIP, security: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @date = date @name = name @quantity = quantity @price = price @fees = fees unless fees == SKIP @type = type @currency = currency @security = security unless security == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#currency ⇒ String
Either a valid ‘iso_currency_code` or `unofficial_currency_code`
46 47 48 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 46 def currency @currency end |
#date ⇒ Date
Posting date for the transaction. Must be formatted as an [ISO 8601](wikipedia.org/wiki/ISO_8601) date.
15 16 17 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 15 def date @date end |
#fees ⇒ Float
The combined value of all fees applied to this transaction.
32 33 34 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 32 def fees @fees end |
#name ⇒ String
The institution’s description of the transaction.
19 20 21 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 19 def name @name end |
#price ⇒ Float
The price of the security at which this transaction occurred.
28 29 30 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 28 def price @price end |
#quantity ⇒ Float
The number of units of the security involved in this transaction. Must be positive if the type is a buy and negative if the type is a sell.
24 25 26 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 24 def quantity @quantity end |
#security ⇒ SecurityOverride
Specify the security associated with the holding or investment transaction. When inputting custom security data to the Sandbox, Plaid will perform post-data-retrieval normalization and enrichment. These processes may cause the data returned by the Sandbox to be slightly different from the data you input. An ISO-4217 currency code and a security identifier (‘ticker_symbol`, `cusip`, or `isin`) are required.
55 56 57 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 55 def security @security end |
#type ⇒ String
The type of the investment transaction. Possible values are: ‘buy`: Buying an investment `sell`: Selling an investment `cash`: Activity that modifies a cash position `fee`: A fee on the account `transfer`: Activity that modifies a position, but not through buy/sell activity e.g. options exercise, portfolio transfer
42 43 44 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 42 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 101 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. date = hash.key?('date') ? hash['date'] : nil name = hash.key?('name') ? hash['name'] : nil quantity = hash.key?('quantity') ? hash['quantity'] : nil price = hash.key?('price') ? hash['price'] : nil type = hash.key?('type') ? hash['type'] : nil currency = hash.key?('currency') ? hash['currency'] : nil fees = hash.key?('fees') ? hash['fees'] : SKIP security = SecurityOverride.from_hash(hash['security']) if hash['security'] # 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. InvestmentsTransactionsOverride.new(date: date, name: name, quantity: quantity, price: price, type: type, currency: currency, fees: fees, security: security, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 58 def self.names @_hash = {} if @_hash.nil? @_hash['date'] = 'date' @_hash['name'] = 'name' @_hash['quantity'] = 'quantity' @_hash['price'] = 'price' @_hash['fees'] = 'fees' @_hash['type'] = 'type' @_hash['currency'] = 'currency' @_hash['security'] = 'security' @_hash end |
.nullables ⇒ Object
An array for nullable fields
80 81 82 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 80 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
72 73 74 75 76 77 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 72 def self.optionals %w[ fees security ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
142 143 144 145 146 147 148 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 142 def inspect class_name = self.class.name.split('::').last "<#{class_name} date: #{@date.inspect}, name: #{@name.inspect}, quantity:"\ " #{@quantity.inspect}, price: #{@price.inspect}, fees: #{@fees.inspect}, type:"\ " #{@type.inspect}, currency: #{@currency.inspect}, security: #{@security.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
134 135 136 137 138 139 |
# File 'lib/the_plaid_api/models/investments_transactions_override.rb', line 134 def to_s class_name = self.class.name.split('::').last "<#{class_name} date: #{@date}, name: #{@name}, quantity: #{@quantity}, price: #{@price},"\ " fees: #{@fees}, type: #{@type}, currency: #{@currency}, security: #{@security},"\ " additional_properties: #{@additional_properties}>" end |