Class: ThePlaidApi::Cause

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/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:, item_id:, error_code_reason: SKIP, request_id: SKIP, causes: SKIP, status: SKIP, documentation_url: SKIP, suggested_action: SKIP, required_account_subtypes: SKIP, provided_account_subtypes: SKIP, additional_properties: nil) ⇒ Cause

Returns a new instance of Cause.



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/the_plaid_api/models/cause.rb', line 136

def initialize(error_type:, error_code:, error_message:, display_message:,
               item_id:, error_code_reason: SKIP, request_id: SKIP,
               causes: SKIP, status: SKIP, documentation_url: SKIP,
               suggested_action: SKIP, required_account_subtypes: SKIP,
               provided_account_subtypes: SKIP, 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_code_reason = error_code_reason unless error_code_reason == SKIP
  @error_message = error_message
  @display_message = display_message
  @request_id = request_id unless request_id == SKIP
  @causes = causes unless causes == SKIP
  @status = status unless status == SKIP
  @documentation_url = documentation_url unless documentation_url == SKIP
  @suggested_action = suggested_action unless suggested_action == SKIP
  unless  == SKIP
    @required_account_subtypes =
      
  end
  unless  == SKIP
    @provided_account_subtypes =
      
  end
  @item_id = item_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#causesArray[Object]

In this product, a request can pertain to more than one Item. If an error is returned for such a request, ‘causes` will return an array of errors containing a breakdown of these errors on the individual Item level, if any can be identified. `causes` will be provided for the `error_type` `ASSET_REPORT_ERROR` or `CHECK_REPORT_ERROR`. `causes` will also not be populated inside an error nested within a `warning` object.

Returns:

  • (Array[Object])


59
60
61
# File 'lib/the_plaid_api/models/cause.rb', line 59

def causes
  @causes
end

#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)


44
45
46
# File 'lib/the_plaid_api/models/cause.rb', line 44

def display_message
  @display_message
end

#documentation_urlString

The URL of a Plaid documentation page with more information about the error

Returns:

  • (String)


69
70
71
# File 'lib/the_plaid_api/models/cause.rb', line 69

def documentation_url
  @documentation_url
end

#error_codeString

The particular error code. Safe for programmatic use.

Returns:

  • (String)


20
21
22
# File 'lib/the_plaid_api/models/cause.rb', line 20

def error_code
  @error_code
end

#error_code_reasonString

The specific reason for the error code. Currently, reasons are only supported OAuth-based item errors; ‘null` will be returned otherwise. Safe for programmatic use. Possible values: `OAUTH_INVALID_TOKEN`: The user’s OAuth connection to this institution has been invalidated. `OAUTH_CONSENT_EXPIRED`: The user’s access consent for this OAuth connection to this institution has expired. ‘OAUTH_USER_REVOKED`: The user’s OAuth connection to this institution is invalid because the user revoked their connection.

Returns:

  • (String)


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

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


38
39
40
# File 'lib/the_plaid_api/models/cause.rb', line 38

def error_message
  @error_message
end

#error_typePlaidErrorType

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

Returns:



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

def error_type
  @error_type
end

#item_idString

The ‘item_id` of the Item associated with this webhook, warning, or error

Returns:

  • (String)


91
92
93
# File 'lib/the_plaid_api/models/cause.rb', line 91

def item_id
  @item_id
end

#provided_account_subtypesArray[String]

A list of the account subtypes that were extracted but did not match the requested subtypes via the ‘account_filters` parameter in `/link/token/create`. Currently only populated for `NO_ACCOUNTS` errors from Items with `investments_auth` as an enabled product.

Returns:

  • (Array[String])


87
88
89
# File 'lib/the_plaid_api/models/cause.rb', line 87

def 
  @provided_account_subtypes
end

#request_idString

A unique ID identifying the request, to be used for troubleshooting purposes. This field will be omitted in errors provided by webhooks.

Returns:

  • (String)


49
50
51
# File 'lib/the_plaid_api/models/cause.rb', line 49

def request_id
  @request_id
end

#required_account_subtypesArray[String]

A list of the account subtypes that were requested via the ‘account_filters` parameter in `/link/token/create`. Currently only populated for `NO_ACCOUNTS` errors from Items with `investments_auth` as an enabled product.

Returns:

  • (Array[String])


80
81
82
# File 'lib/the_plaid_api/models/cause.rb', line 80

def 
  @required_account_subtypes
end

#statusInteger

The HTTP status code associated with the error. This will only be returned in the response body when the error information is provided via a webhook.

Returns:

  • (Integer)


64
65
66
# File 'lib/the_plaid_api/models/cause.rb', line 64

def status
  @status
end

#suggested_actionString

Suggested steps for resolving the error

Returns:

  • (String)


73
74
75
# File 'lib/the_plaid_api/models/cause.rb', line 73

def suggested_action
  @suggested_action
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/the_plaid_api/models/cause.rb', line 167

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
  item_id = hash.key?('item_id') ? hash['item_id'] : nil
  error_code_reason =
    hash.key?('error_code_reason') ? hash['error_code_reason'] : SKIP
  request_id = hash.key?('request_id') ? hash['request_id'] : SKIP
  causes = hash.key?('causes') ? hash['causes'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  documentation_url =
    hash.key?('documentation_url') ? hash['documentation_url'] : SKIP
  suggested_action =
    hash.key?('suggested_action') ? hash['suggested_action'] : SKIP
   =
    hash.key?('required_account_subtypes') ? hash['required_account_subtypes'] : SKIP
   =
    hash.key?('provided_account_subtypes') ? hash['provided_account_subtypes'] : 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.
  Cause.new(error_type: error_type,
            error_code: error_code,
            error_message: error_message,
            display_message: display_message,
            item_id: item_id,
            error_code_reason: error_code_reason,
            request_id: request_id,
            causes: causes,
            status: status,
            documentation_url: documentation_url,
            suggested_action: suggested_action,
            required_account_subtypes: ,
            provided_account_subtypes: ,
            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/the_plaid_api/models/cause.rb', line 94

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['error_type'] = 'error_type'
  @_hash['error_code'] = 'error_code'
  @_hash['error_code_reason'] = 'error_code_reason'
  @_hash['error_message'] = 'error_message'
  @_hash['display_message'] = 'display_message'
  @_hash['request_id'] = 'request_id'
  @_hash['causes'] = 'causes'
  @_hash['status'] = 'status'
  @_hash['documentation_url'] = 'documentation_url'
  @_hash['suggested_action'] = 'suggested_action'
  @_hash['required_account_subtypes'] = 'required_account_subtypes'
  @_hash['provided_account_subtypes'] = 'provided_account_subtypes'
  @_hash['item_id'] = 'item_id'
  @_hash
end

.nullablesObject

An array for nullable fields



127
128
129
130
131
132
133
134
# File 'lib/the_plaid_api/models/cause.rb', line 127

def self.nullables
  %w[
    error_code_reason
    display_message
    status
    suggested_action
  ]
end

.optionalsObject

An array for optional fields



113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/the_plaid_api/models/cause.rb', line 113

def self.optionals
  %w[
    error_code_reason
    request_id
    causes
    status
    documentation_url
    suggested_action
    required_account_subtypes
    provided_account_subtypes
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/the_plaid_api/models/cause.rb', line 228

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} error_type: #{@error_type.inspect}, error_code: #{@error_code.inspect},"\
  " error_code_reason: #{@error_code_reason.inspect}, error_message:"\
  " #{@error_message.inspect}, display_message: #{@display_message.inspect}, request_id:"\
  " #{@request_id.inspect}, causes: #{@causes.inspect}, status: #{@status.inspect},"\
  " documentation_url: #{@documentation_url.inspect}, suggested_action:"\
  " #{@suggested_action.inspect}, required_account_subtypes:"\
  " #{@required_account_subtypes.inspect}, provided_account_subtypes:"\
  " #{@provided_account_subtypes.inspect}, item_id: #{@item_id.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



216
217
218
219
220
221
222
223
224
225
# File 'lib/the_plaid_api/models/cause.rb', line 216

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} error_type: #{@error_type}, error_code: #{@error_code}, error_code_reason:"\
  " #{@error_code_reason}, error_message: #{@error_message}, display_message:"\
  " #{@display_message}, request_id: #{@request_id}, causes: #{@causes}, status: #{@status},"\
  " documentation_url: #{@documentation_url}, suggested_action: #{@suggested_action},"\
  " required_account_subtypes: #{@required_account_subtypes}, provided_account_subtypes:"\
  " #{@provided_account_subtypes}, item_id: #{@item_id}, additional_properties:"\
  " #{@additional_properties}>"
end