Sha256: cdc4193be894f67d530bbba199e971a4077eaa1b500ea899329d9c11fc2d08cf

Contents?: true

Size: 417 Bytes

Versions: 3

Compression:

Stored size: 417 Bytes

Contents

# encoding: UTF-8
require 'nokogiri'

class Correios::Frete::Parser
  SERVICES = {
    :pac => "41106",
    :sedex => "40010",
    :sedex_10 => "40215",
    :sedex_hoje => "40290"
  }

  def servicos(xml)
    servicos = {}

    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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
correios-frete-0.2.1 lib/correios/frete/parser.rb
correios-frete-0.2.0 lib/correios/frete/parser.rb
correios-frete-0.1.0 lib/correios/frete/parser.rb