Class: ThePlaidApi::StandaloneAccountType

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

Overview

The schema below describes the various ‘types` and corresponding `subtypes` that Plaid recognizes and reports for financial institution accounts. For a mapping of supported types and subtypes to Plaid products, see the [Account type / product support matrix](plaid.com/docs/api/accounts/#account-type–product-support-m atrix).

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(depository:, credit:, loan:, investment:, other:, payroll: SKIP, additional_properties: nil) ⇒ StandaloneAccountType

Returns a new instance of StandaloneAccountType.



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/the_plaid_api/models/standalone_account_type.rb', line 66

def initialize(depository:, credit:, loan:, investment:, other:,
               payroll: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @depository = depository
  @credit = credit
  @loan = loan
  @investment = investment
  @payroll = payroll unless payroll == SKIP
  @other = other
  @additional_properties = additional_properties
end

Instance Attribute Details

#creditCreditAccount

A credit card type account.

Returns:



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

def credit
  @credit
end

#depositoryDepositoryAccount

An account type holding cash, in which funds are deposited.

Returns:



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

def depository
  @depository
end

#investmentInvestmentAccountSubtype1

An investment account. In API versions 2018-05-22 and earlier, this type is called ‘brokerage`.



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

def investment
  @investment
end

#loanLoanAccount

A loan type account.

Returns:



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

def loan
  @loan
end

#otherString

Other or unknown account type.

Returns:

  • (String)


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

def other
  @other
end

#payrollPayrollAccount

A payroll account.

Returns:



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

def payroll
  @payroll
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/the_plaid_api/models/standalone_account_type.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  depository = DepositoryAccount.from_hash(hash['depository']) if hash['depository']
  credit = CreditAccount.from_hash(hash['credit']) if hash['credit']
  loan = LoanAccount.from_hash(hash['loan']) if hash['loan']
  investment = InvestmentAccountSubtype1.from_hash(hash['investment']) if hash['investment']
  other = hash.key?('other') ? hash['other'] : nil
  payroll = PayrollAccount.from_hash(hash['payroll']) if hash['payroll']

  # 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.
  StandaloneAccountType.new(depository: depository,
                            credit: credit,
                            loan: loan,
                            investment: investment,
                            other: other,
                            payroll: payroll,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['depository'] = 'depository'
  @_hash['credit'] = 'credit'
  @_hash['loan'] = 'loan'
  @_hash['investment'] = 'investment'
  @_hash['payroll'] = 'payroll'
  @_hash['other'] = 'other'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



55
56
57
58
59
# File 'lib/the_plaid_api/models/standalone_account_type.rb', line 55

def self.optionals
  %w[
    payroll
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



118
119
120
121
122
123
# File 'lib/the_plaid_api/models/standalone_account_type.rb', line 118

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} depository: #{@depository.inspect}, credit: #{@credit.inspect}, loan:"\
  " #{@loan.inspect}, investment: #{@investment.inspect}, payroll: #{@payroll.inspect}, other:"\
  " #{@other.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



110
111
112
113
114
115
# File 'lib/the_plaid_api/models/standalone_account_type.rb', line 110

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} depository: #{@depository}, credit: #{@credit}, loan: #{@loan}, investment:"\
  " #{@investment}, payroll: #{@payroll}, other: #{@other}, additional_properties:"\
  " #{@additional_properties}>"
end