Class: ThePlaidApi::ContentTypes

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

Overview

Types of document formats. (Suggested values)

Constant Summary collapse

CONTENT_TYPES =
[
  # TODO: Write general description for ENUM_APPLICATIONPDF
  ENUM_APPLICATIONPDF = 'application/pdf'.freeze,

  # TODO: Write general description for ENUM_IMAGEGIF
  ENUM_IMAGEGIF = 'image/gif'.freeze,

  # TODO: Write general description for ENUM_IMAGEJPEG
  ENUM_IMAGEJPEG = 'image/jpeg'.freeze,

  # TODO: Write general description for ENUM_IMAGETIFF
  ENUM_IMAGETIFF = 'image/tiff'.freeze,

  # TODO: Write general description for ENUM_IMAGEPNG
  ENUM_IMAGEPNG = 'image/png'.freeze,

  # TODO: Write general description for ENUM_APPLICATIONJSON
  ENUM_APPLICATIONJSON = 'application/json'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ENUM_APPLICATIONPDF) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'enum_applicationpdf' then ENUM_APPLICATIONPDF
  when 'enum_imagegif' then ENUM_IMAGEGIF
  when 'enum_imagejpeg' then ENUM_IMAGEJPEG
  when 'enum_imagetiff' then ENUM_IMAGETIFF
  when 'enum_imagepng' then ENUM_IMAGEPNG
  when 'enum_applicationjson' then ENUM_APPLICATIONJSON
  else
    default_value
  end
end

.validate(value) ⇒ Object



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

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

  CONTENT_TYPES.include?(value)
end