Class: SolidusVolumePricing::Pricer

Inherits:
Spree::Variant::PriceSelector
  • Object
show all
Defined in:
app/models/solidus_volume_pricing/pricer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#quantityObject (readonly)

Returns the value of attribute quantity.



5
6
7
# File 'app/models/solidus_volume_pricing/pricer.rb', line 5

def quantity
  @quantity
end

#userObject (readonly)

Returns the value of attribute user.



5
6
7
# File 'app/models/solidus_volume_pricing/pricer.rb', line 5

def user
  @user
end

Class Method Details

.pricing_options_classObject



7
8
9
# File 'app/models/solidus_volume_pricing/pricer.rb', line 7

def self.pricing_options_class
  SolidusVolumePricing::PricingOptions
end

Instance Method Details

#earning_amount(pricing_options) ⇒ Object



16
17
18
19
# File 'app/models/solidus_volume_pricing/pricer.rb', line 16

def earning_amount(pricing_options)
  extract_options(pricing_options)
  ::Spree::Money.new(computed_earning)
end

#earning_percent(pricing_options) ⇒ Object



21
22
23
24
# File 'app/models/solidus_volume_pricing/pricer.rb', line 21

def earning_percent(pricing_options)
  extract_options(pricing_options)
  computed_earning_percent.round
end

#price_for(pricing_options) ⇒ Object



11
12
13
14
# File 'app/models/solidus_volume_pricing/pricer.rb', line 11

def price_for(pricing_options)
  extract_options(pricing_options)
  ::Spree::Money.new(computed_price)
end