Class: Plaid::Cause
- Defined in:
- lib/plaid/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
-
#error ⇒ Error
We use standard HTTP response codes for success and failure notifications, and our errors are further classified by ‘error_type`.
-
#item_id ⇒ String
The ‘item_id` of the Item associated with this webhook, warning, or error.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(item_id:, error:, additional_properties: nil) ⇒ Cause
constructor
A new instance of Cause.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(item_id:, error:, additional_properties: nil) ⇒ Cause
Returns a new instance of Cause.
44 45 46 47 48 49 50 51 |
# File 'lib/plaid/models/cause.rb', line 44 def initialize(item_id:, error:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @item_id = item_id @error = error @additional_properties = additional_properties end |
Instance Attribute Details
#error ⇒ Error
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.
24 25 26 |
# File 'lib/plaid/models/cause.rb', line 24 def error @error end |
#item_id ⇒ String
The ‘item_id` of the Item associated with this webhook, warning, or error
16 17 18 |
# File 'lib/plaid/models/cause.rb', line 16 def item_id @item_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/plaid/models/cause.rb', line 54 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. item_id = hash.key?('item_id') ? hash['item_id'] : nil error = Error.from_hash(hash['error']) if hash['error'] # 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(item_id: item_id, error: error, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 |
# File 'lib/plaid/models/cause.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['item_id'] = 'item_id' @_hash['error'] = 'error' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/plaid/models/cause.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 |
# File 'lib/plaid/models/cause.rb', line 35 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
82 83 84 85 86 |
# File 'lib/plaid/models/cause.rb', line 82 def inspect class_name = self.class.name.split('::').last "<#{class_name} item_id: #{@item_id.inspect}, error: #{@error.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
75 76 77 78 79 |
# File 'lib/plaid/models/cause.rb', line 75 def to_s class_name = self.class.name.split('::').last "<#{class_name} item_id: #{@item_id}, error: #{@error}, additional_properties:"\ " #{@additional_properties}>" end |