Class: ThePlaidApi::SelfieAnalysis

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

Overview

High level descriptions of how the associated selfie was processed. If a selfie fails verification, the details in the ‘analysis` object should help clarify why the selfie was rejected.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(document_comparison:, liveness_check:, facial_analysis: SKIP, additional_properties: nil) ⇒ SelfieAnalysis

Returns a new instance of SelfieAnalysis.



53
54
55
56
57
58
59
60
61
62
# File 'lib/the_plaid_api/models/selfie_analysis.rb', line 53

def initialize(document_comparison:, liveness_check:, facial_analysis: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @document_comparison = document_comparison
  @liveness_check = liveness_check
  @facial_analysis = facial_analysis unless facial_analysis == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#document_comparisonSelfieAnalysisDocumentComparison

Information about the comparison between the selfie and the document (if documentary verification also ran).



17
18
19
# File 'lib/the_plaid_api/models/selfie_analysis.rb', line 17

def document_comparison
  @document_comparison
end

#facial_analysisSelfieAnalysisFacialAnalysis

Analysis of the facial features of the selfie when compared to the face in the uploaded document, if one is present.



28
29
30
# File 'lib/the_plaid_api/models/selfie_analysis.rb', line 28

def facial_analysis
  @facial_analysis
end

#liveness_checkSelfieAnalysisLivenessCheck

Assessment of whether the selfie capture is of a real human being, as opposed to a picture of a human on a screen, a picture of a paper cut out, someone wearing a mask, or a deepfake.



23
24
25
# File 'lib/the_plaid_api/models/selfie_analysis.rb', line 23

def liveness_check
  @liveness_check
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/the_plaid_api/models/selfie_analysis.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  document_comparison =
    hash.key?('document_comparison') ? hash['document_comparison'] : nil
  liveness_check =
    hash.key?('liveness_check') ? hash['liveness_check'] : nil
  facial_analysis = SelfieAnalysisFacialAnalysis.from_hash(hash['facial_analysis']) if
    hash['facial_analysis']

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  SelfieAnalysis.new(document_comparison: document_comparison,
                     liveness_check: liveness_check,
                     facial_analysis: facial_analysis,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['document_comparison'] = 'document_comparison'
  @_hash['liveness_check'] = 'liveness_check'
  @_hash['facial_analysis'] = 'facial_analysis'
  @_hash
end

.nullablesObject

An array for nullable fields



47
48
49
50
51
# File 'lib/the_plaid_api/models/selfie_analysis.rb', line 47

def self.nullables
  %w[
    facial_analysis
  ]
end

.optionalsObject

An array for optional fields



40
41
42
43
44
# File 'lib/the_plaid_api/models/selfie_analysis.rb', line 40

def self.optionals
  %w[
    facial_analysis
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



99
100
101
102
103
104
# File 'lib/the_plaid_api/models/selfie_analysis.rb', line 99

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} document_comparison: #{@document_comparison.inspect}, liveness_check:"\
  " #{@liveness_check.inspect}, facial_analysis: #{@facial_analysis.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



91
92
93
94
95
96
# File 'lib/the_plaid_api/models/selfie_analysis.rb', line 91

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} document_comparison: #{@document_comparison}, liveness_check:"\
  " #{@liveness_check}, facial_analysis: #{@facial_analysis}, additional_properties:"\
  " #{@additional_properties}>"
end