Sha256: 66d99ae1e3141834361cf6e90c94556e49e6a8cc8e4aef4f3867d1fb53ee9de3

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

require 'peddler/flat_file_parser'
require 'peddler/xml_parser'

module Peddler
  # @api private
  module Parser
    class << self
      # The inevitable messiness of massaging data produced by a motley army of
      # Amazon developers
      def parse(res, encoding = 'ISO-8859-1')
        # 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'
          FlatFileParser.new(res, encoding)
        else
          raise NotImplementedError
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
peddler-0.7.6 lib/peddler/parser.rb