Class: ThePlaidApi::AssetReportInvestments
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::AssetReportInvestments
- Defined in:
- lib/the_plaid_api/models/asset_report_investments.rb
Overview
A set of fields describing the investments data on an account.
Instance Attribute Summary collapse
-
#holdings ⇒ Array[AssetReportInvestmentHolding]
Quantities and values of securities held in the investment account.
-
#securities ⇒ Array[AssetReportInvestmentSecurity]
Details of specific securities held in on the investment account.
-
#transactions ⇒ Array[AssetReportInvestmentTransaction]
Transaction history on the investment account.
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(holdings: SKIP, securities: SKIP, transactions: SKIP, additional_properties: nil) ⇒ AssetReportInvestments
constructor
A new instance of AssetReportInvestments.
-
#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(holdings: SKIP, securities: SKIP, transactions: SKIP, additional_properties: nil) ⇒ AssetReportInvestments
Returns a new instance of AssetReportInvestments.
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/the_plaid_api/models/asset_report_investments.rb', line 48 def initialize(holdings: SKIP, securities: SKIP, transactions: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @holdings = holdings unless holdings == SKIP @securities = securities unless securities == SKIP @transactions = transactions unless transactions == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#holdings ⇒ Array[AssetReportInvestmentHolding]
Quantities and values of securities held in the investment account. Map to the ‘securities` array for security details.
15 16 17 |
# File 'lib/the_plaid_api/models/asset_report_investments.rb', line 15 def holdings @holdings end |
#securities ⇒ Array[AssetReportInvestmentSecurity]
Details of specific securities held in on the investment account.
19 20 21 |
# File 'lib/the_plaid_api/models/asset_report_investments.rb', line 19 def securities @securities end |
#transactions ⇒ Array[AssetReportInvestmentTransaction]
Transaction history on the investment account.
23 24 25 |
# File 'lib/the_plaid_api/models/asset_report_investments.rb', line 23 def transactions @transactions end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 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 103 104 105 106 107 |
# File 'lib/the_plaid_api/models/asset_report_investments.rb', line 60 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it holdings = nil unless hash['holdings'].nil? holdings = [] hash['holdings'].each do |structure| holdings << (AssetReportInvestmentHolding.from_hash(structure) if structure) end end holdings = SKIP unless hash.key?('holdings') # Parameter is an array, so we need to iterate through it securities = nil unless hash['securities'].nil? securities = [] hash['securities'].each do |structure| securities << (AssetReportInvestmentSecurity.from_hash(structure) if structure) end end securities = SKIP unless hash.key?('securities') # Parameter is an array, so we need to iterate through it transactions = nil unless hash['transactions'].nil? transactions = [] hash['transactions'].each do |structure| transactions << (AssetReportInvestmentTransaction.from_hash(structure) if structure) end end transactions = SKIP unless hash.key?('transactions') # 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. AssetReportInvestments.new(holdings: holdings, securities: securities, transactions: transactions, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 |
# File 'lib/the_plaid_api/models/asset_report_investments.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['holdings'] = 'holdings' @_hash['securities'] = 'securities' @_hash['transactions'] = 'transactions' @_hash end |
.nullables ⇒ Object
An array for nullable fields
44 45 46 |
# File 'lib/the_plaid_api/models/asset_report_investments.rb', line 44 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 38 39 40 41 |
# File 'lib/the_plaid_api/models/asset_report_investments.rb', line 35 def self.optionals %w[ holdings securities transactions ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
117 118 119 120 121 |
# File 'lib/the_plaid_api/models/asset_report_investments.rb', line 117 def inspect class_name = self.class.name.split('::').last "<#{class_name} holdings: #{@holdings.inspect}, securities: #{@securities.inspect},"\ " transactions: #{@transactions.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
110 111 112 113 114 |
# File 'lib/the_plaid_api/models/asset_report_investments.rb', line 110 def to_s class_name = self.class.name.split('::').last "<#{class_name} holdings: #{@holdings}, securities: #{@securities}, transactions:"\ " #{@transactions}, additional_properties: #{@additional_properties}>" end |