Sha256: 396f7f955b0f035322ff8f1eae3f1ec1dcfd6a21faf81e872da95339ab16f088

Contents?: true

Size: 432 Bytes

Versions: 1

Compression:

Stored size: 432 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

1 entries across 1 versions & 1 rubygems

Version Path
correios-frete-alternative-1.10.2 lib/correios/frete/parser.rb