Class: WalmartApIs::Status1

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

Overview

Status1.

Constant Summary collapse

STATUS1 =
[
  # TODO: Write general description for ACCEPTED
  ACCEPTED = 'ACCEPTED'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ACCEPTED) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/walmart_ap_is/models/status1.rb', line 23

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

  str = value.to_s.strip

  case str.downcase
  when 'accepted' then ACCEPTED
  when 'invalid' then INVALID
  else
    default_value
  end
end

.validate(value) ⇒ Object



17
18
19
20
21
# File 'lib/walmart_ap_is/models/status1.rb', line 17

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

  STATUS1.include?(value)
end