Class: WalmartApIs::ReasonComment

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

Overview

Reason for cancelling or rescheduling a self-ship appointment.

Constant Summary collapse

REASON_COMMENT =
[
  # TODO: Write general description for APPOINTMENT_REQUESTED_BY_MISTAKE
  APPOINTMENT_REQUESTED_BY_MISTAKE = 'APPOINTMENT_REQUESTED_BY_MISTAKE'.freeze,

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

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

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

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = APPOINTMENT_REQUESTED_BY_MISTAKE) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/walmart_ap_is/models/reason_comment.rb', line 44

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

  str = value.to_s.strip

  case str.downcase
  when 'appointment_requested_by_mistake' then APPOINTMENT_REQUESTED_BY_MISTAKE
  when 'vehicle_delay' then VEHICLE_DELAY
  when 'slot_not_suitable' then SLOT_NOT_SUITABLE
  when 'outside_carrier_business_hours' then OUTSIDE_CARRIER_BUSINESS_HOURS
  when 'unfavourable_external_conditions' then UNFAVOURABLE_EXTERNAL_CONDITIONS
  when 'procurement_delay' then PROCUREMENT_DELAY
  when 'shipping_plan_changed' then SHIPPING_PLAN_CHANGED
  when 'increased_quantity' then INCREASED_QUANTITY
  when 'other' then OTHER
  else
    default_value
  end
end

.validate(value) ⇒ Object



38
39
40
41
42
# File 'lib/walmart_ap_is/models/reason_comment.rb', line 38

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

  REASON_COMMENT.include?(value)
end