Class: ThePlaidApi::InvestmentsAuthGetResponse

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

Overview

InvestmentsAuthGetResponse defines the response schema for ‘/investments/auth/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(accounts:, holdings:, securities:, owners:, numbers:, data_sources:, item:, request_id:, account_details_401k: SKIP, additional_properties: nil) ⇒ InvestmentsAuthGetResponse

Returns a new instance of InvestmentsAuthGetResponse.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 84

def initialize(accounts:, holdings:, securities:, owners:, numbers:,
               data_sources:, item:, request_id:,
               account_details_401k: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @accounts = accounts
  @holdings = holdings
  @securities = securities
  @owners = owners
  @numbers = numbers
  @data_sources = data_sources
  @account_details_401k =  unless  == SKIP
  @item = item
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_details_401kArray[InvestmentsAuthAccountDetails401K]

Additional information for accounts of 401k subtype.



45
46
47
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 45

def 
  @account_details_401k
end

#accountsArray[InvestmentAccount]

The accounts for which data is being retrieved

Returns:



15
16
17
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 15

def accounts
  @accounts
end

#data_sourcesInvestmentsAuthDataSources

Object with metadata pertaining to the source of data for the account numbers, owners, and holdings that are returned.



41
42
43
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 41

def data_sources
  @data_sources
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:



21
22
23
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 21

def holdings
  @holdings
end

#itemItem

Metadata about the Item.

Returns:



49
50
51
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 49

def item
  @item
end

#numbersInvestmentsAuthGetNumbers

Identifying information for transferring holdings to an investments account.



36
37
38
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 36

def numbers
  @numbers
end

#ownersArray[InvestmentsAuthOwner]

Information about the account owners for the accounts associated with the Item.

Returns:



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

def owners
  @owners
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)


55
56
57
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 55

def request_id
  @request_id
end

#securitiesArray[Security]

Objects describing the securities held in the accounts associated with the Item.

Returns:



26
27
28
# File 'lib/the_plaid_api/models/investments_auth_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.



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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 103

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
  accounts = nil
  unless hash['accounts'].nil?
    accounts = []
    hash['accounts'].each do |structure|
      accounts << (InvestmentAccount.from_hash(structure) if structure)
    end
  end

  accounts = nil unless hash.key?('accounts')
  # 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')
  # Parameter is an array, so we need to iterate through it
  owners = nil
  unless hash['owners'].nil?
    owners = []
    hash['owners'].each do |structure|
      owners << (InvestmentsAuthOwner.from_hash(structure) if structure)
    end
  end

  owners = nil unless hash.key?('owners')
  numbers = InvestmentsAuthGetNumbers.from_hash(hash['numbers']) if hash['numbers']
  data_sources = InvestmentsAuthDataSources.from_hash(hash['data_sources']) if
    hash['data_sources']
  item = Item.from_hash(hash['item']) if hash['item']
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  # Parameter is an array, so we need to iterate through it
   = nil
  unless hash['account_details_401k'].nil?
     = []
    hash['account_details_401k'].each do |structure|
       << (InvestmentsAuthAccountDetails401K.from_hash(structure) if structure)
    end
  end

   = SKIP unless hash.key?('account_details_401k')

  # 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.
  InvestmentsAuthGetResponse.new(accounts: accounts,
                                 holdings: holdings,
                                 securities: securities,
                                 owners: owners,
                                 numbers: numbers,
                                 data_sources: data_sources,
                                 item: item,
                                 request_id: request_id,
                                 account_details_401k: ,
                                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 58

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['accounts'] = 'accounts'
  @_hash['holdings'] = 'holdings'
  @_hash['securities'] = 'securities'
  @_hash['owners'] = 'owners'
  @_hash['numbers'] = 'numbers'
  @_hash['data_sources'] = 'data_sources'
  @_hash['account_details_401k'] = 'account_details_401k'
  @_hash['item'] = 'item'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



80
81
82
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 80

def self.nullables
  []
end

.optionalsObject

An array for optional fields



73
74
75
76
77
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 73

def self.optionals
  %w[
    account_details_401k
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



193
194
195
196
197
198
199
200
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 193

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} accounts: #{@accounts.inspect}, holdings: #{@holdings.inspect}, securities:"\
  " #{@securities.inspect}, owners: #{@owners.inspect}, numbers: #{@numbers.inspect},"\
  " data_sources: #{@data_sources.inspect}, account_details_401k:"\
  " #{@account_details_401k.inspect}, item: #{@item.inspect}, request_id:"\
  " #{@request_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



184
185
186
187
188
189
190
# File 'lib/the_plaid_api/models/investments_auth_get_response.rb', line 184

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} accounts: #{@accounts}, holdings: #{@holdings}, securities: #{@securities},"\
  " owners: #{@owners}, numbers: #{@numbers}, data_sources: #{@data_sources},"\
  " account_details_401k: #{@account_details_401k}, item: #{@item}, request_id:"\
  " #{@request_id}, additional_properties: #{@additional_properties}>"
end