Class: ThePlaidApi::UserCustomPassword

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

Overview

Custom test accounts are configured with a JSON configuration object formulated according to the schema below. All top level fields are optional. Sending an empty object as a configuration will result in an account configured with random balances and transaction history.

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(seed:, override_accounts:, mfa:, recaptcha:, force_error:, version: SKIP, additional_properties: nil) ⇒ UserCustomPassword

Returns a new instance of UserCustomPassword.



98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/the_plaid_api/models/user_custom_password.rb', line 98

def initialize(seed:, override_accounts:, mfa:, recaptcha:, force_error:,
               version: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @version = version unless version == SKIP
  @seed = seed
  @override_accounts = override_accounts
  @mfa = mfa
  @recaptcha = recaptcha
  @force_error = force_error
  @additional_properties = additional_properties
end

Instance Attribute Details

#force_errorString

An error code to force on Item creation. Possible values are: ‘“INSTITUTION_NOT_RESPONDING”` `“INSTITUTION_NO_LONGER_SUPPORTED”` `“INVALID_CREDENTIALS”` `“INVALID_MFA”` `“ITEM_LOCKED”` `“ITEM_LOGIN_REQUIRED”` `“ITEM_NOT_SUPPORTED”` `“INVALID_LINK_TOKEN”` `“MFA_NOT_SUPPORTED”` `“NO_ACCOUNTS”` `“PLAID_ERROR”` `“USER_INPUT_TIMEOUT”` `“USER_SETUP_REQUIRED”`

Returns:

  • (String)


70
71
72
# File 'lib/the_plaid_api/models/user_custom_password.rb', line 70

def force_error
  @force_error
end

#mfaMfa

Specifies the multi-factor authentication settings to use with this test account

Returns:



45
46
47
# File 'lib/the_plaid_api/models/user_custom_password.rb', line 45

def mfa
  @mfa
end

#override_accountsArray[OverrideAccounts]

An array of account overrides to configure the accounts for the Item. By default, if no override is specified, transactions and account data will be randomly generated based on the account type and subtype, and other products will have fixed or empty data.

Returns:



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

def override_accounts
  @override_accounts
end

#recaptchaString

You may trigger a reCAPTCHA in Plaid Link in the Sandbox environment by using the recaptcha field. Possible values are ‘good` or `bad`. A value of `good` will result in successful Item creation and `bad` will result in a `RECAPTCHA_BAD` error to simulate a failed reCAPTCHA. Both values require the reCAPTCHA to be manually solved within Plaid Link.

Returns:

  • (String)


53
54
55
# File 'lib/the_plaid_api/models/user_custom_password.rb', line 53

def recaptcha
  @recaptcha
end

#seedString

A seed, in the form of a string, that will be used to randomly generate account and transaction data, if this data is not specified using the ‘override_accounts` argument. If no seed is specified, the randomly generated data will be different each time. Note that transactions data is generated relative to the Item’s creation date. Different Items created on different dates with the same seed for transactions data will have different dates for the transactions. The number of days between each transaction and the Item creation will remain constant. For example, an Item created on December 15 might show a transaction on December 14. An Item created on December 20, using the same seed, would show that same transaction occurring on December 19.

Returns:

  • (String)


33
34
35
# File 'lib/the_plaid_api/models/user_custom_password.rb', line 33

def seed
  @seed
end

#versionString

The version of the password schema to use, possible values are 1 or 2. The default value is 2. You should only specify 1 if you know it is necessary for your test suite.

Returns:

  • (String)


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

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/the_plaid_api/models/user_custom_password.rb', line 113

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  seed = hash.key?('seed') ? hash['seed'] : nil
  # Parameter is an array, so we need to iterate through it
  override_accounts = nil
  unless hash['override_accounts'].nil?
    override_accounts = []
    hash['override_accounts'].each do |structure|
      override_accounts << (OverrideAccounts.from_hash(structure) if structure)
    end
  end

  override_accounts = nil unless hash.key?('override_accounts')
  mfa = Mfa.from_hash(hash['mfa']) if hash['mfa']
  recaptcha = hash.key?('recaptcha') ? hash['recaptcha'] : nil
  force_error = hash.key?('force_error') ? hash['force_error'] : nil
  version = hash.key?('version') ? hash['version'] : SKIP

  # 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.
  UserCustomPassword.new(seed: seed,
                         override_accounts: override_accounts,
                         mfa: mfa,
                         recaptcha: recaptcha,
                         force_error: force_error,
                         version: version,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



73
74
75
76
77
78
79
80
81
82
# File 'lib/the_plaid_api/models/user_custom_password.rb', line 73

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['version'] = 'version'
  @_hash['seed'] = 'seed'
  @_hash['override_accounts'] = 'override_accounts'
  @_hash['mfa'] = 'mfa'
  @_hash['recaptcha'] = 'recaptcha'
  @_hash['force_error'] = 'force_error'
  @_hash
end

.nullablesObject

An array for nullable fields



92
93
94
95
96
# File 'lib/the_plaid_api/models/user_custom_password.rb', line 92

def self.nullables
  %w[
    version
  ]
end

.optionalsObject

An array for optional fields



85
86
87
88
89
# File 'lib/the_plaid_api/models/user_custom_password.rb', line 85

def self.optionals
  %w[
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



159
160
161
162
163
164
# File 'lib/the_plaid_api/models/user_custom_password.rb', line 159

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} version: #{@version.inspect}, seed: #{@seed.inspect}, override_accounts:"\
  " #{@override_accounts.inspect}, mfa: #{@mfa.inspect}, recaptcha: #{@recaptcha.inspect},"\
  " force_error: #{@force_error.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



151
152
153
154
155
156
# File 'lib/the_plaid_api/models/user_custom_password.rb', line 151

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} version: #{@version}, seed: #{@seed}, override_accounts:"\
  " #{@override_accounts}, mfa: #{@mfa}, recaptcha: #{@recaptcha}, force_error:"\
  " #{@force_error}, additional_properties: #{@additional_properties}>"
end