Class: Plaid::Risk

Inherits:
Object
  • Object
show all
Defined in:
lib/plaid/risk.rb

Overview

Public: Representation of risk data (per account).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fields) ⇒ Risk

Internal: Construct a Risk object.

fields - The Hash with fields.



17
18
19
20
# File 'lib/plaid/risk.rb', line 17

def initialize(fields)
  @score = fields['score']
  @reason = Plaid.symbolize_hash(fields['reason'])
end

Instance Attribute Details

#reasonObject (readonly)

Public: The Hash with Symbol reasons and associated Float subscores contributing to the overall risk score.

E.g. { transaction_amounts: 0.78, foreign_fees: 0.96, … }.



12
13
14
# File 'lib/plaid/risk.rb', line 12

def reason
  @reason
end

#scoreObject (readonly)

Public: The Float comprehensive risk score associated with the account, where 0 is the lowest risk and 1 is the highest. E.g. 0.5.



6
7
8
# File 'lib/plaid/risk.rb', line 6

def score
  @score
end

Instance Method Details

#inspectObject Also known as: to_s

Public: Get a String representation of Risk.

Returns a String.



25
26
27
# File 'lib/plaid/risk.rb', line 25

def inspect
  "#<Plaid::Risk score=#{score.inspect}, ..."
end