Class: ThePlaidApi::ProcessorInvestmentsHoldingsGetResponse

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

Overview

ProcessorInvestmentsHoldingsGetResponse defines the response schema for ‘/processor/invesments/holdings/get`

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(account:, holdings:, securities:, is_investments_fallback_item: SKIP, request_id: SKIP, additional_properties: nil) ⇒ ProcessorInvestmentsHoldingsGetResponse

Returns a new instance of ProcessorInvestmentsHoldingsGetResponse.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/the_plaid_api/models/processor_investments_holdings_get_response.rb', line 63

def initialize(account:, holdings:, securities:,
               is_investments_fallback_item: SKIP, request_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account = 
  @holdings = holdings
  @securities = securities
  unless is_investments_fallback_item == SKIP
    @is_investments_fallback_item =
      is_investments_fallback_item
  end
  @request_id = request_id unless request_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#accountInvestmentAccount

A single account at a financial institution, with additional investment-specific balance information.

Returns:



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

def 
  @account
end

#holdingsArray[Holding]

The holdings belonging to investment accounts associated with the Item. Details of the securities in the holdings are provided in the ‘securities` field.

Returns:



22
23
24
# File 'lib/the_plaid_api/models/processor_investments_holdings_get_response.rb', line 22

def holdings
  @holdings
end

#is_investments_fallback_itemTrueClass | FalseClass

When true, this field indicates that the Item’s portfolio was manually created with the Investments Fallback flow.

Returns:

  • (TrueClass | FalseClass)


31
32
33
# File 'lib/the_plaid_api/models/processor_investments_holdings_get_response.rb', line 31

def is_investments_fallback_item
  @is_investments_fallback_item
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


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

def request_id
  @request_id
end

#securitiesArray[Security]

Objects describing the securities held in the account.

Returns:



26
27
28
# File 'lib/the_plaid_api/models/processor_investments_holdings_get_response.rb', line 26

def securities
  @securities
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/the_plaid_api/models/processor_investments_holdings_get_response.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = InvestmentAccount.from_hash(hash['account']) if hash['account']
  # Parameter is an array, so we need to iterate through it
  holdings = nil
  unless hash['holdings'].nil?
    holdings = []
    hash['holdings'].each do |structure|
      holdings << (Holding.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 << (Security.from_hash(structure) if structure)
    end
  end

  securities = nil unless hash.key?('securities')
  is_investments_fallback_item =
    hash.key?('is_investments_fallback_item') ? hash['is_investments_fallback_item'] : SKIP
  request_id = hash.key?('request_id') ? hash['request_id'] : SKIP

  # 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.
  ProcessorInvestmentsHoldingsGetResponse.new(account: ,
                                              holdings: holdings,
                                              securities: securities,
                                              is_investments_fallback_item: is_investments_fallback_item,
                                              request_id: request_id,
                                              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
# File 'lib/the_plaid_api/models/processor_investments_holdings_get_response.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account'] = 'account'
  @_hash['holdings'] = 'holdings'
  @_hash['securities'] = 'securities'
  @_hash['is_investments_fallback_item'] = 'is_investments_fallback_item'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



59
60
61
# File 'lib/the_plaid_api/models/processor_investments_holdings_get_response.rb', line 59

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
# File 'lib/the_plaid_api/models/processor_investments_holdings_get_response.rb', line 51

def self.optionals
  %w[
    is_investments_fallback_item
    request_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



135
136
137
138
139
140
141
# File 'lib/the_plaid_api/models/processor_investments_holdings_get_response.rb', line 135

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account: #{@account.inspect}, holdings: #{@holdings.inspect}, securities:"\
  " #{@securities.inspect}, is_investments_fallback_item:"\
  " #{@is_investments_fallback_item.inspect}, request_id: #{@request_id.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



127
128
129
130
131
132
# File 'lib/the_plaid_api/models/processor_investments_holdings_get_response.rb', line 127

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account: #{@account}, holdings: #{@holdings}, securities: #{@securities},"\
  " is_investments_fallback_item: #{@is_investments_fallback_item}, request_id:"\
  " #{@request_id}, additional_properties: #{@additional_properties}>"
end