Class: ThePlaidApi::RefreshResult
- Defined in:
- lib/the_plaid_api/models/refresh_result.rb
Overview
RefreshResult represents the result status of a user refresh for a specific item.
Instance Attribute Summary collapse
-
#error ⇒ Error
Errors are identified by ‘error_code` and categorized by `error_type`.
-
#item_id ⇒ String
A unique identifier for the Plaid Item.
-
#product ⇒ String
The product for which the refresh was attempted.
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: SKIP, product: SKIP, error: SKIP, additional_properties: nil) ⇒ RefreshResult
constructor
A new instance of RefreshResult.
-
#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: SKIP, product: SKIP, error: SKIP, additional_properties: nil) ⇒ RefreshResult
Returns a new instance of RefreshResult.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/the_plaid_api/models/refresh_result.rb', line 58 def initialize(item_id: SKIP, product: SKIP, error: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @item_id = item_id unless item_id == SKIP @product = product unless product == SKIP @error = error unless error == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#error ⇒ Error
Errors are identified by ‘error_code` and categorized by `error_type`. Use these in preference to HTTP status codes to identify and handle specific errors. HTTP status codes are set and provide the broadest categorization of errors: 4xx codes are for developer- or user-related errors, and 5xx codes are for Plaid-related errors, and the status will be 2xx in non-error cases. An Item with a non-`null` error object will only be part of an API response when calling `/item/get` to view Item status. Otherwise, error fields will be `null` if no error has occurred; if an error has occurred, an error code will be returned instead.
31 32 33 |
# File 'lib/the_plaid_api/models/refresh_result.rb', line 31 def error @error end |
#item_id ⇒ String
A unique identifier for the Plaid Item.
15 16 17 |
# File 'lib/the_plaid_api/models/refresh_result.rb', line 15 def item_id @item_id end |
#product ⇒ String
The product for which the refresh was attempted.
19 20 21 |
# File 'lib/the_plaid_api/models/refresh_result.rb', line 19 def product @product end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/the_plaid_api/models/refresh_result.rb', line 70 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. item_id = hash.key?('item_id') ? hash['item_id'] : SKIP product = hash.key?('product') ? hash['product'] : SKIP 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. RefreshResult.new(item_id: item_id, product: product, error: error, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 |
# File 'lib/the_plaid_api/models/refresh_result.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['item_id'] = 'item_id' @_hash['product'] = 'product' @_hash['error'] = 'error' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 55 56 |
# File 'lib/the_plaid_api/models/refresh_result.rb', line 52 def self.nullables %w[ error ] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 48 49 |
# File 'lib/the_plaid_api/models/refresh_result.rb', line 43 def self.optionals %w[ item_id product error ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
100 101 102 103 104 |
# File 'lib/the_plaid_api/models/refresh_result.rb', line 100 def inspect class_name = self.class.name.split('::').last "<#{class_name} item_id: #{@item_id.inspect}, product: #{@product.inspect}, error:"\ " #{@error.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
93 94 95 96 97 |
# File 'lib/the_plaid_api/models/refresh_result.rb', line 93 def to_s class_name = self.class.name.split('::').last "<#{class_name} item_id: #{@item_id}, product: #{@product}, error: #{@error},"\ " additional_properties: #{@additional_properties}>" end |