Class: ThePlaidApi::ProductStatus

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/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

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(status:, last_status_change:, breakdown:, additional_properties: nil) ⇒ ProductStatus

Returns a new instance of ProductStatus.



61
62
63
64
65
66
67
68
69
70
# File 'lib/the_plaid_api/models/product_status.rb', line 61

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

#breakdownStatusBreakdown

A detailed breakdown of the institution’s performance for a request type. The values for ‘success`, `error_plaid`, and `error_institution` sum to 1. The time range used for calculating the breakdown may range from the most recent few minutes to the past six hours. In general, smaller institutions will show status that was calculated over a longer period of time. For Investment updates, which are refreshed less frequently, the period assessed may be 24 hours or more. For more details, see [Institution status details](plaid.com/docs/account/activity/#institution-status-detai ls).

Returns:



40
41
42
# File 'lib/the_plaid_api/models/product_status.rb', line 40

def breakdown
  @breakdown
end

#last_status_changeDateTime

[ISO 8601](wikipedia.org/wiki/ISO_8601) formatted timestamp of the last status change for the institution.

Returns:

  • (DateTime)


27
28
29
# File 'lib/the_plaid_api/models/product_status.rb', line 27

def last_status_change
  @last_status_change
end

#statusStatus4

This field is deprecated in favor of the ‘breakdown` object, which provides more granular institution health data. `HEALTHY`: the majority of requests are successful `DEGRADED`: only some requests are successful `DOWN`: all requests are failing

Returns:



22
23
24
# File 'lib/the_plaid_api/models/product_status.rb', line 22

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/the_plaid_api/models/product_status.rb', line 73

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

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
# File 'lib/the_plaid_api/models/product_status.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['status'] = 'status'
  @_hash['last_status_change'] = 'last_status_change'
  @_hash['breakdown'] = 'breakdown'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
# File 'lib/the_plaid_api/models/product_status.rb', line 57

def self.nullables
  []
end

.optionalsObject

An array for optional fields



52
53
54
# File 'lib/the_plaid_api/models/product_status.rb', line 52

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



109
110
111
112
113
114
# File 'lib/the_plaid_api/models/product_status.rb', line 109

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_changeObject



97
98
99
# File 'lib/the_plaid_api/models/product_status.rb', line 97

def to_custom_last_status_change
  DateTimeHelper.to_rfc3339(last_status_change)
end

#to_sObject

Provides a human-readable string representation of the object.



102
103
104
105
106
# File 'lib/the_plaid_api/models/product_status.rb', line 102

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