Class: ThePlaidApi::SweepFailure
- Defined in:
- lib/the_plaid_api/models/sweep_failure.rb
Overview
The failure reason if the status for a sweep is ‘“failed”` or `“returned”`. Null value otherwise.
Instance Attribute Summary collapse
-
#description ⇒ String
A human-readable description of the reason for the failure or reversal.
-
#failure_code ⇒ String
The failure code, e.g.
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(failure_code: SKIP, description: SKIP, additional_properties: nil) ⇒ SweepFailure
constructor
A new instance of SweepFailure.
-
#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(failure_code: SKIP, description: SKIP, additional_properties: nil) ⇒ SweepFailure
Returns a new instance of SweepFailure.
50 51 52 53 54 55 56 57 58 |
# File 'lib/the_plaid_api/models/sweep_failure.rb', line 50 def initialize(failure_code: SKIP, description: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @failure_code = failure_code unless failure_code == SKIP @description = description unless description == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#description ⇒ String
A human-readable description of the reason for the failure or reversal.
24 25 26 |
# File 'lib/the_plaid_api/models/sweep_failure.rb', line 24 def description @description end |
#failure_code ⇒ String
The failure code, e.g. ‘R01`. A failure code will be provided if and only if the sweep status is `returned`. See [ACH return codes](plaid.com/docs/errors/transfer/#ach-return-codes) for a full listing of ACH return codes and [RTP/RfP error codes](plaid.com/docs/errors/transfer/#rtprfp-error-codes) for RTP error codes.
20 21 22 |
# File 'lib/the_plaid_api/models/sweep_failure.rb', line 20 def failure_code @failure_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/the_plaid_api/models/sweep_failure.rb', line 61 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. failure_code = hash.key?('failure_code') ? hash['failure_code'] : SKIP description = hash.key?('description') ? hash['description'] : 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. SweepFailure.new(failure_code: failure_code, description: description, 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/the_plaid_api/models/sweep_failure.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['failure_code'] = 'failure_code' @_hash['description'] = 'description' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 46 47 48 |
# File 'lib/the_plaid_api/models/sweep_failure.rb', line 43 def self.nullables %w[ failure_code description ] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 38 39 40 |
# File 'lib/the_plaid_api/models/sweep_failure.rb', line 35 def self.optionals %w[ failure_code description ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
89 90 91 92 93 |
# File 'lib/the_plaid_api/models/sweep_failure.rb', line 89 def inspect class_name = self.class.name.split('::').last "<#{class_name} failure_code: #{@failure_code.inspect}, description:"\ " #{@description.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
82 83 84 85 86 |
# File 'lib/the_plaid_api/models/sweep_failure.rb', line 82 def to_s class_name = self.class.name.split('::').last "<#{class_name} failure_code: #{@failure_code}, description: #{@description},"\ " additional_properties: #{@additional_properties}>" end |