Sha256: 08dc0732751751ba1b0924dd51036729d8cf0a51402fff3da2c6e08c6baf13a9

Contents?: true

Size: 430 Bytes

Versions: 5

Compression:

Stored size: 430 Bytes

Contents

require 'peddler/csv_parser'
require 'peddler/xml_parser'

module Peddler
  # @api private
  module Parser
    def self.parse(res)
      # Don't parse if there's no body
      return res unless res.body

      case res.headers['Content-Type']
      when 'text/xml'
        XMLParser.new(res)
      when 'application/octet-stream'
        CSVParser.new(res)
      else
        raise NotImplementedError
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
peddler-0.7.5 lib/peddler/parser.rb
peddler-0.7.3 lib/peddler/parser.rb
peddler-0.7.2 lib/peddler/parser.rb
peddler-0.7.1 lib/peddler/parser.rb
peddler-0.7.0 lib/peddler/parser.rb