Class: Plaid::ProductStatus
- Defined in:
- lib/plaid/models/product_status.rb
Overview
A representation of the status health of a request type. Auth requests, Balance requests, Identity requests, Investments requests, Liabilities requests, Transactions updates, Investments updates, Liabilities updates, and Item logins each have their own status object.
Instance Attribute Summary collapse
-
#breakdown ⇒ StatusBreakdown
A detailed breakdown of the institution’s performance for a request type.
-
#last_status_change ⇒ DateTime
[ISO 8601](wikipedia.org/wiki/ISO_8601) formatted timestamp of the last status change for the institution.
-
#status ⇒ Status
‘HEALTHY`: the majority of requests are successful `DEGRADED`: only some requests are successful `DOWN`: all requests are failing.
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(status:, last_status_change:, breakdown:, additional_properties: nil) ⇒ ProductStatus
constructor
A new instance of ProductStatus.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_last_status_change ⇒ Object
-
#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(status:, last_status_change:, breakdown:, additional_properties: nil) ⇒ ProductStatus
Returns a new instance of ProductStatus.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/plaid/models/product_status.rb', line 51 def initialize(status:, last_status_change:, breakdown:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @status = status @last_status_change = last_status_change @breakdown = breakdown @additional_properties = additional_properties end |
Instance Attribute Details
#breakdown ⇒ StatusBreakdown
A detailed breakdown of the institution’s performance for a request type. The values for ‘success`, `error_plaid`, and `error_institution` sum to 1.
30 31 32 |
# File 'lib/plaid/models/product_status.rb', line 30 def breakdown @breakdown end |
#last_status_change ⇒ DateTime
[ISO 8601](wikipedia.org/wiki/ISO_8601) formatted timestamp of the last status change for the institution.
25 26 27 |
# File 'lib/plaid/models/product_status.rb', line 25 def last_status_change @last_status_change end |
#status ⇒ Status
‘HEALTHY`: the majority of requests are successful `DEGRADED`: only some requests are successful `DOWN`: all requests are failing
20 21 22 |
# File 'lib/plaid/models/product_status.rb', line 20 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/plaid/models/product_status.rb', line 63 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. status = hash.key?('status') ? hash['status'] : nil last_status_change = if hash.key?('last_status_change') (DateTimeHelper.from_rfc3339(hash['last_status_change']) if hash['last_status_change']) end breakdown = StatusBreakdown.from_hash(hash['breakdown']) if hash['breakdown'] # 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. ProductStatus.new(status: status, last_status_change: last_status_change, breakdown: breakdown, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 |
# File 'lib/plaid/models/product_status.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['status'] = 'status' @_hash['last_status_change'] = 'last_status_change' @_hash['breakdown'] = 'breakdown' @_hash end |
.nullables ⇒ Object
An array for nullable fields
47 48 49 |
# File 'lib/plaid/models/product_status.rb', line 47 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
42 43 44 |
# File 'lib/plaid/models/product_status.rb', line 42 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
99 100 101 102 103 104 |
# File 'lib/plaid/models/product_status.rb', line 99 def inspect class_name = self.class.name.split('::').last "<#{class_name} status: #{@status.inspect}, last_status_change:"\ " #{@last_status_change.inspect}, breakdown: #{@breakdown.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_last_status_change ⇒ Object
87 88 89 |
# File 'lib/plaid/models/product_status.rb', line 87 def to_custom_last_status_change DateTimeHelper.to_rfc3339(last_status_change) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
92 93 94 95 96 |
# File 'lib/plaid/models/product_status.rb', line 92 def to_s class_name = self.class.name.split('::').last "<#{class_name} status: #{@status}, last_status_change: #{@last_status_change}, breakdown:"\ " #{@breakdown}, additional_properties: #{@additional_properties}>" end |