Sha256: 6dc5e66e3162665c68045b2db221ed967fb74474c53c9dc00070be4193a69a47

Contents?: true

Size: 641 Bytes

Versions: 17

Compression:

Stored size: 641 Bytes

Contents

module Xdelivery
  module API
    class Products < Base
      include Enumerable

      attr_accessor :products

      COLUMNS = [
        :days_produce, :qty_day_average, :qty_week_average, :qty_month_average, :qty_owe
      ]

      def set(code, params)
        self.products ||= []
        params.delete_if { |k, v| COLUMNS.include?(k) == false }
        products.push(params.merge(code: code))
      end

      def update!
        response = patch('/products/update_all.json')
        Response::Products.new(response)
      end

      protected

      def patch_data
        { qtys: { products: products } }
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
xdelivery-2.0.3 lib/xdelivery/api/products.rb
xdelivery-2.0.1 lib/xdelivery/api/products.rb
xdelivery-2.0.0 lib/xdelivery/api/products.rb
xdelivery-1.0.2 lib/xdelivery/api/products.rb
xdelivery-1.0.1 lib/xdelivery/api/products.rb
xdelivery-1.0.0 lib/xdelivery/api/products.rb
xdelivery-0.2.4 lib/xdelivery/api/products.rb
xdelivery-0.2.3 lib/xdelivery/api/products.rb
xdelivery-0.2.2 lib/xdelivery/api/products.rb
xdelivery-0.2.1 lib/xdelivery/api/products.rb
xdelivery-0.2.0 lib/xdelivery/api/products.rb
xdelivery-0.1.6 lib/xdelivery/api/products.rb
xdelivery-0.1.5 lib/xdelivery/api/products.rb
xdelivery-0.1.4 lib/xdelivery/api/products.rb
xdelivery-0.1.3 lib/xdelivery/api/products.rb
xdelivery-0.1.2 lib/xdelivery/api/products.rb
xdelivery-0.1.1 lib/xdelivery/api/products.rb