Sha256: 06f59c430fcdaf8cdb4ea2ebc10e86e60abb720495c39bd88b746ee72f262586

Contents?: true

Size: 606 Bytes

Versions: 61

Compression:

Stored size: 606 Bytes

Contents

module Spree
  module Stock
    # Used by Prioritizer to adjust item quantities.
    #
    # See spec/models/spree/stock/prioritizer_spec.rb for use cases.
    class Adjuster
      attr_accessor :inventory_unit, :status, :fulfilled

      def initialize(inventory_unit, status)
        @inventory_unit = inventory_unit
        @status = status
        @fulfilled = false
      end

      def adjust(package)
        if fulfilled?
          package.remove(inventory_unit)
        else
          self.fulfilled = true
        end
      end

      def fulfilled?
        fulfilled
      end
    end
  end
end

Version data entries

61 entries across 61 versions & 2 rubygems

Version Path
solidus_core-2.2.0.beta1 app/models/spree/stock/adjuster.rb
solidus_core-2.1.0 app/models/spree/stock/adjuster.rb
solidus_core-2.1.0.rc1 app/models/spree/stock/adjuster.rb
solidus_core-2.0.1 app/models/spree/stock/adjuster.rb
solidus_core-2.1.0.beta1 app/models/spree/stock/adjuster.rb
solidus_core-2.0.0 app/models/spree/stock/adjuster.rb
solidus_core-1.4.0 app/models/spree/stock/adjuster.rb
solidus_core-2.0.0.rc1 app/models/spree/stock/adjuster.rb
solidus_core-1.4.0.rc1 app/models/spree/stock/adjuster.rb
solidus_core-2.0.0.beta1 app/models/spree/stock/adjuster.rb
solidus_core-1.4.0.beta1 app/models/spree/stock/adjuster.rb
solidus_core-1.3.1 app/models/spree/stock/adjuster.rb
solidus_core-1.3.0 app/models/spree/stock/adjuster.rb
solidus_core-1.3.0.rc2 app/models/spree/stock/adjuster.rb
solidus_core-1.3.0.rc1 app/models/spree/stock/adjuster.rb
solidus_core-1.3.0.beta1 app/models/spree/stock/adjuster.rb
solidus_core-1.0.6 app/models/spree/stock/adjuster.rb
solidus_core-1.2.2 app/models/spree/stock/adjuster.rb
solidus_core-1.2.1 app/models/spree/stock/adjuster.rb
solidus_core-1.1.3 app/models/spree/stock/adjuster.rb