Class: Spree::ShippingMethod

Inherits:
ActiveRecord::Base
  • Object
show all
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

Methods included from Core::CalculatedAdjustments

included

Class Method Details

.calculatorsObject


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

#adjustment_labelObject


21
22
23
# File 'app/models/spree/shipping_method.rb', line 21

def adjustment_label
  Spree.t(:shipping)
end

#build_tracking_url(tracking) ⇒ Object


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

def build_tracking_url(tracking)
  tracking_url.gsub(/:tracking/, tracking) unless tracking.blank? || tracking_url.blank?
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


25
26
27
28
29
30
# File 'app/models/spree/shipping_method.rb', line 25

def include?(address)
  return false unless address
  zones.any? do |zone|
    zone.include?(address)
  end
end