Class: WalmartApIs::QuantityDiscountType

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

Overview

Indicates the type of quantity discount this price applies to.

Constant Summary collapse

QUANTITY_DISCOUNT_TYPE =
[
  # TODO: Write general description for QUANTITY_DISCOUNT
  QUANTITY_DISCOUNT = 'QUANTITY_DISCOUNT'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = QUANTITY_DISCOUNT) ⇒ Object



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

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

  default_value
end

.validate(value) ⇒ Object



14
15
16
17
18
# File 'lib/walmart_ap_is/models/quantity_discount_type.rb', line 14

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

  QUANTITY_DISCOUNT_TYPE.include?(value)
end