Class: ThePlaidApi::Strategy

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

Overview

An instruction specifying what steps the new Identity Verification attempt should require the user to complete: ‘reset` - Restart the user at the beginning of the session, regardless of whether they successfully completed part of their previous session. `incomplete` - Start the new session at the step that the user failed in the previous session, skipping steps that have already been successfully completed. `infer` - If the most recent Identity Verification attempt associated with the given `client_user_id` has a status of `failed` or `expired`, retry using the `incomplete` strategy. Otherwise, use the `reset` strategy. `custom` - Start the new session with a custom configuration, specified by the value of the `steps` field Note: The `incomplete` strategy cannot be applied if the session’s failing step is ‘screening` or `risk_check`. The `infer` strategy cannot be applied if the session’s status is still ‘active`

Constant Summary collapse

STRATEGY =
[
  # TODO: Write general description for RESET
  RESET = 'reset'.freeze,

  # TODO: Write general description for INCOMPLETE
  INCOMPLETE = 'incomplete'.freeze,

  # TODO: Write general description for INFER
  INFER = 'infer'.freeze,

  # TODO: Write general description for CUSTOM
  CUSTOM = 'custom'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = RESET) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/the_plaid_api/models/strategy.rb', line 41

def self.from_value(value, default_value = RESET)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'reset' then RESET
  when 'incomplete' then INCOMPLETE
  when 'infer' then INFER
  when 'custom' then CUSTOM
  else
    default_value
  end
end

.validate(value) ⇒ Object



35
36
37
38
39
# File 'lib/the_plaid_api/models/strategy.rb', line 35

def self.validate(value)
  return false if value.nil?

  STRATEGY.include?(value)
end