Class: ThePlaidApi::IncomeVerificationPaystubsGetResponse

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

Overview

IncomeVerificationPaystubsGetResponse defines the response schema for ‘/income/verification/paystubs/get`.

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(paystubs:, request_id:, document_metadata: SKIP, error: SKIP, additional_properties: nil) ⇒ IncomeVerificationPaystubsGetResponse

Returns a new instance of IncomeVerificationPaystubsGetResponse.



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/the_plaid_api/models/income_verification_paystubs_get_response.rb', line 64

def initialize(paystubs:, request_id:, document_metadata: SKIP, error: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @document_metadata =  unless  == SKIP
  @paystubs = paystubs
  @error = error unless error == SKIP
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#document_metadataArray[DocumentMetadata]

Metadata for an income document.

Returns:



15
16
17
# File 'lib/the_plaid_api/models/income_verification_paystubs_get_response.rb', line 15

def 
  @document_metadata
end

#errorError

Errors are identified by ‘error_code` and categorized by `error_type`. Use these in preference to HTTP status codes to identify and handle specific errors. HTTP status codes are set and provide the broadest categorization of errors: 4xx codes are for developer- or user-related errors, and 5xx codes are for Plaid-related errors, and the status will be 2xx in non-error cases. An Item with a non-`null` error object will only be part of an API response when calling `/item/get` to view Item status. Otherwise, error fields will be `null` if no error has occurred; if an error has occurred, an error code will be returned instead.

Returns:



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

def error
  @error
end

#paystubsArray[Paystub]

Metadata for an income document.

Returns:



19
20
21
# File 'lib/the_plaid_api/models/income_verification_paystubs_get_response.rb', line 19

def paystubs
  @paystubs
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


37
38
39
# File 'lib/the_plaid_api/models/income_verification_paystubs_get_response.rb', line 37

def request_id
  @request_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



77
78
79
80
81
82
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
117
# File 'lib/the_plaid_api/models/income_verification_paystubs_get_response.rb', line 77

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  paystubs = nil
  unless hash['paystubs'].nil?
    paystubs = []
    hash['paystubs'].each do |structure|
      paystubs << (Paystub.from_hash(structure) if structure)
    end
  end

  paystubs = nil unless hash.key?('paystubs')
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  # Parameter is an array, so we need to iterate through it
   = nil
  unless hash['document_metadata'].nil?
     = []
    hash['document_metadata'].each do |structure|
       << (DocumentMetadata.from_hash(structure) if structure)
    end
  end

   = SKIP unless hash.key?('document_metadata')
  error = Error.from_hash(hash['error']) if hash['error']

  # 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.
  IncomeVerificationPaystubsGetResponse.new(paystubs: paystubs,
                                            request_id: request_id,
                                            document_metadata: ,
                                            error: error,
                                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
# File 'lib/the_plaid_api/models/income_verification_paystubs_get_response.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['document_metadata'] = 'document_metadata'
  @_hash['paystubs'] = 'paystubs'
  @_hash['error'] = 'error'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



58
59
60
61
62
# File 'lib/the_plaid_api/models/income_verification_paystubs_get_response.rb', line 58

def self.nullables
  %w[
    error
  ]
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
# File 'lib/the_plaid_api/models/income_verification_paystubs_get_response.rb', line 50

def self.optionals
  %w[
    document_metadata
    error
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} document_metadata: #{@document_metadata.inspect}, paystubs:"\
  " #{@paystubs.inspect}, error: #{@error.inspect}, request_id: #{@request_id.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



120
121
122
123
124
# File 'lib/the_plaid_api/models/income_verification_paystubs_get_response.rb', line 120

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} document_metadata: #{@document_metadata}, paystubs: #{@paystubs}, error:"\
  " #{@error}, request_id: #{@request_id}, additional_properties: #{@additional_properties}>"
end