Class: ThePlaidApi::DocumentaryVerificationDocument

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

Overview

Images, extracted data, and analysis from a user’s identity document

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(status:, attempt:, images:, extracted_data:, analysis:, redacted_at:, additional_properties: nil) ⇒ DocumentaryVerificationDocument

Returns a new instance of DocumentaryVerificationDocument.



73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/the_plaid_api/models/documentary_verification_document.rb', line 73

def initialize(status:, attempt:, images:, extracted_data:, analysis:,
               redacted_at:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @status = status
  @attempt = attempt
  @images = images
  @extracted_data = extracted_data
  @analysis = analysis
  @redacted_at = redacted_at
  @additional_properties = additional_properties
end

Instance Attribute Details

#analysisDocumentAnalysis

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

Returns:



42
43
44
# File 'lib/the_plaid_api/models/documentary_verification_document.rb', line 42

def analysis
  @analysis
end

#attemptInteger

The ‘attempt` field begins with 1 and increments with each subsequent document upload.

Returns:

  • (Integer)


22
23
24
# File 'lib/the_plaid_api/models/documentary_verification_document.rb', line 22

def attempt
  @attempt
end

#extracted_dataPhysicalDocumentExtractedData

Data extracted from a user-submitted document.



36
37
38
# File 'lib/the_plaid_api/models/documentary_verification_document.rb', line 36

def extracted_data
  @extracted_data
end

#imagesPhysicalDocumentImages

URLs for downloading original and cropped images for this document submission. The URLs are designed to only allow downloading, not hot linking, so the URL will only serve the document image for 60 seconds before expiring. The expiration time is 60 seconds after the ‘GET` request for the associated Identity Verification attempt. A new expiring URL is generated with each request, so you can always rerequest the Identity Verification attempt if one of your URLs expires.



32
33
34
# File 'lib/the_plaid_api/models/documentary_verification_document.rb', line 32

def images
  @images
end

#redacted_atDateTime

An ISO8601 formatted timestamp.

Returns:

  • (DateTime)


46
47
48
# File 'lib/the_plaid_api/models/documentary_verification_document.rb', line 46

def redacted_at
  @redacted_at
end

#statusDocumentStatus

An outcome status for this specific document submission. Distinct from the overall ‘documentary_verification.status` that summarizes the verification outcome from one or more documents.

Returns:



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

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/the_plaid_api/models/documentary_verification_document.rb', line 88

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  status = hash.key?('status') ? hash['status'] : nil
  attempt = hash.key?('attempt') ? hash['attempt'] : nil
  images = PhysicalDocumentImages.from_hash(hash['images']) if hash['images']
  extracted_data = PhysicalDocumentExtractedData.from_hash(hash['extracted_data']) if
    hash['extracted_data']
  analysis = DocumentAnalysis.from_hash(hash['analysis']) if hash['analysis']
  redacted_at = if hash.key?('redacted_at')
                  (DateTimeHelper.from_rfc3339(hash['redacted_at']) if hash['redacted_at'])
                end

  # 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.
  DocumentaryVerificationDocument.new(status: status,
                                      attempt: attempt,
                                      images: images,
                                      extracted_data: extracted_data,
                                      analysis: analysis,
                                      redacted_at: redacted_at,
                                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
# File 'lib/the_plaid_api/models/documentary_verification_document.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['status'] = 'status'
  @_hash['attempt'] = 'attempt'
  @_hash['images'] = 'images'
  @_hash['extracted_data'] = 'extracted_data'
  @_hash['analysis'] = 'analysis'
  @_hash['redacted_at'] = 'redacted_at'
  @_hash
end

.nullablesObject

An array for nullable fields



66
67
68
69
70
71
# File 'lib/the_plaid_api/models/documentary_verification_document.rb', line 66

def self.nullables
  %w[
    extracted_data
    redacted_at
  ]
end

.optionalsObject

An array for optional fields



61
62
63
# File 'lib/the_plaid_api/models/documentary_verification_document.rb', line 61

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



132
133
134
135
136
137
138
# File 'lib/the_plaid_api/models/documentary_verification_document.rb', line 132

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status.inspect}, attempt: #{@attempt.inspect}, images:"\
  " #{@images.inspect}, extracted_data: #{@extracted_data.inspect}, analysis:"\
  " #{@analysis.inspect}, redacted_at: #{@redacted_at.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_redacted_atObject



119
120
121
# File 'lib/the_plaid_api/models/documentary_verification_document.rb', line 119

def to_custom_redacted_at
  DateTimeHelper.to_rfc3339(redacted_at)
end

#to_sObject

Provides a human-readable string representation of the object.



124
125
126
127
128
129
# File 'lib/the_plaid_api/models/documentary_verification_document.rb', line 124

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status}, attempt: #{@attempt}, images: #{@images},"\
  " extracted_data: #{@extracted_data}, analysis: #{@analysis}, redacted_at: #{@redacted_at},"\
  " additional_properties: #{@additional_properties}>"
end