Class: ThePlaidApi::StatementsAccount

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

Overview

Account associated with the Item.

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:, account_mask:, account_name:, account_official_name:, account_subtype:, account_type:, statements:, additional_properties: nil) ⇒ StatementsAccount

Returns a new instance of StatementsAccount.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/the_plaid_api/models/statements_account.rb', line 69

def initialize(account_id:, account_mask:, account_name:,
               account_official_name:, account_subtype:, account_type:,
               statements:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_id = 
  @account_mask = 
  @account_name = 
  @account_official_name = 
  @account_subtype = 
  @account_type = 
  @statements = statements
  @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/statements_account.rb', line 14

def 
  @account_id
end

#account_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)


20
21
22
# File 'lib/the_plaid_api/models/statements_account.rb', line 20

def 
  @account_mask
end

#account_nameString

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

Returns:

  • (String)


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

def 
  @account_name
end

#account_official_nameString

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

Returns:

  • (String)


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

def 
  @account_official_name
end

#account_subtypeString

The subtype of the account. For a full list of valid types and subtypes, see the [Account schema](plaid.com/docs/api/accounts#account-type-schema).

Returns:

  • (String)


35
36
37
# File 'lib/the_plaid_api/models/statements_account.rb', line 35

def 
  @account_subtype
end

#account_typeString

The type of account. For a full list of valid types and subtypes, see the [Account schema](plaid.com/docs/api/accounts#account-type-schema).

Returns:

  • (String)


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

def 
  @account_type
end

#statementsArray[StatementsStatement]

The list of statements’ metadata associated with this account.

Returns:



44
45
46
# File 'lib/the_plaid_api/models/statements_account.rb', line 44

def statements
  @statements
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



86
87
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
# File 'lib/the_plaid_api/models/statements_account.rb', line 86

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('account_id') ? hash['account_id'] : nil
   = hash.key?('account_mask') ? hash['account_mask'] : nil
   = hash.key?('account_name') ? hash['account_name'] : nil
   =
    hash.key?('account_official_name') ? hash['account_official_name'] : nil
   =
    hash.key?('account_subtype') ? hash['account_subtype'] : nil
   = hash.key?('account_type') ? hash['account_type'] : nil
  # Parameter is an array, so we need to iterate through it
  statements = nil
  unless hash['statements'].nil?
    statements = []
    hash['statements'].each do |structure|
      statements << (StatementsStatement.from_hash(structure) if structure)
    end
  end

  statements = nil unless hash.key?('statements')

  # 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.
  StatementsAccount.new(account_id: ,
                        account_mask: ,
                        account_name: ,
                        account_official_name: ,
                        account_subtype: ,
                        account_type: ,
                        statements: statements,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/the_plaid_api/models/statements_account.rb', line 47

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'account_id'
  @_hash['account_mask'] = 'account_mask'
  @_hash['account_name'] = 'account_name'
  @_hash['account_official_name'] = 'account_official_name'
  @_hash['account_subtype'] = 'account_subtype'
  @_hash['account_type'] = 'account_type'
  @_hash['statements'] = 'statements'
  @_hash
end

.nullablesObject

An array for nullable fields



65
66
67
# File 'lib/the_plaid_api/models/statements_account.rb', line 65

def self.nullables
  []
end

.optionalsObject

An array for optional fields



60
61
62
# File 'lib/the_plaid_api/models/statements_account.rb', line 60

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id.inspect}, account_mask: #{@account_mask.inspect},"\
  " account_name: #{@account_name.inspect}, account_official_name:"\
  " #{@account_official_name.inspect}, account_subtype: #{@account_subtype.inspect},"\
  " account_type: #{@account_type.inspect}, statements: #{@statements.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id}, account_mask: #{@account_mask}, account_name:"\
  " #{@account_name}, account_official_name: #{@account_official_name}, account_subtype:"\
  " #{@account_subtype}, account_type: #{@account_type}, statements: #{@statements},"\
  " additional_properties: #{@additional_properties}>"
end