Class: ThePlaidApi::CraPredictionInterval

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/cra_prediction_interval.rb

Overview

The object containing prediction interval data.

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(lower_bound: SKIP, upper_bound: SKIP, probability: SKIP, additional_properties: nil) ⇒ CraPredictionInterval

Returns a new instance of CraPredictionInterval.



53
54
55
56
57
58
59
60
61
62
# File 'lib/the_plaid_api/models/cra_prediction_interval.rb', line 53

def initialize(lower_bound: SKIP, upper_bound: SKIP, probability: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @lower_bound = lower_bound unless lower_bound == SKIP
  @upper_bound = upper_bound unless upper_bound == SKIP
  @probability = probability unless probability == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#lower_boundFloat

The lower bound of the predicted attribute for the given probability.

Returns:

  • (Float)


14
15
16
# File 'lib/the_plaid_api/models/cra_prediction_interval.rb', line 14

def lower_bound
  @lower_bound
end

#probabilityFloat

The probability of the actual value of the attribute falling within the upper and lower bound. This is a percentage represented as a value between 0 and 1.

Returns:

  • (Float)


24
25
26
# File 'lib/the_plaid_api/models/cra_prediction_interval.rb', line 24

def probability
  @probability
end

#upper_boundFloat

The upper bound of the predicted attribute for the given probability.

Returns:

  • (Float)


18
19
20
# File 'lib/the_plaid_api/models/cra_prediction_interval.rb', line 18

def upper_bound
  @upper_bound
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/the_plaid_api/models/cra_prediction_interval.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  lower_bound = hash.key?('lower_bound') ? hash['lower_bound'] : SKIP
  upper_bound = hash.key?('upper_bound') ? hash['upper_bound'] : SKIP
  probability = hash.key?('probability') ? hash['probability'] : 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.
  CraPredictionInterval.new(lower_bound: lower_bound,
                            upper_bound: upper_bound,
                            probability: probability,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
33
# File 'lib/the_plaid_api/models/cra_prediction_interval.rb', line 27

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['lower_bound'] = 'lower_bound'
  @_hash['upper_bound'] = 'upper_bound'
  @_hash['probability'] = 'probability'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
48
49
50
51
# File 'lib/the_plaid_api/models/cra_prediction_interval.rb', line 45

def self.nullables
  %w[
    lower_bound
    upper_bound
    probability
  ]
end

.optionalsObject

An array for optional fields



36
37
38
39
40
41
42
# File 'lib/the_plaid_api/models/cra_prediction_interval.rb', line 36

def self.optionals
  %w[
    lower_bound
    upper_bound
    probability
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



95
96
97
98
99
# File 'lib/the_plaid_api/models/cra_prediction_interval.rb', line 95

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} lower_bound: #{@lower_bound.inspect}, upper_bound: #{@upper_bound.inspect},"\
  " probability: #{@probability.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



88
89
90
91
92
# File 'lib/the_plaid_api/models/cra_prediction_interval.rb', line 88

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} lower_bound: #{@lower_bound}, upper_bound: #{@upper_bound}, probability:"\
  " #{@probability}, additional_properties: #{@additional_properties}>"
end