Class: ThePlaidApi::Type

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

Overview

The type of phone number.

Constant Summary collapse

TYPE =
[
  # TODO: Write general description for HOME
  HOME = 'home'.freeze,

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = HOME) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/the_plaid_api/models/type.rb', line 35

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

  str = value.to_s.strip

  case str.downcase
  when 'home' then HOME
  when 'work' then WORK
  when 'office' then OFFICE
  when 'mobile' then MOBILE
  when 'mobile1' then MOBILE1
  when 'other' then OTHER
  else
    default_value
  end
end

.validate(value) ⇒ Object



29
30
31
32
33
# File 'lib/the_plaid_api/models/type.rb', line 29

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

  TYPE.include?(value)
end