Class: ThePlaidApi::CraVoaReportAccount

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

Overview

VOA Report information about an account.

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_id:, balances:, consumer_disputes:, mask:, name:, official_name:, type:, subtype:, days_available:, transactions_insights:, owners:, ownership_type:, investments: SKIP, additional_properties: nil) ⇒ CraVoaReportAccount

Returns a new instance of CraVoaReportAccount.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 131

def initialize(account_id:, balances:, consumer_disputes:, mask:, name:,
               official_name:, type:, subtype:, days_available:,
               transactions_insights:, owners:, ownership_type:,
               investments: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_id = 
  @balances = balances
  @consumer_disputes = consumer_disputes
  @mask = mask
  @name = name
  @official_name = official_name
  @type = type
  @subtype = subtype
  @days_available = days_available
  @transactions_insights = transactions_insights
  @owners = owners
  @ownership_type = ownership_type
  @investments = investments unless investments == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

Plaid’s unique identifier for the account. This value will not change unless Plaid can’t reconcile the account with the data returned by the financial institution. This may occur, for example, when the name of the account changes. If this happens a new ‘account_id` will be assigned to the account. If an account with a specific `account_id` disappears instead of changing, the account is likely closed. Closed accounts are not returned by the Plaid API. Like all Plaid identifiers, the `account_id` is case sensitive.

Returns:

  • (String)


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

def 
  @account_id
end

#balancesCraVoaReportAccountBalances

VOA Report information about an account’s balances.



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

def balances
  @balances
end

#consumer_disputesArray[ConsumerDispute]

The information about previously submitted valid dispute statements by the consumer

Returns:



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

def consumer_disputes
  @consumer_disputes
end

#days_availableFloat

The duration of transaction history available within this report for this Item, typically defined as the time since the date of the earliest transaction in that account.

Returns:

  • (Float)


70
71
72
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 70

def days_available
  @days_available
end

#investmentsBaseReportInvestments

A set of fields describing the investments data on an account.



92
93
94
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 92

def investments
  @investments
end

#maskString

The last 2-4 alphanumeric characters of an account’s official account number. Note that the mask may be non-unique between an Item’s accounts, and it may also not match the mask that the bank displays to the user.

Returns:

  • (String)


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

def mask
  @mask
end

#nameString

The name of the account, either assigned by the user or by the financial institution itself.

Returns:

  • (String)


42
43
44
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 42

def name
  @name
end

#official_nameString

The official name of the account as given by the financial institution.

Returns:

  • (String)


46
47
48
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 46

def official_name
  @official_name
end

#ownersArray[Owner]

Data returned by the financial institution about the account owner or owners.

Returns:



79
80
81
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 79

def owners
  @owners
end

#ownership_typeOwnershipType

How an asset is owned. ‘association`: Ownership by a corporation, partnership, or unincorporated association, including for-profit and not-for-profit organizations. `individual`: Ownership by an individual. `joint`: Joint ownership by multiple parties. `trust`: Ownership by a revocable or irrevocable trust.

Returns:



88
89
90
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 88

def ownership_type
  @ownership_type
end

#subtypeAccountSubtype

See the [Account type schema](plaid.com/docs/api/accounts/#account-type-schema) for a full listing of account types and corresponding subtypes.

Returns:



64
65
66
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 64

def subtype
  @subtype
end

#transactions_insightsCraVoaReportTransactionsInsights

Transaction data associated with the account.



74
75
76
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 74

def transactions_insights
  @transactions_insights
end

#typeAccountType

‘investment:` Investment account. In API versions 2018-05-22 and earlier, this type is called `brokerage` instead. `credit:` Credit card `depository:` Depository account `loan:` Loan account `other:` Non-specified account type See the [Account type schema](plaid.com/docs/api/accounts#account-type-schema) for a full listing of account types and corresponding subtypes.

Returns:



58
59
60
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 58

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 155

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('account_id') ? hash['account_id'] : nil
  balances = CraVoaReportAccountBalances.from_hash(hash['balances']) if hash['balances']
  # Parameter is an array, so we need to iterate through it
  consumer_disputes = nil
  unless hash['consumer_disputes'].nil?
    consumer_disputes = []
    hash['consumer_disputes'].each do |structure|
      consumer_disputes << (ConsumerDispute.from_hash(structure) if structure)
    end
  end

  consumer_disputes = nil unless hash.key?('consumer_disputes')
  mask = hash.key?('mask') ? hash['mask'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  official_name = hash.key?('official_name') ? hash['official_name'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  subtype = hash.key?('subtype') ? hash['subtype'] : nil
  days_available =
    hash.key?('days_available') ? hash['days_available'] : nil
  if hash['transactions_insights']
    transactions_insights = CraVoaReportTransactionsInsights.from_hash(hash['transactions_insights'])
  end
  # Parameter is an array, so we need to iterate through it
  owners = nil
  unless hash['owners'].nil?
    owners = []
    hash['owners'].each do |structure|
      owners << (Owner.from_hash(structure) if structure)
    end
  end

  owners = nil unless hash.key?('owners')
  ownership_type =
    hash.key?('ownership_type') ? hash['ownership_type'] : nil
  investments = BaseReportInvestments.from_hash(hash['investments']) if hash['investments']

  # 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.
  CraVoaReportAccount.new(account_id: ,
                          balances: balances,
                          consumer_disputes: consumer_disputes,
                          mask: mask,
                          name: name,
                          official_name: official_name,
                          type: type,
                          subtype: subtype,
                          days_available: days_available,
                          transactions_insights: transactions_insights,
                          owners: owners,
                          ownership_type: ownership_type,
                          investments: investments,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 95

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'account_id'
  @_hash['balances'] = 'balances'
  @_hash['consumer_disputes'] = 'consumer_disputes'
  @_hash['mask'] = 'mask'
  @_hash['name'] = 'name'
  @_hash['official_name'] = 'official_name'
  @_hash['type'] = 'type'
  @_hash['subtype'] = 'subtype'
  @_hash['days_available'] = 'days_available'
  @_hash['transactions_insights'] = 'transactions_insights'
  @_hash['owners'] = 'owners'
  @_hash['ownership_type'] = 'ownership_type'
  @_hash['investments'] = 'investments'
  @_hash
end

.nullablesObject

An array for nullable fields



121
122
123
124
125
126
127
128
129
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 121

def self.nullables
  %w[
    mask
    official_name
    subtype
    ownership_type
    investments
  ]
end

.optionalsObject

An array for optional fields



114
115
116
117
118
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 114

def self.optionals
  %w[
    investments
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



231
232
233
234
235
236
237
238
239
240
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 231

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id.inspect}, balances: #{@balances.inspect},"\
  " consumer_disputes: #{@consumer_disputes.inspect}, mask: #{@mask.inspect}, name:"\
  " #{@name.inspect}, official_name: #{@official_name.inspect}, type: #{@type.inspect},"\
  " subtype: #{@subtype.inspect}, days_available: #{@days_available.inspect},"\
  " transactions_insights: #{@transactions_insights.inspect}, owners: #{@owners.inspect},"\
  " ownership_type: #{@ownership_type.inspect}, investments: #{@investments.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



220
221
222
223
224
225
226
227
228
# File 'lib/the_plaid_api/models/cra_voa_report_account.rb', line 220

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id}, balances: #{@balances}, consumer_disputes:"\
  " #{@consumer_disputes}, mask: #{@mask}, name: #{@name}, official_name: #{@official_name},"\
  " type: #{@type}, subtype: #{@subtype}, days_available: #{@days_available},"\
  " transactions_insights: #{@transactions_insights}, owners: #{@owners}, ownership_type:"\
  " #{@ownership_type}, investments: #{@investments}, additional_properties:"\
  " #{@additional_properties}>"
end