Sha256: 848d7830bad277b1f9d9eacb93dad835abe31c9e6fed3e9e69d3308b47a4028f

Contents?: true

Size: 565 Bytes

Versions: 2

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 to_s
    "$#{ amount_cents.to_f/100 } / #{interval}"
  end

end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ish_models-0.0.33.268 lib/wco/price.rb
ish_models-0.0.33.267 lib/wco/price.rb