Class: SplititWebApiV4::PlanStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/splitit_web_api_v4/models/plan_status.rb

Overview

PlanStatus.

Constant Summary collapse

PLAN_STATUS =
[
  # TODO: Write general description for INITIALIZED
  INITIALIZED = 'Initialized'.freeze,

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = INITIALIZED) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'initialized' then INITIALIZED
  when 'pendingcapture' then PENDINGCAPTURE
  when 'active' then ACTIVE
  when 'cleared' then CLEARED
  when 'canceled' then CANCELED
  else
    default_value
  end
end

.validate(value) ⇒ Object



26
27
28
29
30
# File 'lib/splitit_web_api_v4/models/plan_status.rb', line 26

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

  PLAN_STATUS.include?(value)
end