Class: AdvancedBilling::AllocationPreviewLineItemKind
- Inherits:
-
Object
- Object
- AdvancedBilling::AllocationPreviewLineItemKind
- Defined in:
- lib/advanced_billing/models/allocation_preview_line_item_kind.rb
Overview
A handle for the line item kind for allocation preview
Constant Summary collapse
- ALLOCATION_PREVIEW_LINE_ITEM_KIND =
[ # TODO: Write general description for QUANTITY_BASED_COMPONENT QUANTITY_BASED_COMPONENT = 'quantity_based_component'.freeze, # TODO: Write general description for ON_OFF_COMPONENT ON_OFF_COMPONENT = 'on_off_component'.freeze, # TODO: Write general description for COUPON COUPON = 'coupon'.freeze, # TODO: Write general description for TAX TAX = 'tax'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = QUANTITY_BASED_COMPONENT) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/advanced_billing/models/allocation_preview_line_item_kind.rb', line 29 def self.from_value(value, default_value = QUANTITY_BASED_COMPONENT) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'quantity_based_component' then QUANTITY_BASED_COMPONENT when 'on_off_component' then ON_OFF_COMPONENT when 'coupon' then COUPON when 'tax' then TAX else default_value end end |
.validate(value) ⇒ Object
23 24 25 26 27 |
# File 'lib/advanced_billing/models/allocation_preview_line_item_kind.rb', line 23 def self.validate(value) return false if value.nil? ALLOCATION_PREVIEW_LINE_ITEM_KIND.include?(value) end |