Sha256: db923fd5ff5cc6725b028ff906903da510449852e5d3c6162fc43d27a5c95f77

Contents?: true

Size: 534 Bytes

Versions: 4

Compression:

Stored size: 534 Bytes

Contents

module Dugway
  module Drops
    class ProductOptionDrop < BaseDrop
      def default
        name.downcase == 'default'
      end

      def has_custom_price
        price != product.default_price
      end

      # Make up inventory numbers since we obviously don't want that from the API

      def quantity
        @quantity ||= sold_out ? 0 : rand(100)
      end

      def sold
        @sold ||= rand(100)
      end

      def inventory
        ((quantity.to_f / (quantity + sold).to_f) * 100).round
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dugway-0.5.3 lib/dugway/liquid/drops/product_option_drop.rb
dugway-0.5.2 lib/dugway/liquid/drops/product_option_drop.rb
dugway-0.5.1 lib/dugway/liquid/drops/product_option_drop.rb
dugway-0.5.0 lib/dugway/liquid/drops/product_option_drop.rb