Class: ThePlaidApi::IdentityDocumentUploadMetadata

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

Overview

Metadata pertaining to the 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(document_type: SKIP, is_account_number_match: SKIP, page_count: SKIP, last_updated: SKIP, uploaded_at: SKIP, additional_properties: nil) ⇒ IdentityDocumentUploadMetadata

Returns a new instance of IdentityDocumentUploadMetadata.



68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/the_plaid_api/models/identity_document_upload_metadata.rb', line 68

def initialize(document_type: SKIP, is_account_number_match: SKIP,
               page_count: SKIP, last_updated: SKIP, uploaded_at: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @document_type = document_type unless document_type == SKIP
  @is_account_number_match =  unless  == SKIP
  @page_count = page_count unless page_count == SKIP
  @last_updated = last_updated unless last_updated == SKIP
  @uploaded_at = uploaded_at unless uploaded_at == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#document_typeString

The submitted document type. Currently, this will always be ‘BANK_STATEMENT`.

Returns:

  • (String)


16
17
18
# File 'lib/the_plaid_api/models/identity_document_upload_metadata.rb', line 16

def document_type
  @document_type
end

#is_account_number_matchTrueClass | FalseClass

Boolean field indicating whether the uploaded document’s account number matches the account number we have on file. If ‘false`, it is not recommended to accept the uploaded identity data as accurate without further verification.

Returns:

  • (TrueClass | FalseClass)


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

def 
  @is_account_number_match
end

#last_updatedDateTime

The timestamp when the document was last updated.

Returns:

  • (DateTime)


31
32
33
# File 'lib/the_plaid_api/models/identity_document_upload_metadata.rb', line 31

def last_updated
  @last_updated
end

#page_countInteger

The number of pages in the uploaded document.

Returns:

  • (Integer)


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

def page_count
  @page_count
end

#uploaded_atDateTime

The timestamp when the document was originally uploaded.

Returns:

  • (DateTime)


35
36
37
# File 'lib/the_plaid_api/models/identity_document_upload_metadata.rb', line 35

def uploaded_at
  @uploaded_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



83
84
85
86
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
113
114
115
116
# File 'lib/the_plaid_api/models/identity_document_upload_metadata.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  document_type = hash.key?('document_type') ? hash['document_type'] : SKIP
   =
    hash.key?('is_account_number_match') ? hash['is_account_number_match'] : SKIP
  page_count = hash.key?('page_count') ? hash['page_count'] : SKIP
  last_updated = if hash.key?('last_updated')
                   (DateTimeHelper.from_rfc3339(hash['last_updated']) if hash['last_updated'])
                 else
                   SKIP
                 end
  uploaded_at = if hash.key?('uploaded_at')
                  (DateTimeHelper.from_rfc3339(hash['uploaded_at']) if hash['uploaded_at'])
                else
                  SKIP
                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.
  IdentityDocumentUploadMetadata.new(document_type: document_type,
                                     is_account_number_match: ,
                                     page_count: page_count,
                                     last_updated: last_updated,
                                     uploaded_at: uploaded_at,
                                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
# File 'lib/the_plaid_api/models/identity_document_upload_metadata.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['document_type'] = 'document_type'
  @_hash['is_account_number_match'] = 'is_account_number_match'
  @_hash['page_count'] = 'page_count'
  @_hash['last_updated'] = 'last_updated'
  @_hash['uploaded_at'] = 'uploaded_at'
  @_hash
end

.nullablesObject

An array for nullable fields



60
61
62
63
64
65
66
# File 'lib/the_plaid_api/models/identity_document_upload_metadata.rb', line 60

def self.nullables
  %w[
    document_type
    is_account_number_match
    page_count
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    document_type
    is_account_number_match
    page_count
    last_updated
    uploaded_at
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



135
136
137
138
139
140
141
# File 'lib/the_plaid_api/models/identity_document_upload_metadata.rb', line 135

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} document_type: #{@document_type.inspect}, is_account_number_match:"\
  " #{@is_account_number_match.inspect}, page_count: #{@page_count.inspect}, last_updated:"\
  " #{@last_updated.inspect}, uploaded_at: #{@uploaded_at.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_last_updatedObject



118
119
120
# File 'lib/the_plaid_api/models/identity_document_upload_metadata.rb', line 118

def to_custom_last_updated
  DateTimeHelper.to_rfc3339(last_updated)
end

#to_custom_uploaded_atObject



122
123
124
# File 'lib/the_plaid_api/models/identity_document_upload_metadata.rb', line 122

def to_custom_uploaded_at
  DateTimeHelper.to_rfc3339(uploaded_at)
end

#to_sObject

Provides a human-readable string representation of the object.



127
128
129
130
131
132
# File 'lib/the_plaid_api/models/identity_document_upload_metadata.rb', line 127

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} document_type: #{@document_type}, is_account_number_match:"\
  " #{@is_account_number_match}, page_count: #{@page_count}, last_updated: #{@last_updated},"\
  " uploaded_at: #{@uploaded_at}, additional_properties: #{@additional_properties}>"
end