Class: Plaid::StandaloneAccountType

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/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.

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:, additional_properties: nil) ⇒ StandaloneAccountType

Returns a new instance of StandaloneAccountType.



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/plaid/models/standalone_account_type.rb', line 60

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

  @depository = depository
  @credit = credit
  @loan = loan
  @investment = investment
  @other = other
  @additional_properties = additional_properties
end

Instance Attribute Details

#creditCreditAccount

A credit card type account. Supported products for ‘credit` accounts are: Balance, Transactions, Identity, and Liabilities.

Returns:



22
23
24
# File 'lib/plaid/models/standalone_account_type.rb', line 22

def credit
  @credit
end

#depositoryDepositoryAccount

An account type holding cash, in which funds are deposited. Supported products for ‘depository` accounts are: Auth, Balance, Transactions, Identity, Payment Initiation, and Assets.

Returns:



17
18
19
# File 'lib/plaid/models/standalone_account_type.rb', line 17

def depository
  @depository
end

#investmentInvestmentAccountSubtype

An investment account. Supported products for ‘investment` accounts are: Balance and Investments.



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

def investment
  @investment
end

#loanLoanAccount

A loan type account. Supported products for ‘loan` accounts are: Balance, Liabilities, and Transactions.

Returns:



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

def loan
  @loan
end

#otherString

Other or unknown account type. Supported products for ‘other` accounts are: Balance, Transactions, Identity, and Assets.

Returns:

  • (String)


37
38
39
# File 'lib/plaid/models/standalone_account_type.rb', line 37

def other
  @other
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/plaid/models/standalone_account_type.rb', line 74

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 = InvestmentAccountSubtype.from_hash(hash['investment']) if hash['investment']
  other = hash.key?('other') ? hash['other'] : 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.
  StandaloneAccountType.new(depository: depository,
                            credit: credit,
                            loan: loan,
                            investment: investment,
                            other: other,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
# File 'lib/plaid/models/standalone_account_type.rb', line 40

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

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/plaid/models/standalone_account_type.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
# File 'lib/plaid/models/standalone_account_type.rb', line 51

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



108
109
110
111
112
113
# File 'lib/plaid/models/standalone_account_type.rb', line 108

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

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
# File 'lib/plaid/models/standalone_account_type.rb', line 101

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