Class: ThePlaidApi::ActionState

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

Overview

Enum representing the state of the action/activity.

Constant Summary collapse

ACTION_STATE =
[
  # TODO: Write general description for UNKNOWN
  UNKNOWN = 'UNKNOWN'.freeze,

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = UNKNOWN) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/the_plaid_api/models/action_state.rb', line 32

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

  str = value.to_s.strip

  case str.downcase
  when 'unknown' then UNKNOWN
  when 'attempt' then ATTEMPT
  when 'success' then SUCCESS
  when 'failure' then FAILURE
  when 'skipped' then SKIPPED
  else
    default_value
  end
end

.validate(value) ⇒ Object



26
27
28
29
30
# File 'lib/the_plaid_api/models/action_state.rb', line 26

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

  ACTION_STATE.include?(value)
end