Class: ThePlaidApi::ImageQuality

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

Overview

A high level description of the quality of the image the user submitted. For example, an image that is blurry, distorted by glare from a nearby light source, or improperly framed might be marked as low or medium quality. Poor quality images are more likely to fail OCR and/or template conformity checks. Note: By default, Plaid will let a user recapture document images twice before failing the entire session if we attribute the failure to low image quality.

Constant Summary collapse

IMAGE_QUALITY =
[
  # TODO: Write general description for HIGH
  HIGH = 'high'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = HIGH) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'high' then HIGH
  when 'medium' then MEDIUM
  when 'low' then LOW
  else
    default_value
  end
end

.validate(value) ⇒ Object



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

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

  IMAGE_QUALITY.include?(value)
end