correios 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/correios.rb CHANGED
@@ -115,7 +115,8 @@ class Correios
115
115
  }
116
116
 
117
117
  params = params.to_a.map {|item| item.to_a.join('=')} .join('&')
118
- xml = XmlSimple.xml_in(open("#{host}#{path}?#{params}").read)
118
+ xml_str = open("#{host}#{path}?#{params}").read
119
+ xml = XmlSimple.xml_in(xml_str)
119
120
 
120
121
  setup_services xml, servicos
121
122
  end
@@ -128,7 +129,7 @@ class Correios
128
129
  if xml["cServico"].size > 1
129
130
  servicos = {}
130
131
  xml["cServico"].each do |servico|
131
- servicos[Servico::SERVICOS[servico["Codigo"].to_s.to_i]] = Servico.new(servico)
132
+ servicos[Servico::SERVICOS[servico["Codigo"].first.to_i]] = Servico.new(servico) rescue nil
132
133
  end
133
134
  else
134
135
  servicos = Servico.new(xml["cServico"].first)
@@ -1,3 +1,3 @@
1
1
  class Correios
2
- VERSION = "0.7.0"
2
+ VERSION = "0.8.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: correios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: