Class: ThePlaidApi::Warning

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

Overview

It is possible for an Asset Report to be returned with missing account owner information. In such cases, the Asset Report 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) ⇒ Warning

Returns a new instance of Warning.



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

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:



31
32
33
# File 'lib/the_plaid_api/models/warning.rb', line 31

def cause
  @cause
end

#warning_codeWarningCode

The warning code identifies a specific kind of warning. ‘OWNERS_UNAVAILABLE` indicates that account-owner information is not available.`INVESTMENTS_UNAVAILABLE` indicates that Investments specific information is not available. `TRANSACTIONS_UNAVAILABLE` indicates that transactions information associated with Credit and Depository accounts are unavailable.

Returns:



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

def warning_code
  @warning_code
end

#warning_typeString

The warning type, which will always be ‘ASSET_REPORT_WARNING`

Returns:

  • (String)


16
17
18
# File 'lib/the_plaid_api/models/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.



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

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.
  Warning.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.



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

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



48
49
50
51
52
# File 'lib/the_plaid_api/models/warning.rb', line 48

def self.nullables
  %w[
    cause
  ]
end

.optionalsObject

An array for optional fields



43
44
45
# File 'lib/the_plaid_api/models/warning.rb', line 43

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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.



89
90
91
92
93
# File 'lib/the_plaid_api/models/warning.rb', line 89

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