lib/lipseys/inventory.rb in lipseys-2.0.9 vs lib/lipseys/inventory.rb in lipseys-2.1.0
- old
+ new
@@ -11,10 +11,14 @@
def self.all(chunk_size = 15, options = {}, &block)
new(options).all(chunk_size, &block)
end
+ def self.get_quantity_file(options = {})
+ new(options).get_quantity_file
+ end
+
def self.quantity(chunk_size = 100, options = {}, &block)
new(options).all(chunk_size, &block)
end
def self.accessories(options = {})
@@ -52,9 +56,23 @@
if chunker.chunk.count > 0
yield(chunker.chunk)
end
tempfile.unlink
+ end
+
+ def get_quantity_file
+ quantity_tempfile = stream_to_tempfile(API_URL, @options)
+ tempfile = Tempfile.new
+
+ Lipseys::Parser.parse(quantity_tempfile, 'Item') do |node|
+ tempfile.puts("#{content_for(node, 'ItemNo')},#{content_for(node, 'QtyOnHand')}")
+ end
+
+ quantity_tempfile.unlink
+ tempfile.close
+
+ tempfile.path
end
def quantity(size, &block)
chunker = Lipseys::Chunker.new(size)
tempfile = stream_to_tempfile(API_URL, @options)