Class: ThePlaidApi::PrismDetect

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

Overview

The data from the CashScore® Detect 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(model_version:, score:, reason_codes: SKIP, metadata: SKIP, error_reason: SKIP, additional_properties: nil) ⇒ PrismDetect

Returns a new instance of PrismDetect.



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

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

  @model_version = model_version
  @score = score
  @reason_codes = reason_codes unless reason_codes == SKIP
  @metadata =  unless  == 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)


32
33
34
# File 'lib/the_plaid_api/models/prism_detect.rb', line 32

def error_reason
  @error_reason
end

#metadataPrismCashScoreMetadata

An object containing metadata about the provided transactions.



28
29
30
# File 'lib/the_plaid_api/models/prism_detect.rb', line 28

def 
  @metadata
end

#model_versionString

The version of Prism Data’s CashScore® Detect model used.

Returns:

  • (String)


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

def model_version
  @model_version
end

#reason_codesArray[String]

The reasons for an individual having risk according to the CashScore®Detect score.

Returns:

  • (Array[String])


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

def reason_codes
  @reason_codes
end

#scoreInteger

The score returned by Prism Data. Ranges from 1-999, with higher score indicating lower risk.

Returns:

  • (Integer)


19
20
21
# File 'lib/the_plaid_api/models/prism_detect.rb', line 19

def score
  @score
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  model_version = hash.key?('model_version') ? hash['model_version'] : nil
  score = hash.key?('score') ? hash['score'] : nil
  reason_codes = hash.key?('reason_codes') ? hash['reason_codes'] : SKIP
   = PrismCashScoreMetadata.from_hash(hash['metadata']) if hash['metadata']
  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.
  PrismDetect.new(model_version: model_version,
                  score: score,
                  reason_codes: reason_codes,
                  metadata: ,
                  error_reason: error_reason,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['model_version'] = 'model_version'
  @_hash['score'] = 'score'
  @_hash['reason_codes'] = 'reason_codes'
  @_hash['metadata'] = 'metadata'
  @_hash['error_reason'] = 'error_reason'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
58
59
# File 'lib/the_plaid_api/models/prism_detect.rb', line 55

def self.nullables
  %w[
    score
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    reason_codes
    metadata
    error_reason
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



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

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