Class: ThePlaidApi::CreditBankStatementUploadBankAccount

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

Overview

An object containing data about a user’s bank account related to an uploaded bank statement.

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(name:, bank_name:, account_type:, account_number:, owner:, periods:, account_id:, additional_properties: nil) ⇒ CreditBankStatementUploadBankAccount

Returns a new instance of CreditBankStatementUploadBankAccount.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_bank_account.rb', line 72

def initialize(name:, bank_name:, account_type:, account_number:, owner:,
               periods:, account_id:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @name = name
  @bank_name = bank_name
  @account_type = 
  @account_number = 
  @owner = owner
  @periods = periods
  @account_id = 
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

The unique id of the bank account

Returns:

  • (String)


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

def 
  @account_id
end

#account_numberString

The bank account number.

Returns:

  • (String)


27
28
29
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_bank_account.rb', line 27

def 
  @account_number
end

#account_typeString

The type of the bank account.

Returns:

  • (String)


23
24
25
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_bank_account.rb', line 23

def 
  @account_type
end

#bank_nameString

The name of the bank institution.

Returns:

  • (String)


19
20
21
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_bank_account.rb', line 19

def bank_name
  @bank_name
end

#nameString

The name of the bank account

Returns:

  • (String)


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

def name
  @name
end

#ownerCreditBankStatementUploadAccountOwner

An object containing data about the owner of the bank account for the uploaded bank statement.



32
33
34
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_bank_account.rb', line 32

def owner
  @owner
end

#periodsArray[CreditBankStatementUploadBankAccountPeriod]

An array of period objects, containing more data on the overall period of the statement.



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

def periods
  @periods
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  bank_name = hash.key?('bank_name') ? hash['bank_name'] : nil
   = hash.key?('account_type') ? hash['account_type'] : nil
   =
    hash.key?('account_number') ? hash['account_number'] : nil
  owner = CreditBankStatementUploadAccountOwner.from_hash(hash['owner']) if hash['owner']
  # Parameter is an array, so we need to iterate through it
  periods = nil
  unless hash['periods'].nil?
    periods = []
    hash['periods'].each do |structure|
      periods << (CreditBankStatementUploadBankAccountPeriod.from_hash(structure) if structure)
    end
  end

  periods = nil unless hash.key?('periods')
   = hash.key?('account_id') ? hash['account_id'] : nil

  # 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.
  CreditBankStatementUploadBankAccount.new(name: name,
                                           bank_name: bank_name,
                                           account_type: ,
                                           account_number: ,
                                           owner: owner,
                                           periods: periods,
                                           account_id: ,
                                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_bank_account.rb', line 44

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['bank_name'] = 'bank_name'
  @_hash['account_type'] = 'account_type'
  @_hash['account_number'] = 'account_number'
  @_hash['owner'] = 'owner'
  @_hash['periods'] = 'periods'
  @_hash['account_id'] = 'account_id'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    name
    bank_name
    account_type
    account_number
    account_id
  ]
end

.optionalsObject

An array for optional fields



57
58
59
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_bank_account.rb', line 57

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, bank_name: #{@bank_name.inspect}, account_type:"\
  " #{@account_type.inspect}, account_number: #{@account_number.inspect}, owner:"\
  " #{@owner.inspect}, periods: #{@periods.inspect}, account_id: #{@account_id.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, bank_name: #{@bank_name}, account_type: #{@account_type},"\
  " account_number: #{@account_number}, owner: #{@owner}, periods: #{@periods}, account_id:"\
  " #{@account_id}, additional_properties: #{@additional_properties}>"
end