Class: Workarea::Pricing::Price

Inherits:
Object
  • Object
show all
Includes:
ApplicationDocument, UnsupportedSegmentation, Releasable
Defined in:
app/models/workarea/pricing/price.rb

Instance Method Summary collapse

Methods included from Releasable

#changesets_with_children, #destroy, #in_release, #release_changes, #release_originals, #save_changeset, #skip_changeset, #without_release

Methods included from Segmentable

#active?, #active_segment_ids_with_children, #segmented?, #segments

Methods included from Release::Activation

#activate_with?, #create_activation_changeset, #save_activate_with, #was_active?

Methods included from ApplicationDocument

#releasable?

Methods included from Sidekiq::Callbacks

assert_valid_config!, async, disable, enable, inline, #run_callbacks

Methods included from Mongoid::Document

#embedded_children

Instance Method Details

#generic?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/models/workarea/pricing/price.rb', line 31

def generic?
  min_quantity == 1
end

#nameObject



19
20
21
# File 'app/models/workarea/pricing/price.rb', line 19

def name
  ''
end

#on_sale?Boolean

Whether this price is on sale. Defaults to the #on_sale value of the Pricing::Sku it’s embedded within.

Returns:

  • (Boolean)


40
41
42
# File 'app/models/workarea/pricing/price.rb', line 40

def on_sale?
  super || sku&.on_sale?
end

#sellObject



23
24
25
26
27
28
29
# File 'app/models/workarea/pricing/price.rb', line 23

def sell
  if on_sale? && sale.present?
    sale
  else
    regular
  end
end