Class: Plaid::IncomeVerificationPaystubsGetResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/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:, error: SKIP, document_metadata: SKIP, additional_properties: nil) ⇒ IncomeVerificationPaystubsGetResponse

Returns a new instance of IncomeVerificationPaystubsGetResponse.



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/plaid/models/income_verification_paystubs_get_response.rb', line 62

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

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

Instance Attribute Details

#document_metadataArray[DocumentMetadata]

We use standard HTTP response codes for success and failure notifications, and our errors are further classified by ‘error_type`. In general, 200 HTTP codes correspond to success, 40X codes are for developer- or user-related failures, and 50X codes are for Plaid-related issues. Error fields will be `null` if no error has occurred.

Returns:



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

def 
  @document_metadata
end

#errorError

We use standard HTTP response codes for success and failure notifications, and our errors are further classified by ‘error_type`. In general, 200 HTTP codes correspond to success, 40X codes are for developer- or user-related failures, and 50X codes are for Plaid-related issues. Error fields will be `null` if no error has occurred.

Returns:



23
24
25
# File 'lib/plaid/models/income_verification_paystubs_get_response.rb', line 23

def error
  @error
end

#paystubsArray[Paystub]

TODO: Write general description for this method

Returns:



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

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/plaid/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.



75
76
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
# File 'lib/plaid/models/income_verification_paystubs_get_response.rb', line 75

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
  error = Error.from_hash(hash['error']) if hash['error']
  # 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')

  # 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,
                                            error: error,
                                            document_metadata: ,
                                            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/plaid/models/income_verification_paystubs_get_response.rb', line 40

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

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/plaid/models/income_verification_paystubs_get_response.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    error
    document_metadata
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



118
119
120
121
122
123
# File 'lib/plaid/models/income_verification_paystubs_get_response.rb', line 118

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