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

- old
+ new

@@ -19,21 +19,22 @@ def self.get_quantity_file(options = {}) requires!(options, :username, :password) new(options).get_quantity_file end - def self.quantity(options = {}, &block) + def self.quantity(options = {}) requires!(options, :username, :password) - new(options).all &block + new(options).all end - def self.all(options = {}, &block) + def self.all(options = {}) requires!(options, :username, :password) - new(options).all &block + new(options).all end - def all(&block) + def all + items = [] quantity_tempfile = get_file(INVENTORY_FILENAME) SmarterCSV.process(quantity_tempfile, { chunk_size: CHUNK_SIZE, force_utf8: true, @@ -42,16 +43,17 @@ product: :item_identifier, qty_avail: :quantity, } }) do |chunk| chunk.each do |item| - yield item + items << item end end quantity_tempfile.close quantity_tempfile.unlink - true + + items end def get_quantity_file quantity_tempfile = get_file(INVENTORY_FILENAME) tempfile = Tempfile.new