Class: ThePlaidApi::DataSources

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

Overview

A description of the source of data for a given product/data type. ‘INSTITUTION`: The institution supports this product, and the data was provided by the institution. `INSTITUTION_MASK`: The user manually provided the full account number, which was matched to the account mask provided by the institution. Only applicable to the `numbers` data type. `USER`: The institution does not support this product, and the data was manually provided by the user.

Constant Summary collapse

DATA_SOURCES =
[
  # TODO: Write general description for INSTITUTION
  INSTITUTION = 'INSTITUTION'.freeze,

  # TODO: Write general description for INSTITUTION_MASK
  INSTITUTION_MASK = 'INSTITUTION_MASK'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = INSTITUTION) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/the_plaid_api/models/data_sources.rb', line 32

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

  str = value.to_s.strip

  case str.downcase
  when 'institution' then INSTITUTION
  when 'institution_mask' then INSTITUTION_MASK
  when 'user' then USER
  else
    default_value
  end
end

.validate(value) ⇒ Object



26
27
28
29
30
# File 'lib/the_plaid_api/models/data_sources.rb', line 26

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

  DATA_SOURCES.include?(value)
end