Class: AdvancedBilling::CleanupScope
- Inherits:
-
Object
- Object
- AdvancedBilling::CleanupScope
- Defined in:
- lib/advanced_billing/models/cleanup_scope.rb
Overview
all: Will clear all products, customers, and related subscriptions from the site. customers: Will clear only customers and related subscriptions (leaving the products untouched) for the site. Revenue will also be reset to 0.
Constant Summary collapse
- CLEANUP_SCOPE =
[ # TODO: Write general description for ALL ALL = 'all'.freeze, # TODO: Write general description for CUSTOMERS CUSTOMERS = 'customers'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = ALL) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/advanced_billing/models/cleanup_scope.rb', line 26 def self.from_value(value, default_value = ALL) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'all' then ALL when 'customers' then CUSTOMERS else default_value end end |
.validate(value) ⇒ Object
20 21 22 23 24 |
# File 'lib/advanced_billing/models/cleanup_scope.rb', line 20 def self.validate(value) return false if value.nil? CLEANUP_SCOPE.include?(value) end |