Class: Plaid::SwitchMethod

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

Overview

The method used to make the deposit switch. - ‘instant` – User instantly switched their direct deposit to a new or existing bank account by connecting their payroll or employer account. - `mail` – User requested that Plaid contact their employer by mail to make the direct deposit switch. - `pdf` – User generated a PDF or email to be sent to their employer with the information necessary to make the deposit switch.’

Constant Summary collapse

SWITCH_METHOD =
[
  # TODO: Write general description for INSTANT
  INSTANT = 'instant'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = INSTANT) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/plaid/models/switch_method.rb', line 31

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

  str = value.to_s.strip

  case str.downcase
  when 'instant' then INSTANT
  when 'mail' then MAIL
  when 'pdf' then PDF
  else
    default_value
  end
end

.validate(value) ⇒ Object



25
26
27
28
29
# File 'lib/plaid/models/switch_method.rb', line 25

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

  true
end