Class: Plaid::IncomeVerificationPaystubGetResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/income_verification_paystub_get_response.rb

Overview

IncomeVerificationPaystubGetResponse defines the response schema for ‘/income/verification/paystub/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(paystub:, request_id:, error: SKIP, additional_properties: nil) ⇒ IncomeVerificationPaystubGetResponse

Returns a new instance of IncomeVerificationPaystubGetResponse.



52
53
54
55
56
57
58
59
60
61
# File 'lib/plaid/models/income_verification_paystub_get_response.rb', line 52

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

  @paystub = paystub
  @error = error unless error == SKIP
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#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_paystub_get_response.rb', line 23

def error
  @error
end

#paystubPaystub

An object representing data extracted from the end user’s paystub.

Returns:



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

def paystub
  @paystub
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)


29
30
31
# File 'lib/plaid/models/income_verification_paystub_get_response.rb', line 29

def request_id
  @request_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/plaid/models/income_verification_paystub_get_response.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  paystub = Paystub.from_hash(hash['paystub']) if hash['paystub']
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  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.
  IncomeVerificationPaystubGetResponse.new(paystub: paystub,
                                           request_id: request_id,
                                           error: error,
                                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



32
33
34
35
36
37
38
# File 'lib/plaid/models/income_verification_paystub_get_response.rb', line 32

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

.nullablesObject

An array for nullable fields



48
49
50
# File 'lib/plaid/models/income_verification_paystub_get_response.rb', line 48

def self.nullables
  []
end

.optionalsObject

An array for optional fields



41
42
43
44
45
# File 'lib/plaid/models/income_verification_paystub_get_response.rb', line 41

def self.optionals
  %w[
    error
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



94
95
96
97
98
# File 'lib/plaid/models/income_verification_paystub_get_response.rb', line 94

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} paystub: #{@paystub.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.



87
88
89
90
91
# File 'lib/plaid/models/income_verification_paystub_get_response.rb', line 87

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