Class: ThePlaidApi::PrismInsights

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

Overview

The data from the Insights product returned by Prism 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(version:, result: SKIP, error_reason: SKIP, additional_properties: nil) ⇒ PrismInsights

Returns a new instance of PrismInsights.



49
50
51
52
53
54
55
56
57
58
# File 'lib/the_plaid_api/models/prism_insights.rb', line 49

def initialize(version:, result: SKIP, error_reason: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @version = version
  @result = result unless result == SKIP
  @error_reason = error_reason unless error_reason == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#error_reasonString

The error returned by Prism for this product.

Returns:

  • (String)


25
26
27
# File 'lib/the_plaid_api/models/prism_insights.rb', line 25

def error_reason
  @error_reason
end

#resultObject

The Insights Result object is a map of cash flow attributes, where the key is a string, and the value is a float or string. For a full list of attributes, contact your account manager. The attributes may vary depending on the Prism version used.

Returns:

  • (Object)


21
22
23
# File 'lib/the_plaid_api/models/prism_insights.rb', line 21

def result
  @result
end

#versionInteger

The version of Prism Data’s insights model used.

Returns:

  • (Integer)


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

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/the_plaid_api/models/prism_insights.rb', line 61

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  version = hash.key?('version') ? hash['version'] : nil
  result = hash.key?('result') ? hash['result'] : SKIP
  error_reason = hash.key?('error_reason') ? hash['error_reason'] : 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.
  PrismInsights.new(version: version,
                    result: result,
                    error_reason: error_reason,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['version'] = 'version'
  @_hash['result'] = 'result'
  @_hash['error_reason'] = 'error_reason'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/the_plaid_api/models/prism_insights.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    result
    error_reason
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



91
92
93
94
95
# File 'lib/the_plaid_api/models/prism_insights.rb', line 91

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

#to_sObject

Provides a human-readable string representation of the object.



84
85
86
87
88
# File 'lib/the_plaid_api/models/prism_insights.rb', line 84

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