Class: WalmartApIs::ProcessingStatus

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

Overview

ProcessingStatus.

Constant Summary collapse

PROCESSING_STATUS =
[
  # TODO: Write general description for IN_QUEUE
  IN_QUEUE = 'IN_QUEUE'.freeze,

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = IN_QUEUE) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/walmart_ap_is/models/processing_status.rb', line 32

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

  str = value.to_s.strip

  case str.downcase
  when 'in_queue' then IN_QUEUE
  when 'in_progress' then IN_PROGRESS
  when 'cancelled' then CANCELLED
  when 'done' then DONE
  when 'fatal' then FATAL
  else
    default_value
  end
end

.validate(value) ⇒ Object



26
27
28
29
30
# File 'lib/walmart_ap_is/models/processing_status.rb', line 26

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

  PROCESSING_STATUS.include?(value)
end