Class: WalmartApIs::FileType

Inherits:
Object
  • Object
show all
Defined in:
lib/walmart_ap_is/models/file_type.rb

Overview

FileType.

Constant Summary collapse

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

  # TODO: Write general description for ENUM_APPLICATIONZPL
  ENUM_APPLICATIONZPL = 'application/zpl'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ENUM_APPLICATIONPDF) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/walmart_ap_is/models/file_type.rb', line 26

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_applicationzpl' then ENUM_APPLICATIONZPL
  when 'enum_imagepng' then ENUM_IMAGEPNG
  else
    default_value
  end
end

.validate(value) ⇒ Object



20
21
22
23
24
# File 'lib/walmart_ap_is/models/file_type.rb', line 20

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

  FILE_TYPE.include?(value)
end