Class: ThePlaidApi::PhysicalDocumentImages

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

Overview

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.

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(original_front:, original_back:, cropped_front:, cropped_back:, face:, additional_properties: nil) ⇒ PhysicalDocumentImages

Returns a new instance of PhysicalDocumentImages.



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

def initialize(original_front:, original_back:, cropped_front:,
               cropped_back:, face:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @original_front = original_front
  @original_back = original_back
  @cropped_front = cropped_front
  @cropped_back = cropped_back
  @face = face
  @additional_properties = additional_properties
end

Instance Attribute Details

#cropped_backString

Temporary URL that expires after 60 seconds for downloading a cropped image containing just the back of the document. Might be null if the back of the document was not collected.

Returns:

  • (String)


38
39
40
# File 'lib/the_plaid_api/models/physical_document_images.rb', line 38

def cropped_back
  @cropped_back
end

#cropped_frontString

Temporary URL that expires after 60 seconds for downloading a cropped image containing just the front of the document.

Returns:

  • (String)


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

def cropped_front
  @cropped_front
end

#faceString

Temporary URL that expires after 60 seconds for downloading a crop of just the user’s face from the document image. Might be null if the document does not contain a face photo.

Returns:

  • (String)


44
45
46
# File 'lib/the_plaid_api/models/physical_document_images.rb', line 44

def face
  @face
end

#original_backString

Temporary URL that expires after 60 seconds for downloading the original image of the back of the document. Might be null if the back of the document was not collected.

Returns:

  • (String)


27
28
29
# File 'lib/the_plaid_api/models/physical_document_images.rb', line 27

def original_back
  @original_back
end

#original_frontString

Temporary URL that expires after 60 seconds for downloading the uncropped original image of the front of the document.

Returns:

  • (String)


21
22
23
# File 'lib/the_plaid_api/models/physical_document_images.rb', line 21

def original_front
  @original_front
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
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
# File 'lib/the_plaid_api/models/physical_document_images.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  original_front =
    hash.key?('original_front') ? hash['original_front'] : nil
  original_back = hash.key?('original_back') ? hash['original_back'] : nil
  cropped_front = hash.key?('cropped_front') ? hash['cropped_front'] : nil
  cropped_back = hash.key?('cropped_back') ? hash['cropped_back'] : nil
  face = hash.key?('face') ? hash['face'] : nil

  # 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.
  PhysicalDocumentImages.new(original_front: original_front,
                             original_back: original_back,
                             cropped_front: cropped_front,
                             cropped_back: cropped_back,
                             face: face,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
# File 'lib/the_plaid_api/models/physical_document_images.rb', line 47

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['original_front'] = 'original_front'
  @_hash['original_back'] = 'original_back'
  @_hash['cropped_front'] = 'cropped_front'
  @_hash['cropped_back'] = 'cropped_back'
  @_hash['face'] = 'face'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
66
67
68
69
70
71
# File 'lib/the_plaid_api/models/physical_document_images.rb', line 63

def self.nullables
  %w[
    original_front
    original_back
    cropped_front
    cropped_back
    face
  ]
end

.optionalsObject

An array for optional fields



58
59
60
# File 'lib/the_plaid_api/models/physical_document_images.rb', line 58

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} original_front: #{@original_front.inspect}, original_back:"\
  " #{@original_back.inspect}, cropped_front: #{@cropped_front.inspect}, cropped_back:"\
  " #{@cropped_back.inspect}, face: #{@face.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



115
116
117
118
119
120
# File 'lib/the_plaid_api/models/physical_document_images.rb', line 115

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} original_front: #{@original_front}, original_back: #{@original_back},"\
  " cropped_front: #{@cropped_front}, cropped_back: #{@cropped_back}, face: #{@face},"\
  " additional_properties: #{@additional_properties}>"
end