Class: ThePlaidApi::Status4

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

Overview

This field is deprecated in favor of the ‘breakdown` object, which provides more granular institution health data. `HEALTHY`: the majority of requests are successful `DEGRADED`: only some requests are successful `DOWN`: all requests are failing

Constant Summary collapse

STATUS4 =
[
  # TODO: Write general description for HEALTHY
  HEALTHY = 'HEALTHY'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = HEALTHY) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/the_plaid_api/models/status4.rb', line 29

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

  str = value.to_s.strip

  case str.downcase
  when 'healthy' then HEALTHY
  when 'degraded' then DEGRADED
  when 'down' then DOWN
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/the_plaid_api/models/status4.rb', line 23

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

  STATUS4.include?(value)
end