Class: PaypalServerSdk::ItemCategory

Inherits:
Object
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/item_category.rb

Overview

The item category type.

Constant Summary collapse

ITEM_CATEGORY =
[
  # Goods that are stored, delivered, and used in their electronic format.

  # This value is not currently supported for API callers that leverage the

  # PayPal for Commerce Platform product.

  DIGITAL_GOODS = 'DIGITAL_GOODS'.freeze,

  # A tangible item that can be shipped with proof of delivery.

  PHYSICAL_GOODS = 'PHYSICAL_GOODS'.freeze,

  # A contribution or gift for which no good or service is exchanged,

  # usually to a not for profit organization.

  DONATION = 'DONATION'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DIGITAL_GOODS) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/paypal_server_sdk/models/item_category.rb', line 29

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

  str = value.to_s.strip

  case str.downcase
  when 'digital_goods' then DIGITAL_GOODS
  when 'physical_goods' then PHYSICAL_GOODS
  when 'donation' then DONATION
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/paypal_server_sdk/models/item_category.rb', line 23

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

  true
end