Sha256: cbe13a6769aabb3354271456b0bb5e80d7a8f69e0d43571f37e7b853ba6ee4d1

Contents?: true

Size: 458 Bytes

Versions: 9

Compression:

Stored size: 458 Bytes

Contents

class ShippingMethod < ActiveRecord::Base
  belongs_to :zone

  def calculate_shipping(shipment)
    return 0 unless zone.include?(shipment.address)
    return shipping_calculator.constantize.new.send(:calculate_shipping, shipment)
  end   
  
  def available?(order)
    calculator = shipping_calculator.constantize.new                               
    return true unless calculator.respond_to?(:available?)
    calculator.available?(order)    
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
kdmny-spree-0.0.1 app/models/shipping_method.rb
spree-0.8.4 app/models/shipping_method.rb
spree-0.8.5 app/models/shipping_method.rb
spree-0.7.1 app/models/shipping_method.rb
spree-0.7.0 app/models/shipping_method.rb
spree-0.8.0 app/models/shipping_method.rb
spree-0.8.1 app/models/shipping_method.rb
spree-0.8.2 app/models/shipping_method.rb
spree-0.8.3 app/models/shipping_method.rb