lib/rsr_group/inventory.rb in rsr_group-1.7.1 vs lib/rsr_group/inventory.rb in rsr_group-1.7.2

- old
+ new

@@ -16,39 +16,33 @@ def self.all(options = {}) requires!(options, :username, :password) new(options).all end - def self.process_as_chunks(size = 15, options = {}) + def self.process_as_chunks(size = 15, options = {}, &block) requires!(options, :username, :password) - new(options).process_as_chunks(size) do |chunk| - yield(chunk) - end + new(options).process_as_chunks(size, &block) end def self.map_prices(options = {}) requires!(options, :username, :password) new(options).map_prices end - def self.map_prices_as_chunks(size = 15, options = {}) + def self.map_prices_as_chunks(size = 15, options = {}, &block) requires!(options, :username, :password) - new(options).map_prices_as_chunks(size) do |chunk| - yield(chunk) - end + new(options).map_prices_as_chunks(size, &block) end def self.quantities(options = {}) requires!(options, :username, :password) new(options).quantities end - def self.quantities_as_chunks(size = 15, options = {}) + def self.quantities_as_chunks(size = 15, options = {}, &block) requires!(options, :username, :password) - new(options).quantities_as_chunks(size) do |chunk| - yield(chunk) - end + new(options).quantities_as_chunks(size, &block) end def all items = [] @@ -148,11 +142,11 @@ end items end - def process_as_chunks(size) + def process_as_chunks(size, &block) connect(@options) do |ftp| chunker = RsrGroup::Chunker.new(size) temp_csv_file = Tempfile.new # Is this a key dealer? @@ -213,11 +207,11 @@ end rows end - def map_prices_as_chunks(size) + def map_prices_as_chunks(size, &block) connect(@options) do |ftp| chunker = RsrGroup::Chunker.new(size) temp_csv_file = Tempfile.new # Is this a key dealer? @@ -278,10 +272,10 @@ end rows end - def quantities_as_chunks(size) + def quantities_as_chunks(size, &block) connect(@options) do |ftp| chunker = RsrGroup::Chunker.new(size) temp_csv_file = Tempfile.new # Is this a key dealer?