Class: AdvancedBilling::LineItemKind
- Inherits:
-
Object
- Object
- AdvancedBilling::LineItemKind
- Defined in:
- lib/advanced_billing/models/line_item_kind.rb
Overview
A handle for the line item kind
Constant Summary collapse
- LINE_ITEM_KIND =
[ # TODO: Write general description for BASELINE BASELINE = 'baseline'.freeze, # TODO: Write general description for INITIAL INITIAL = 'initial'.freeze, # TODO: Write general description for TRIAL TRIAL = 'trial'.freeze, # TODO: Write general description for QUANTITY_BASED_COMPONENT QUANTITY_BASED_COMPONENT = 'quantity_based_component'.freeze, # TODO: Write general description for PREPAID_USAGE_COMPONENT PREPAID_USAGE_COMPONENT = 'prepaid_usage_component'.freeze, # TODO: Write general description for ON_OFF_COMPONENT ON_OFF_COMPONENT = 'on_off_component'.freeze, # TODO: Write general description for METERED_COMPONENT METERED_COMPONENT = 'metered_component'.freeze, # TODO: Write general description for EVENT_BASED_COMPONENT EVENT_BASED_COMPONENT = 'event_based_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 = BASELINE) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/advanced_billing/models/line_item_kind.rb', line 47 def self.from_value(value, default_value = BASELINE) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'baseline' then BASELINE when 'initial' then INITIAL when 'trial' then TRIAL when 'quantity_based_component' then QUANTITY_BASED_COMPONENT when 'prepaid_usage_component' then PREPAID_USAGE_COMPONENT when 'on_off_component' then ON_OFF_COMPONENT when 'metered_component' then METERED_COMPONENT when 'event_based_component' then EVENT_BASED_COMPONENT when 'coupon' then COUPON when 'tax' then TAX else default_value end end |
.validate(value) ⇒ Object
41 42 43 44 45 |
# File 'lib/advanced_billing/models/line_item_kind.rb', line 41 def self.validate(value) return false if value.nil? LINE_ITEM_KIND.include?(value) end |