Class: ThePlaidApi::CreditBankIncomeAccount

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/credit_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(account_id:, mask:, name:, official_name:, subtype:, owners:, additional_properties: nil) ⇒ CreditBankIncomeAccount

Returns a new instance of CreditBankIncomeAccount.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/the_plaid_api/models/credit_bank_income_account.rb', line 74

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

  @account_id = 
  @mask = mask
  @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.

Returns:

  • (String)


14
15
16
# File 'lib/the_plaid_api/models/credit_bank_income_account.rb', line 14

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)


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

def mask
  @mask
end

#nameString

The name of the bank account.

Returns:

  • (String)


25
26
27
# File 'lib/the_plaid_api/models/credit_bank_income_account.rb', line 25

def name
  @name
end

#official_nameString

The official name of the bank account.

Returns:

  • (String)


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

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:



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

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).



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

def subtype
  @subtype
end

#typeString (readonly)

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

Returns:

  • (String)


40
41
42
# File 'lib/the_plaid_api/models/credit_bank_income_account.rb', line 40

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
125
# File 'lib/the_plaid_api/models/credit_bank_income_account.rb', line 90

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('account_id') ? hash['account_id'] : nil
  mask = hash.key?('mask') ? hash['mask'] : nil
  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')

  # 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.
  CreditBankIncomeAccount.new(account_id: ,
                              mask: mask,
                              name: name,
                              official_name: official_name,
                              subtype: subtype,
                              owners: owners,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/the_plaid_api/models/credit_bank_income_account.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'account_id'
  @_hash['mask'] = 'mask'
  @_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



67
68
69
70
71
72
# File 'lib/the_plaid_api/models/credit_bank_income_account.rb', line 67

def self.nullables
  %w[
    mask
    official_name
  ]
end

.optionalsObject

An array for optional fields



62
63
64
# File 'lib/the_plaid_api/models/credit_bank_income_account.rb', line 62

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id.inspect}, mask: #{@mask.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.



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

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