lib/lipseys/inventory.rb in lipseys-4.0.0 vs lib/lipseys/inventory.rb in lipseys-5.0.0

- old
+ new

@@ -7,29 +7,34 @@ requires!(options, :username, :password) @options = options end - def self.all(options = {}, &block) - new(options).all &block + def self.all(options = {}) + new(options).all end - def self.quantity(options = {}, &block) - new(options).all &block + def self.quantity(options = {}) + new(options).all end def self.get_quantity_file(options = {}) new(options).get_quantity_file end - def all(&block) + def all + items = [] tempfile = stream_to_tempfile(API_URL, @options) Lipseys::Parser.parse(tempfile, 'Item') do |node| - yield map_hash(node) + _map_hash = map_hash(node) + + items << _map_hash unless _map_hash.nil? end tempfile.unlink + + items end def get_quantity_file quantity_tempfile = stream_to_tempfile(API_URL, @options) tempfile = Tempfile.new