Sha256: 01040d98d704f891f60a5c9b75749fd2c11d7b3f9ef16168c140188cda523ff7

Contents?: true

Size: 421 Bytes

Versions: 10

Compression:

Stored size: 421 Bytes

Contents

# encoding: UTF-8
require 'nokogiri'

module Correios
  module Frete
    class Parser
      def servicos(xml)
        servicos = {}
        xml = xml.backward_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

10 entries across 10 versions & 1 rubygems

Version Path
correios-frete-1.9.5 lib/correios/frete/parser.rb
correios-frete-1.9.4 lib/correios/frete/parser.rb
correios-frete-1.9.3 lib/correios/frete/parser.rb
correios-frete-1.9.2 lib/correios/frete/parser.rb
correios-frete-1.9.1 lib/correios/frete/parser.rb
correios-frete-1.9.0 lib/correios/frete/parser.rb
correios-frete-1.8.0 lib/correios/frete/parser.rb
correios-frete-1.7.0 lib/correios/frete/parser.rb
correios-frete-1.6.2 lib/correios/frete/parser.rb
correios-frete-1.6.1 lib/correios/frete/parser.rb