Class: ThePlaidApi::SignalWarning

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

Overview

Conveys information about the errors causing missing or stale bank data used to construct the /signal/evaluate scores and response

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: SKIP, warning_code: SKIP, warning_message: SKIP, additional_properties: nil) ⇒ SignalWarning

Returns a new instance of SignalWarning.



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

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

  @warning_type = warning_type unless warning_type == SKIP
  @warning_code = warning_code unless warning_code == SKIP
  @warning_message = warning_message unless warning_message == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#warning_codeString

The warning code identifies a specific kind of warning that pertains to the error causing bank data to be missing. Safe for programmatic use. For more details on warning codes, please refer to Plaid standard error codes documentation. If you receive the ‘ITEM_LOGIN_REQUIRED` warning, we recommend re-authenticating your user by implementing Link’s update mode. This will guide your user to fix their credentials, allowing Plaid to start fetching data again for future requests.

Returns:

  • (String)


25
26
27
# File 'lib/the_plaid_api/models/signal_warning.rb', line 25

def warning_code
  @warning_code
end

#warning_messageString

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

Returns:

  • (String)


30
31
32
# File 'lib/the_plaid_api/models/signal_warning.rb', line 30

def warning_message
  @warning_message
end

#warning_typeString

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

Returns:

  • (String)


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

def warning_type
  @warning_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
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/signal_warning.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  warning_type = hash.key?('warning_type') ? hash['warning_type'] : SKIP
  warning_code = hash.key?('warning_code') ? hash['warning_code'] : SKIP
  warning_message =
    hash.key?('warning_message') ? hash['warning_message'] : SKIP

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

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
# File 'lib/the_plaid_api/models/signal_warning.rb', line 33

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

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/the_plaid_api/models/signal_warning.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



42
43
44
45
46
47
48
# File 'lib/the_plaid_api/models/signal_warning.rb', line 42

def self.optionals
  %w[
    warning_type
    warning_code
    warning_message
  ]
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/signal_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}, warning_message: #{@warning_message.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/signal_warning.rb', line 91

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