Class: Plaid::StatusBreakdown

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/status_breakdown.rb

Overview

A detailed breakdown of the institution’s performance for a request type. The values for ‘success`, `error_plaid`, and `error_institution` sum to 1.

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(success:, error_plaid:, error_institution:, refresh_interval: SKIP, additional_properties: nil) ⇒ StatusBreakdown

Returns a new instance of StatusBreakdown.



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/plaid/models/status_breakdown.rb', line 56

def initialize(success:, error_plaid:, error_institution:,
               refresh_interval: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @success = success
  @error_plaid = error_plaid
  @error_institution = error_institution
  @refresh_interval = refresh_interval unless refresh_interval == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#error_institutionFloat

The percentage of logins that are failing due to an issue in the institution’s system, expressed as a decimal.

Returns:

  • (Float)


26
27
28
# File 'lib/plaid/models/status_breakdown.rb', line 26

def error_institution
  @error_institution
end

#error_plaidFloat

The percentage of logins that are failing due to an internal Plaid issue, expressed as a decimal.

Returns:

  • (Float)


21
22
23
# File 'lib/plaid/models/status_breakdown.rb', line 21

def error_plaid
  @error_plaid
end

#refresh_intervalRefreshInterval

The ‘refresh_interval` may be `DELAYED` or `STOPPED` even when the success rate is high. This value is only returned for Transactions status breakdowns.

Returns:



32
33
34
# File 'lib/plaid/models/status_breakdown.rb', line 32

def refresh_interval
  @refresh_interval
end

#successFloat

The percentage of login attempts that are successful, expressed as a decimal.

Returns:

  • (Float)


16
17
18
# File 'lib/plaid/models/status_breakdown.rb', line 16

def success
  @success
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/plaid/models/status_breakdown.rb', line 69

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  success = hash.key?('success') ? hash['success'] : nil
  error_plaid = hash.key?('error_plaid') ? hash['error_plaid'] : nil
  error_institution =
    hash.key?('error_institution') ? hash['error_institution'] : nil
  refresh_interval =
    hash.key?('refresh_interval') ? hash['refresh_interval'] : 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.
  StatusBreakdown.new(success: success,
                      error_plaid: error_plaid,
                      error_institution: error_institution,
                      refresh_interval: refresh_interval,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
# File 'lib/plaid/models/status_breakdown.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['success'] = 'success'
  @_hash['error_plaid'] = 'error_plaid'
  @_hash['error_institution'] = 'error_institution'
  @_hash['refresh_interval'] = 'refresh_interval'
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
# File 'lib/plaid/models/status_breakdown.rb', line 52

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
# File 'lib/plaid/models/status_breakdown.rb', line 45

def self.optionals
  %w[
    refresh_interval
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



104
105
106
107
108
109
# File 'lib/plaid/models/status_breakdown.rb', line 104

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} success: #{@success.inspect}, error_plaid: #{@error_plaid.inspect},"\
  " error_institution: #{@error_institution.inspect}, refresh_interval:"\
  " #{@refresh_interval.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



96
97
98
99
100
101
# File 'lib/plaid/models/status_breakdown.rb', line 96

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} success: #{@success}, error_plaid: #{@error_plaid}, error_institution:"\
  " #{@error_institution}, refresh_interval: #{@refresh_interval}, additional_properties:"\
  " #{@additional_properties}>"
end