Class: Plaid::OverrideAccounts
- Defined in:
- lib/plaid/models/override_accounts.rb
Overview
Data to use to set values of test accounts. Some values cannot be specified in the schema and will instead will be calculated from other test data in order to achieve more consistent, realistic test data.
Instance Attribute Summary collapse
-
#currency ⇒ String
ISO-4217 currency code.
-
#force_available_balance ⇒ Float
If provided, the account will always have this amount as its available balance, regardless of current balance or changes in transactions over time.
-
#holdings ⇒ HoldingsOverride
Specify the holdings on the account.
-
#identity ⇒ OwnerOverride
Data about the owner or owners of an account.
-
#income ⇒ IncomeOverride
Specify payroll data on the account.
-
#inflow_model ⇒ InflowModel
The ‘inflow_model` allows you to model a test account that receives regular income or make regular payments on a loan.
-
#investment_transactions ⇒ InvestmentsTransactionsOverride
Specify the list of investments transactions on the account.
-
#liability ⇒ LiabilityOverride
Used to configure Sandbox test data for the Liabilities product.
-
#meta ⇒ Meta
Allows specifying the metadata of the test account.
-
#numbers ⇒ Numbers
Account and bank identifier number data used to configure the test account.
-
#starting_balance ⇒ Float
If provided, the account will start with this amount as the current balance.
-
#subtype ⇒ AccountSubtype
See the [Account type schema](plaid.com/docs/api/accounts/#account-type-schema) for a full listing of account types and corresponding subtypes.
-
#transactions ⇒ Array[TransactionOverride]
Specify the list of transactions on the account.
-
#type ⇒ OverrideAccountType
‘investment:` Investment account `credit:` Credit card `depository:` Depository account `loan:` Loan account `payroll:` Payroll acccount `other:` Non-specified account type See the [Account type schema](plaid.com/docs/api/accounts#account-type-schema) for a full listing of account types and corresponding subtypes.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(type:, subtype:, starting_balance:, force_available_balance:, currency:, meta:, numbers:, transactions:, identity:, liability:, inflow_model:, holdings: SKIP, investment_transactions: SKIP, income: SKIP, additional_properties: nil) ⇒ OverrideAccounts
constructor
A new instance of OverrideAccounts.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(type:, subtype:, starting_balance:, force_available_balance:, currency:, meta:, numbers:, transactions:, identity:, liability:, inflow_model:, holdings: SKIP, investment_transactions: SKIP, income: SKIP, additional_properties: nil) ⇒ OverrideAccounts
Returns a new instance of OverrideAccounts.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/plaid/models/override_accounts.rb', line 123 def initialize(type:, subtype:, starting_balance:, force_available_balance:, currency:, meta:, numbers:, transactions:, identity:, liability:, inflow_model:, holdings: SKIP, investment_transactions: SKIP, income: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @type = type @subtype = subtype @starting_balance = starting_balance @force_available_balance = force_available_balance @currency = currency @meta = @numbers = numbers @transactions = transactions @holdings = holdings unless holdings == SKIP @investment_transactions = investment_transactions unless investment_transactions == SKIP @identity = identity @liability = liability @inflow_model = inflow_model @income = income unless income == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#currency ⇒ String
ISO-4217 currency code. If provided, the account will be denominated in the given currency. Transactions will also be in this currency by default.
46 47 48 |
# File 'lib/plaid/models/override_accounts.rb', line 46 def currency @currency end |
#force_available_balance ⇒ Float
If provided, the account will always have this amount as its available balance, regardless of current balance or changes in transactions over time.
41 42 43 |
# File 'lib/plaid/models/override_accounts.rb', line 41 def force_available_balance @force_available_balance end |
#holdings ⇒ HoldingsOverride
Specify the holdings on the account.
63 64 65 |
# File 'lib/plaid/models/override_accounts.rb', line 63 def holdings @holdings end |
#identity ⇒ OwnerOverride
Data about the owner or owners of an account. Any fields not specified will be filled in with default Sandbox information.
72 73 74 |
# File 'lib/plaid/models/override_accounts.rb', line 72 def identity @identity end |
#income ⇒ IncomeOverride
Specify payroll data on the account.
87 88 89 |
# File 'lib/plaid/models/override_accounts.rb', line 87 def income @income end |
#inflow_model ⇒ InflowModel
The ‘inflow_model` allows you to model a test account that receives regular income or make regular payments on a loan. Any transactions generated by the `inflow_model` will appear in addition to randomly generated test data or transactions specified by `override_accounts`.
83 84 85 |
# File 'lib/plaid/models/override_accounts.rb', line 83 def inflow_model @inflow_model end |
#investment_transactions ⇒ InvestmentsTransactionsOverride
Specify the list of investments transactions on the account.
67 68 69 |
# File 'lib/plaid/models/override_accounts.rb', line 67 def investment_transactions @investment_transactions end |
#liability ⇒ LiabilityOverride
Used to configure Sandbox test data for the Liabilities product
76 77 78 |
# File 'lib/plaid/models/override_accounts.rb', line 76 def liability @liability end |
#meta ⇒ Meta
Allows specifying the metadata of the test account
50 51 52 |
# File 'lib/plaid/models/override_accounts.rb', line 50 def @meta end |
#numbers ⇒ Numbers
Account and bank identifier number data used to configure the test account. All values are optional.
55 56 57 |
# File 'lib/plaid/models/override_accounts.rb', line 55 def numbers @numbers end |
#starting_balance ⇒ Float
If provided, the account will start with this amount as the current balance.
35 36 37 |
# File 'lib/plaid/models/override_accounts.rb', line 35 def starting_balance @starting_balance end |
#subtype ⇒ AccountSubtype
See the [Account type schema](plaid.com/docs/api/accounts/#account-type-schema) for a full listing of account types and corresponding subtypes.
30 31 32 |
# File 'lib/plaid/models/override_accounts.rb', line 30 def subtype @subtype end |
#transactions ⇒ Array[TransactionOverride]
Specify the list of transactions on the account.
59 60 61 |
# File 'lib/plaid/models/override_accounts.rb', line 59 def transactions @transactions end |
#type ⇒ OverrideAccountType
‘investment:` Investment account `credit:` Credit card `depository:` Depository account `loan:` Loan account `payroll:` Payroll acccount `other:` Non-specified account type See the [Account type schema](plaid.com/docs/api/accounts#account-type-schema) for a full listing of account types and corresponding subtypes.
24 25 26 |
# File 'lib/plaid/models/override_accounts.rb', line 24 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/plaid/models/override_accounts.rb', line 149 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. type = hash.key?('type') ? hash['type'] : nil subtype = hash.key?('subtype') ? hash['subtype'] : nil starting_balance = hash.key?('starting_balance') ? hash['starting_balance'] : nil force_available_balance = hash.key?('force_available_balance') ? hash['force_available_balance'] : nil currency = hash.key?('currency') ? hash['currency'] : nil = Meta.from_hash(hash['meta']) if hash['meta'] numbers = Numbers.from_hash(hash['numbers']) if hash['numbers'] # Parameter is an array, so we need to iterate through it transactions = nil unless hash['transactions'].nil? transactions = [] hash['transactions'].each do |structure| transactions << (TransactionOverride.from_hash(structure) if structure) end end transactions = nil unless hash.key?('transactions') identity = OwnerOverride.from_hash(hash['identity']) if hash['identity'] liability = LiabilityOverride.from_hash(hash['liability']) if hash['liability'] inflow_model = InflowModel.from_hash(hash['inflow_model']) if hash['inflow_model'] holdings = HoldingsOverride.from_hash(hash['holdings']) if hash['holdings'] if hash['investment_transactions'] investment_transactions = InvestmentsTransactionsOverride.from_hash(hash['investment_transactions']) end income = IncomeOverride.from_hash(hash['income']) if hash['income'] # 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. OverrideAccounts.new(type: type, subtype: subtype, starting_balance: starting_balance, force_available_balance: force_available_balance, currency: currency, meta: , numbers: numbers, transactions: transactions, identity: identity, liability: liability, inflow_model: inflow_model, holdings: holdings, investment_transactions: investment_transactions, income: income, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/plaid/models/override_accounts.rb', line 90 def self.names @_hash = {} if @_hash.nil? @_hash['type'] = 'type' @_hash['subtype'] = 'subtype' @_hash['starting_balance'] = 'starting_balance' @_hash['force_available_balance'] = 'force_available_balance' @_hash['currency'] = 'currency' @_hash['meta'] = 'meta' @_hash['numbers'] = 'numbers' @_hash['transactions'] = 'transactions' @_hash['holdings'] = 'holdings' @_hash['investment_transactions'] = 'investment_transactions' @_hash['identity'] = 'identity' @_hash['liability'] = 'liability' @_hash['inflow_model'] = 'inflow_model' @_hash['income'] = 'income' @_hash end |
.nullables ⇒ Object
An array for nullable fields
119 120 121 |
# File 'lib/plaid/models/override_accounts.rb', line 119 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
110 111 112 113 114 115 116 |
# File 'lib/plaid/models/override_accounts.rb', line 110 def self.optionals %w[ holdings investment_transactions income ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/plaid/models/override_accounts.rb', line 218 def inspect class_name = self.class.name.split('::').last "<#{class_name} type: #{@type.inspect}, subtype: #{@subtype.inspect}, starting_balance:"\ " #{@starting_balance.inspect}, force_available_balance:"\ " #{@force_available_balance.inspect}, currency: #{@currency.inspect}, meta:"\ " #{@meta.inspect}, numbers: #{@numbers.inspect}, transactions: #{@transactions.inspect},"\ " holdings: #{@holdings.inspect}, investment_transactions:"\ " #{@investment_transactions.inspect}, identity: #{@identity.inspect}, liability:"\ " #{@liability.inspect}, inflow_model: #{@inflow_model.inspect}, income: #{@income.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
207 208 209 210 211 212 213 214 215 |
# File 'lib/plaid/models/override_accounts.rb', line 207 def to_s class_name = self.class.name.split('::').last "<#{class_name} type: #{@type}, subtype: #{@subtype}, starting_balance:"\ " #{@starting_balance}, force_available_balance: #{@force_available_balance}, currency:"\ " #{@currency}, meta: #{@meta}, numbers: #{@numbers}, transactions: #{@transactions},"\ " holdings: #{@holdings}, investment_transactions: #{@investment_transactions}, identity:"\ " #{@identity}, liability: #{@liability}, inflow_model: #{@inflow_model}, income:"\ " #{@income}, additional_properties: #{@additional_properties}>" end |