Class: Wco::Price
- Inherits:
-
Object
- Object
- Wco::Price
- Includes:
- Mongoid::Document, Mongoid::Paranoia, Mongoid::Timestamps
- Defined in:
- app/models/wco/price.rb
Constant Summary collapse
- INTERVAL_DAY =
'day'- INTERVAL_WEEK =
'week'- INTERVAL_MONTH =
'month'- INTERVAL_YEAD =
'year'- INTERVALS =
[ nil, 'day', 'week', 'month', 'year' ]
Class Method Summary collapse
Instance Method Summary collapse
-
#leadset ⇒ Object
2025-09-12 This used to be required - but I think it’s unreasonable…
-
#product ⇒ Object
Wco::Product, WcoHosting::ApplianceTmpl.
- #to_s ⇒ Object
Class Method Details
.list ⇒ Object
34 35 36 |
# File 'app/models/wco/price.rb', line 34 def self.list [[nil,nil]] + all.map { |p| [ "#{p.product.name} :: #{p.amount_cents.to_f/100}/#{p.interval||'onetime'}", p.id ] } end |
Instance Method Details
#leadset ⇒ Object
2025-09-12 This used to be required - but I think it’s unreasonable…
all leadsets can have the same price.
but I'll keep this around - to be able to override per-leadset.
something else may be broken b/c I made this optional.
15 |
# File 'app/models/wco/price.rb', line 15 belongs_to :leadset, class_name: 'Wco::Leadset', optional: true |
#product ⇒ Object
Wco::Product, WcoHosting::ApplianceTmpl
9 |
# File 'app/models/wco/price.rb', line 9 belongs_to :product, polymorphic: true |
#to_s ⇒ Object
30 31 32 33 |
# File 'app/models/wco/price.rb', line 30 def to_s price = self "$#{ price[:amount_cents].to_f/100 }/#{ price.interval||'onetime' }" end |