Class: ThePlaidApi::NameMatchScore

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

Overview

Score found by matching name provided by the API with the name on the account at the financial institution. If the account contains multiple owners, the maximum match score is filled.

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(score: SKIP, is_first_name_or_last_name_match: SKIP, is_nickname_match: SKIP, is_business_name_detected: SKIP, additional_properties: nil) ⇒ NameMatchScore

Returns a new instance of NameMatchScore.



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

def initialize(score: SKIP, is_first_name_or_last_name_match: SKIP,
               is_nickname_match: SKIP, is_business_name_detected: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @score = score unless score == SKIP
  unless is_first_name_or_last_name_match == SKIP
    @is_first_name_or_last_name_match =
      is_first_name_or_last_name_match
  end
  @is_nickname_match = is_nickname_match unless is_nickname_match == SKIP
  unless is_business_name_detected == SKIP
    @is_business_name_detected =
      is_business_name_detected
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#is_business_name_detectedTrueClass | FalseClass

Is ‘true` if the name on either of the names that was matched for the score contained strings indicative of a business name, such as “CORP”, “LLC”, “INC”, or “LTD”. A `true` result generally indicates that an account’s name is a business name. However, a ‘false` result does not mean the account name is not a business name, as some businesses do not use these strings in the names used for their financial institution accounts.

Returns:

  • (TrueClass | FalseClass)


36
37
38
# File 'lib/the_plaid_api/models/name_match_score.rb', line 36

def is_business_name_detected
  @is_business_name_detected
end

#is_first_name_or_last_name_matchTrueClass | FalseClass

first or last name completely matched, likely a family member

Returns:

  • (TrueClass | FalseClass)


23
24
25
# File 'lib/the_plaid_api/models/name_match_score.rb', line 23

def is_first_name_or_last_name_match
  @is_first_name_or_last_name_match
end

#is_nickname_matchTrueClass | FalseClass

nickname matched, example Jennifer and Jenn.

Returns:

  • (TrueClass | FalseClass)


27
28
29
# File 'lib/the_plaid_api/models/name_match_score.rb', line 27

def is_nickname_match
  @is_nickname_match
end

#scoreInteger

Match score for name. 100 is a perfect score, 99-85 means a strong match, 84-70 is a partial match, any score less than 70 is a mismatch. Typically, the match threshold should be set to a score of 70 or higher. If the name is missing from either the API or financial institution, this is null.

Returns:

  • (Integer)


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

def score
  @score
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/the_plaid_api/models/name_match_score.rb', line 89

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  score = hash.key?('score') ? hash['score'] : SKIP
  is_first_name_or_last_name_match =
    hash.key?('is_first_name_or_last_name_match') ? hash['is_first_name_or_last_name_match'] : SKIP
  is_nickname_match =
    hash.key?('is_nickname_match') ? hash['is_nickname_match'] : SKIP
  is_business_name_detected =
    hash.key?('is_business_name_detected') ? hash['is_business_name_detected'] : 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.
  NameMatchScore.new(score: score,
                     is_first_name_or_last_name_match: is_first_name_or_last_name_match,
                     is_nickname_match: is_nickname_match,
                     is_business_name_detected: is_business_name_detected,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
# File 'lib/the_plaid_api/models/name_match_score.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['score'] = 'score'
  @_hash['is_first_name_or_last_name_match'] =
    'is_first_name_or_last_name_match'
  @_hash['is_nickname_match'] = 'is_nickname_match'
  @_hash['is_business_name_detected'] = 'is_business_name_detected'
  @_hash
end

.nullablesObject

An array for nullable fields



60
61
62
63
64
65
66
67
# File 'lib/the_plaid_api/models/name_match_score.rb', line 60

def self.nullables
  %w[
    score
    is_first_name_or_last_name_match
    is_nickname_match
    is_business_name_detected
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    score
    is_first_name_or_last_name_match
    is_nickname_match
    is_business_name_detected
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



126
127
128
129
130
131
132
# File 'lib/the_plaid_api/models/name_match_score.rb', line 126

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} score: #{@score.inspect}, is_first_name_or_last_name_match:"\
  " #{@is_first_name_or_last_name_match.inspect}, is_nickname_match:"\
  " #{@is_nickname_match.inspect}, is_business_name_detected:"\
  " #{@is_business_name_detected.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



117
118
119
120
121
122
123
# File 'lib/the_plaid_api/models/name_match_score.rb', line 117

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} score: #{@score}, is_first_name_or_last_name_match:"\
  " #{@is_first_name_or_last_name_match}, is_nickname_match: #{@is_nickname_match},"\
  " is_business_name_detected: #{@is_business_name_detected}, additional_properties:"\
  " #{@additional_properties}>"
end