Class: Workarea::Pricing::Price

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

Instance Method Summary collapse

Methods included from Releasable

#activates_with_current_release?, #releasable?, #release_changes, #save_changeset, #skip_changeset

Methods included from ApplicationDocument

#releasable?

Methods included from Sidekiq::Callbacks

add_worker, assert_valid_config!, async, caching_classes?, disable, enable, inline, #run_callbacks, workers, workers_list

Instance Method Details

#generic?Boolean

Returns:

  • (Boolean)


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

def generic?
  min_quantity == 1
end

#nameObject



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

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)


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

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

#sellObject



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

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