Class: ThePlaidApi::ExpirationDate

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

Overview

A description of whether the associated document was expired when the verification was performed. Note: In the case where an expiration date is not present on the document or failed to be extracted, this value will be ‘no_data`.

Constant Summary collapse

EXPIRATION_DATE =
[
  # TODO: Write general description for NOT_EXPIRED
  NOT_EXPIRED = 'not_expired'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = NOT_EXPIRED) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'not_expired' then NOT_EXPIRED
  when 'expired' then EXPIRED
  when 'no_data' then NO_DATA
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/the_plaid_api/models/expiration_date.rb', line 23

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

  EXPIRATION_DATE.include?(value)
end