Class: Spree::Stock::Estimator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(order) ⇒ Estimator

Returns a new instance of Estimator.



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

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

Instance Attribute Details

#currencyObject (readonly)

Returns the value of attribute currency.



4
5
6
# File 'app/models/spree/stock/estimator.rb', line 4

def currency
  @currency
end

#orderObject (readonly)

Returns the value of attribute order.



4
5
6
# File 'app/models/spree/stock/estimator.rb', line 4

def order
  @order
end

Instance Method Details

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



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

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