Class: Spree::ShippingMethod
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Spree::ShippingMethod
- Includes:
- Core::CalculatedAdjustments
- Defined in:
- app/models/spree/shipping_method.rb
Constant Summary collapse
- DISPLAY =
[:both, :front_end, :back_end]
Class Method Summary collapse
Instance Method Summary collapse
- #build_tracking_url(tracking) ⇒ Object
-
#frontend? ⇒ Boolean
Some shipping methods are only meant to be set via backend.
- #include?(address) ⇒ Boolean
- #tax_category ⇒ Object
Methods included from Core::CalculatedAdjustments
Class Method Details
.calculators ⇒ Object
36 37 38 |
# File 'app/models/spree/shipping_method.rb', line 36 def self.calculators spree_calculators.send(model_name_without_spree_namespace).select{ |c| c < Spree::ShippingCalculator } end |
Instance Method Details
#build_tracking_url(tracking) ⇒ Object
31 32 33 34 |
# File 'app/models/spree/shipping_method.rb', line 31 def build_tracking_url(tracking) return if tracking.blank? || tracking_url.blank? tracking_url.gsub(/:tracking/, ERB::Util.url_encode(tracking)) # :url_encode exists in 1.8.7 through 2.1.0 end |
#frontend? ⇒ Boolean
Some shipping methods are only meant to be set via backend
41 42 43 |
# File 'app/models/spree/shipping_method.rb', line 41 def frontend? self.display_on != "back_end" end |
#include?(address) ⇒ Boolean
24 25 26 27 28 29 |
# File 'app/models/spree/shipping_method.rb', line 24 def include?(address) return false unless address zones.any? do |zone| zone.include?(address) end end |
#tax_category ⇒ Object
45 46 47 |
# File 'app/models/spree/shipping_method.rb', line 45 def tax_category Spree::TaxCategory.unscoped { super } end |