Class: ThePlaidApi::TransactionsRuleType

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

Overview

Transaction rule’s match type. For ‘TRANSACTION_ID` field, `EXACT_MATCH` is available. Matches are case sensitive.

Constant Summary collapse

TRANSACTIONS_RULE_TYPE =
[
  # TODO: Write general description for EXACT_MATCH
  EXACT_MATCH = 'EXACT_MATCH'.freeze,

  # TODO: Write general description for SUBSTRING_MATCH
  SUBSTRING_MATCH = 'SUBSTRING_MATCH'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = EXACT_MATCH) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/the_plaid_api/models/transactions_rule_type.rb', line 24

def self.from_value(value, default_value = EXACT_MATCH)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'exact_match' then EXACT_MATCH
  when 'substring_match' then SUBSTRING_MATCH
  else
    default_value
  end
end

.validate(value) ⇒ Object



18
19
20
21
22
# File 'lib/the_plaid_api/models/transactions_rule_type.rb', line 18

def self.validate(value)
  return false if value.nil?

  TRANSACTIONS_RULE_TYPE.include?(value)
end