Sha256: 1c84df7821eaf932ad3ccf0551c32adf53c6eccd35275f639549bdfe66c7f770

Contents?: true

Size: 557 Bytes

Versions: 43

Compression:

Stored size: 557 Bytes

Contents

# frozen_string_literal: true

module Spree
  class ShippingCalculator < Calculator
    def compute_shipment(_shipment)
      raise NotImplementedError, "Please implement 'compute_shipment(shipment)' in your calculator: #{self.class.name}"
    end

    def compute_package(_package)
      raise NotImplementedError, "Please implement 'compute_package(package)' in your calculator: #{self.class.name}"
    end

    def available?(_package)
      true
    end

    private

    def total(content_items)
      content_items.map(&:amount).sum
    end
  end
end

Version data entries

43 entries across 43 versions & 2 rubygems

Version Path
solidus_core-2.9.6 app/models/spree/shipping_calculator.rb
solidus_core-2.8.6 app/models/spree/shipping_calculator.rb
solidus_core-2.9.5 app/models/spree/shipping_calculator.rb
solidus_core-2.9.4 app/models/spree/shipping_calculator.rb
solidus_core-2.6.6 app/models/spree/shipping_calculator.rb
solidus_core-2.7.4 app/models/spree/shipping_calculator.rb
solidus_core-2.8.5 app/models/spree/shipping_calculator.rb
solidus_core-2.9.3 app/models/spree/shipping_calculator.rb
solidus_core-2.9.2 app/models/spree/shipping_calculator.rb
solidus_core-2.10.0.beta1 app/models/spree/shipping_calculator.rb
solidus_core-2.7.3 app/models/spree/shipping_calculator.rb
solidus_core-2.6.5 app/models/spree/shipping_calculator.rb
solidus_core-2.9.1 app/models/spree/shipping_calculator.rb
solidus_core-2.9.0 app/models/spree/shipping_calculator.rb
solidus_core-2.9.0.rc.1 app/models/spree/shipping_calculator.rb
solidus_core-2.8.4 app/models/spree/shipping_calculator.rb
solidus_core-2.8.3 app/models/spree/shipping_calculator.rb
solidus_core-2.7.2 app/models/spree/shipping_calculator.rb
solidus_core-2.6.4 app/models/spree/shipping_calculator.rb
solidus_core-2.8.2 app/models/spree/shipping_calculator.rb