Sha256: adaf92c1d49e2d51c97453f7ccef262bb453cd7f48abb1469444f05a821bfc2e

Contents?: true

Size: 412 Bytes

Versions: 6

Compression:

Stored size: 412 Bytes

Contents

# encoding: UTF-8
require 'nokogiri'

module Correios
  module Frete
    class Parser
      def servicos(xml)
        servicos = {}
        xml = xml.encode("UTF-8", "ISO-8859-1")

        Nokogiri::XML(xml).root.elements.each do |element|
          servico = Correios::Frete::Servico.new.parse(element.to_xml)
          servicos[servico.tipo] = servico
        end

        servicos
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
correios-frete-1.13.0 lib/correios/frete/parser.rb
correios-frete-1.12.0 lib/correios/frete/parser.rb
correios-frete-1.11.1 lib/correios/frete/parser.rb
correios-frete-1.11.0 lib/correios/frete/parser.rb
correios-frete-1.10.1 lib/correios/frete/parser.rb
correios-frete-1.10.0 lib/correios/frete/parser.rb