Sha256: 79a8de048d0726604aa6be28210e098ec2da7bdcedb7b2603b11834b3336fbf0

Contents?: true

Size: 565 Bytes

Versions: 17

Compression:

Stored size: 565 Bytes

Contents

##
## Not used. _vp_ 2023-09-07
## Just replicating the Stripe structure.
##
class Wco::Price
  include Mongoid::Document
  include Mongoid::Timestamps

  belongs_to :product, class_name: '::Wco::Product', inverse_of: :prices

  has_many :subscriptions, class_name: '::Wco::Subscription', inverse_of: :price, foreign_key: :wco_price_id

  field :amount_cents, type: Integer

  INTERVALS = [ nil, 'day', 'week', 'month', 'year' ]
  field :interval, type: String

  field :price_id   # stripe

  def name
    "$#{ amount_cents.to_f/100 } / #{interval}"
  end

end


Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ish_models-0.0.33.285 lib/wco/price.rb
ish_models-0.0.33.284 lib/wco/price.rb
ish_models-0.0.33.283 lib/wco/price.rb
ish_models-0.0.33.282 lib/wco/price.rb
ish_models-0.0.33.281 lib/wco/price.rb
ish_models-0.0.33.280 lib/wco/price.rb
ish_models-0.0.33.279 lib/wco/price.rb
ish_models-0.0.33.278 lib/wco/price.rb
ish_models-0.0.33.277 lib/wco/price.rb
ish_models-0.0.33.276 lib/wco/price.rb
ish_models-0.0.33.275 lib/wco/price.rb
ish_models-0.0.33.274 lib/wco/price.rb
ish_models-0.0.33.273 lib/wco/price.rb
ish_models-0.0.33.272 lib/wco/price.rb
ish_models-0.0.33.271 lib/wco/price.rb
ish_models-0.0.33.270 lib/wco/price.rb
ish_models-0.0.33.269 lib/wco/price.rb