Class: ThePlaidApi::CraBankIncomeCause

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

Overview

An error object and associated ‘item_id` used to identify a specific Item and error when a batch operation operating on multiple Items has encountered an error in one of the Items.

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(error_type:, error_code:, error_message:, display_message:, additional_properties: nil) ⇒ CraBankIncomeCause

Returns a new instance of CraBankIncomeCause.



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/the_plaid_api/models/cra_bank_income_cause.rb', line 57

def initialize(error_type:, error_code:, error_message:, display_message:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @error_type = error_type
  @error_code = error_code
  @error_message = error_message
  @display_message = display_message
  @additional_properties = additional_properties
end

Instance Attribute Details

#display_messageString

A user-friendly representation of the error code. null if the error is not related to user action. This may change over time and is not safe for programmatic use.

Returns:

  • (String)


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

def display_message
  @display_message
end

#error_codeString

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:

  • (String)


24
25
26
# File 'lib/the_plaid_api/models/cra_bank_income_cause.rb', line 24

def error_code
  @error_code
end

#error_messageString

A developer-friendly representation of the error code. This may change over time and is not safe for programmatic use.

Returns:

  • (String)


29
30
31
# File 'lib/the_plaid_api/models/cra_bank_income_cause.rb', line 29

def error_message
  @error_message
end

#error_typeCreditBankIncomeErrorType

A broad categorization of the error. Safe for programmatic use.



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

def error_type
  @error_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/the_plaid_api/models/cra_bank_income_cause.rb', line 70

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  error_type = hash.key?('error_type') ? hash['error_type'] : nil
  error_code = hash.key?('error_code') ? hash['error_code'] : nil
  error_message = hash.key?('error_message') ? hash['error_message'] : nil
  display_message =
    hash.key?('display_message') ? hash['display_message'] : 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.
  CraBankIncomeCause.new(error_type: error_type,
                         error_code: error_code,
                         error_message: error_message,
                         display_message: display_message,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['error_type'] = 'error_type'
  @_hash['error_code'] = 'error_code'
  @_hash['error_message'] = 'error_message'
  @_hash['display_message'] = 'display_message'
  @_hash
end

.nullablesObject

An array for nullable fields



53
54
55
# File 'lib/the_plaid_api/models/cra_bank_income_cause.rb', line 53

def self.nullables
  []
end

.optionalsObject

An array for optional fields



48
49
50
# File 'lib/the_plaid_api/models/cra_bank_income_cause.rb', line 48

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



104
105
106
107
108
109
# File 'lib/the_plaid_api/models/cra_bank_income_cause.rb', line 104

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} error_type: #{@error_type.inspect}, error_code: #{@error_code.inspect},"\
  " error_message: #{@error_message.inspect}, display_message: #{@display_message.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



96
97
98
99
100
101
# File 'lib/the_plaid_api/models/cra_bank_income_cause.rb', line 96

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} error_type: #{@error_type}, error_code: #{@error_code}, error_message:"\
  " #{@error_message}, display_message: #{@display_message}, additional_properties:"\
  " #{@additional_properties}>"
end