Sha256: 7d8be4069b060d4ab9622adc94ffc63c5ab4912ca63378797730d1bbcd448768

Contents?: true

Size: 623 Bytes

Versions: 17

Compression:

Stored size: 623 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
  def name_simple
    "$#{ amount_cents.to_f/100 }"
  end

end


Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ish_models-3.0.0.1 lib/wco/price.rb
ish_models-0.0.33.304 lib/wco/price.rb
ish_models-0.0.33.303 lib/wco/price.rb
ish_models-0.0.33.302 lib/wco/price.rb
ish_models-0.0.33.301 lib/wco/price.rb
ish_models-0.0.33.300 lib/wco/price.rb
ish_models-0.0.33.299 lib/wco/price.rb
ish_models-0.0.33.298 lib/wco/price.rb
ish_models-0.0.33.297 lib/wco/price.rb
ish_models-0.0.33.296 lib/wco/price.rb
ish_models-0.0.33.295 lib/wco/price.rb
ish_models-0.0.33.294 lib/wco/price.rb
ish_models-0.0.33.293 lib/wco/price.rb
ish_models-0.0.33.292 lib/wco/price.rb
ish_models-0.0.33.291 lib/wco/price.rb
ish_models-0.0.33.287 lib/wco/price.rb
ish_models-0.0.33.286 lib/wco/price.rb