lib/peddler/handlers.rb in peddler-0.2.4 vs lib/peddler/handlers.rb in peddler-0.3.0

- old
+ new

@@ -1,19 +1,19 @@ module Peddler module Handlers class XMLHandler - + # Parses legacy responses to queries on statuses of generated reports and inventory uploads. def self.parse_legacy(hash) if hash['Batches'] - hash['Batches']['Batch'].collect { |input| Peddler::LegacyReports::UploadStatus.new(input) } + [hash['Batches']['Batch']].flatten.collect { |input| Peddler::LegacyReports::UploadStatus.new(input) } elsif hash['Reports'] - hash['Reports']['Report'].collect { |input| Peddler::LegacyReports::ReportStatus.new(input) } + [hash['Reports']['Report']].flatten.collect { |input| Peddler::LegacyReports::ReportStatus.new(input) } end end end - + class TabDelimitedHandler # Decodes tab-delimited content into an array of OpenStruct objects. It # assumes first line contains parameter names. def self.decode_response(res, &block) if block_given? @@ -33,6 +33,6 @@ end end end end end -end \ No newline at end of file +end