Class: ThePlaidApi::BaseReportInvestments
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::BaseReportInvestments
- Defined in:
- lib/the_plaid_api/models/base_report_investments.rb
Overview
A set of fields describing the investments data on an account.
Instance Attribute Summary collapse
-
#holdings ⇒ Array[BaseReportInvestmentHolding]
Quantities and values of securities held in the investment account.
-
#investment_transactions ⇒ Array[BaseReportInvestmentTransaction]
Transaction history on the investment account.
-
#securities ⇒ Array[BaseReportInvestmentSecurity]
Details of specific securities held in 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:, securities:, investment_transactions:, additional_properties: nil) ⇒ BaseReportInvestments
constructor
A new instance of BaseReportInvestments.
-
#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:, securities:, investment_transactions:, additional_properties: nil) ⇒ BaseReportInvestments
Returns a new instance of BaseReportInvestments.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/the_plaid_api/models/base_report_investments.rb', line 44 def initialize(holdings:, securities:, investment_transactions:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @holdings = holdings @securities = securities @investment_transactions = investment_transactions @additional_properties = additional_properties end |
Instance Attribute Details
#holdings ⇒ Array[BaseReportInvestmentHolding]
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/base_report_investments.rb', line 15 def holdings @holdings end |
#investment_transactions ⇒ Array[BaseReportInvestmentTransaction]
Transaction history on the investment account.
23 24 25 |
# File 'lib/the_plaid_api/models/base_report_investments.rb', line 23 def investment_transactions @investment_transactions end |
#securities ⇒ Array[BaseReportInvestmentSecurity]
Details of specific securities held in the investment account.
19 20 21 |
# File 'lib/the_plaid_api/models/base_report_investments.rb', line 19 def securities @securities end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 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 |
# File 'lib/the_plaid_api/models/base_report_investments.rb', line 56 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 << (BaseReportInvestmentHolding.from_hash(structure) if structure) end end holdings = nil 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 << (BaseReportInvestmentSecurity.from_hash(structure) if structure) end end securities = nil unless hash.key?('securities') # Parameter is an array, so we need to iterate through it investment_transactions = nil unless hash['investment_transactions'].nil? investment_transactions = [] hash['investment_transactions'].each do |structure| investment_transactions << (BaseReportInvestmentTransaction.from_hash(structure) if structure) end end investment_transactions = nil unless hash.key?('investment_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. BaseReportInvestments.new(holdings: holdings, securities: securities, investment_transactions: investment_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/base_report_investments.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['holdings'] = 'holdings' @_hash['securities'] = 'securities' @_hash['investment_transactions'] = 'investment_transactions' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/the_plaid_api/models/base_report_investments.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 |
# File 'lib/the_plaid_api/models/base_report_investments.rb', line 35 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
114 115 116 117 118 119 |
# File 'lib/the_plaid_api/models/base_report_investments.rb', line 114 def inspect class_name = self.class.name.split('::').last "<#{class_name} holdings: #{@holdings.inspect}, securities: #{@securities.inspect},"\ " investment_transactions: #{@investment_transactions.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
106 107 108 109 110 111 |
# File 'lib/the_plaid_api/models/base_report_investments.rb', line 106 def to_s class_name = self.class.name.split('::').last "<#{class_name} holdings: #{@holdings}, securities: #{@securities},"\ " investment_transactions: #{@investment_transactions}, additional_properties:"\ " #{@additional_properties}>" end |