Class: ThePlaidApi::AccountSelectionCardinality

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

Overview

The application requires that accounts be limited to a specific cardinality. ‘MULTI_SELECT`: indicates that the user should be allowed to pick multiple accounts. `SINGLE_SELECT`: indicates that the user should be allowed to pick only a single account. `ALL`: indicates that the user must share all of their accounts and should not be given the opportunity to de-select

Constant Summary collapse

ACCOUNT_SELECTION_CARDINALITY =
[
  # TODO: Write general description for SINGLE_SELECT
  SINGLE_SELECT = 'SINGLE_SELECT'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = SINGLE_SELECT) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/the_plaid_api/models/account_selection_cardinality.rb', line 30

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

  str = value.to_s.strip

  case str.downcase
  when 'single_select' then SINGLE_SELECT
  when 'multi_select' then MULTI_SELECT
  when 'all' then ALL
  else
    default_value
  end
end

.validate(value) ⇒ Object



24
25
26
27
28
# File 'lib/the_plaid_api/models/account_selection_cardinality.rb', line 24

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

  ACCOUNT_SELECTION_CARDINALITY.include?(value)
end