Class: SolidusVolumePricing::PricingOptions

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PricingOptions

Returns a new instance of PricingOptions.



7
8
9
10
11
# File 'app/models/solidus_volume_pricing/pricing_options.rb', line 7

def initialize(options = {})
  super options.except(:quantity, :user)
  @quantity = options.delete(:quantity)
  @user = options.delete(:user)
end

Instance Attribute Details

#quantityObject

Returns the value of attribute quantity.



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

def quantity
  @quantity
end

#userObject

Returns the value of attribute user.



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

def user
  @user
end

Class Method Details

.from_line_item(line_item) ⇒ Object



13
14
15
16
17
18
# File 'app/models/solidus_volume_pricing/pricing_options.rb', line 13

def self.from_line_item(line_item)
  pricing_options = super(line_item)
  pricing_options.quantity = line_item.quantity
  pricing_options.user = line_item.order.user
  pricing_options
end