Class: ThePlaidApi::DocumentAuthenticityMatchCode

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

Overview

High level summary of whether the document in the provided image matches the formatting rules and security checks for the associated jurisdiction. For example, most identity documents have formatting rules like the following: The image of the person’s face must have a certain contrast in order to highlight skin tone The subject in the document’s image must remove eye glasses and pose in a certain way The informational fields (name, date of birth, ID number, etc.) must be colored and aligned according to specific rules Security features like watermarks and background patterns must be present So a ‘match` status for this field indicates that the document in the provided image seems to conform to the various formatting and security rules associated with the detected document.

Constant Summary collapse

DOCUMENT_AUTHENTICITY_MATCH_CODE =
[
  # TODO: Write general description for MATCH
  MATCH = 'match'.freeze,

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = MATCH) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/the_plaid_api/models/document_authenticity_match_code.rb', line 39

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

  str = value.to_s.strip

  case str.downcase
  when 'match' then MATCH
  when 'partial_match' then PARTIAL_MATCH
  when 'no_match' then NO_MATCH
  when 'no_data' then NO_DATA
  else
    default_value
  end
end

.validate(value) ⇒ Object



33
34
35
36
37
# File 'lib/the_plaid_api/models/document_authenticity_match_code.rb', line 33

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

  DOCUMENT_AUTHENTICITY_MATCH_CODE.include?(value)
end