Class: Spree::Stock::Estimator

Inherits:
Object
  • Object
show all
Includes:
VatPriceCalculation
Defined in:
app/models/spree/stock/estimator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from VatPriceCalculation

#gross_amount

Constructor Details

#initialize(order) ⇒ Estimator


8
9
10
11
# File 'app/models/spree/stock/estimator.rb', line 8

def initialize(order)
  @order = order
  @currency = order.currency
end

Instance Attribute Details

#currencyObject (readonly)

Returns the value of attribute currency


6
7
8
# File 'app/models/spree/stock/estimator.rb', line 6

def currency
  @currency
end

#orderObject (readonly)

Returns the value of attribute order


6
7
8
# File 'app/models/spree/stock/estimator.rb', line 6

def order
  @order
end

Instance Method Details

#shipping_rates(package, shipping_method_filter = ShippingMethod::DISPLAY_ON_FRONT_END) ⇒ Object


13
14
15
16
17
# File 'app/models/spree/stock/estimator.rb', line 13

def shipping_rates(package, shipping_method_filter = ShippingMethod::DISPLAY_ON_FRONT_END)
  rates = calculate_shipping_rates(package, shipping_method_filter)
  choose_default_shipping_rate(rates)
  sort_shipping_rates(rates)
end