Class: ThePlaidApi::CraBankIncomeAccount

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

Overview

The Item’s bank accounts that have the selected data.

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(mask:, metadata:, name:, official_name:, subtype:, owners:, account_id: SKIP, additional_properties: nil) ⇒ CraBankIncomeAccount

Returns a new instance of CraBankIncomeAccount.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/the_plaid_api/models/cra_bank_income_account.rb', line 89

def initialize(mask:, metadata:, name:, official_name:, subtype:, owners:,
               account_id: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_id =  unless  == SKIP
  @mask = mask
  @metadata = 
  @name = name
  @official_name = official_name
  @subtype = subtype
  @type = 'depository'
  @owners = owners
  @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_bank_income_account.rb', line 22

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


29
30
31
# File 'lib/the_plaid_api/models/cra_bank_income_account.rb', line 29

def mask
  @mask
end

#metadataCraBankIncomeAccountMetadata

An object containing metadata about the extracted account.



33
34
35
# File 'lib/the_plaid_api/models/cra_bank_income_account.rb', line 33

def 
  @metadata
end

#nameString

The name of the bank account.

Returns:

  • (String)


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

def name
  @name
end

#official_nameString

The official name of the bank account.

Returns:

  • (String)


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

def official_name
  @official_name
end

#ownersArray[Owner]

Data returned by the financial institution about the account owner or owners. Identity information is optional, so field may return an empty array.

Returns:



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

def owners
  @owners
end

#subtypeDepositoryAccountSubtype

Valid account subtypes for depository accounts. For a list containing descriptions of each subtype, see [Account schemas](plaid.com/docs/api/accounts/#StandaloneAccountType-deposi tory).



48
49
50
# File 'lib/the_plaid_api/models/cra_bank_income_account.rb', line 48

def subtype
  @subtype
end

#typeString (readonly)

The account type. This will always be ‘depository`.

Returns:

  • (String)


52
53
54
# File 'lib/the_plaid_api/models/cra_bank_income_account.rb', line 52

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/the_plaid_api/models/cra_bank_income_account.rb', line 106

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  mask = hash.key?('mask') ? hash['mask'] : nil
   = CraBankIncomeAccountMetadata.from_hash(hash['metadata']) if hash['metadata']
  name = hash.key?('name') ? hash['name'] : nil
  official_name = hash.key?('official_name') ? hash['official_name'] : nil
  subtype = hash.key?('subtype') ? hash['subtype'] : nil
  # 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')
   = hash.key?('account_id') ? hash['account_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.
  CraBankIncomeAccount.new(mask: mask,
                           metadata: ,
                           name: name,
                           official_name: official_name,
                           subtype: subtype,
                           owners: owners,
                           account_id: ,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/the_plaid_api/models/cra_bank_income_account.rb', line 61

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'account_id'
  @_hash['mask'] = 'mask'
  @_hash['metadata'] = 'metadata'
  @_hash['name'] = 'name'
  @_hash['official_name'] = 'official_name'
  @_hash['subtype'] = 'subtype'
  @_hash['type'] = 'type'
  @_hash['owners'] = 'owners'
  @_hash
end

.nullablesObject

An array for nullable fields



82
83
84
85
86
87
# File 'lib/the_plaid_api/models/cra_bank_income_account.rb', line 82

def self.nullables
  %w[
    mask
    official_name
  ]
end

.optionalsObject

An array for optional fields



75
76
77
78
79
# File 'lib/the_plaid_api/models/cra_bank_income_account.rb', line 75

def self.optionals
  %w[
    account_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



154
155
156
157
158
159
160
# File 'lib/the_plaid_api/models/cra_bank_income_account.rb', line 154

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

#to_sObject

Provides a human-readable string representation of the object.



146
147
148
149
150
151
# File 'lib/the_plaid_api/models/cra_bank_income_account.rb', line 146

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