Class: Spree::ShippingRate

Inherits:
Base
  • Object
show all
Extended by:
DisplayMoney
Defined in:
app/models/spree/shipping_rate.rb

Instance Method Summary collapse

Methods included from DisplayMoney

money_methods

Methods inherited from Base

page, spree_base_scopes

Methods included from Preferences::Preferable

#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Instance Method Details

#base_priceObject



15
16
17
# File 'app/models/spree/shipping_rate.rb', line 15

def base_price
  cost
end

#display_priceObject Also known as: display_cost



19
20
21
22
23
24
25
26
27
28
29
# File 'app/models/spree/shipping_rate.rb', line 19

def display_price
  price = display_base_price.to_s

  return price if tax_rate.nil? || tax_amount == 0

  Spree.t tax_rate.included_in_price? ? :including_tax : :excluding_tax,
          scope: "shipping_rates.display_price",
          price: price,
          tax_amount: display_tax_amount,
          tax_rate_name: tax_rate.name
end

#shipping_methodObject



36
37
38
# File 'app/models/spree/shipping_rate.rb', line 36

def shipping_method
  Spree::ShippingMethod.unscoped { super }
end

#tax_amountObject



32
33
34
# File 'app/models/spree/shipping_rate.rb', line 32

def tax_amount
  @_tax_amount ||= tax_rate.calculator.compute_shipping_rate(self)
end

#tax_rateObject



40
41
42
# File 'app/models/spree/shipping_rate.rb', line 40

def tax_rate
  Spree::TaxRate.unscoped { super }
end