Class: ThePlaidApi::CraReportWarning

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

Overview

It is possible for a Check Report product to be returned with missing information. In such cases, the product will contain warning data in the response, indicating why obtaining the owner information failed.

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(warning_type:, warning_code:, cause:, additional_properties: nil) ⇒ CraReportWarning

Returns a new instance of CraReportWarning.



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

def initialize(warning_type:, warning_code:, cause:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @warning_type = warning_type
  @warning_code = warning_code
  @cause = cause
  @additional_properties = additional_properties
end

Instance Attribute Details

#causeCause

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.

Returns:



33
34
35
# File 'lib/the_plaid_api/models/cra_report_warning.rb', line 33

def cause
  @cause
end

#warning_codeCheckReportWarningCode

The warning code identifies a specific kind of warning. ‘IDENTITY_UNAVAILABLE`: Account-owner information is not available. `TRANSACTIONS_UNAVAILABLE`: Transactions information associated with Credit and Depository accounts are unavailable. `USER_FRAUD_ALERT`: The user has placed a fraud alert on their Plaid Check consumer report due to suspected fraud. Please note that when a fraud alert is in place, the recipient of the consumer report has an obligation to verify the consumer’s identity.



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

def warning_code
  @warning_code
end

#warning_typeString

The warning type, which will always be ‘CHECK_REPORT_WARNING`

Returns:

  • (String)


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

def warning_type
  @warning_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/the_plaid_api/models/cra_report_warning.rb', line 68

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  warning_type = hash.key?('warning_type') ? hash['warning_type'] : nil
  warning_code = hash.key?('warning_code') ? hash['warning_code'] : nil
  cause = Cause.from_hash(hash['cause']) if hash['cause']

  # 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.
  CraReportWarning.new(warning_type: warning_type,
                       warning_code: warning_code,
                       cause: cause,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



36
37
38
39
40
41
42
# File 'lib/the_plaid_api/models/cra_report_warning.rb', line 36

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['warning_type'] = 'warning_type'
  @_hash['warning_code'] = 'warning_code'
  @_hash['cause'] = 'cause'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    cause
  ]
end

.optionalsObject

An array for optional fields



45
46
47
# File 'lib/the_plaid_api/models/cra_report_warning.rb', line 45

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



98
99
100
101
102
103
# File 'lib/the_plaid_api/models/cra_report_warning.rb', line 98

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} warning_type: #{@warning_type.inspect}, warning_code:"\
  " #{@warning_code.inspect}, cause: #{@cause.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



91
92
93
94
95
# File 'lib/the_plaid_api/models/cra_report_warning.rb', line 91

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