correios-ws 5 → 6.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/README.md CHANGED
@@ -89,8 +89,8 @@ puts esedex_com_contrato.valor_declarado
89
89
  puts esedex_com_contrato.prazo_entrega
90
90
  puts esedex_com_contrato.entrega_domiciliar
91
91
  puts esedex_com_contrato.entrega_sabado
92
- puts esedex_com_contrato.error
93
- puts esedex_com_contrato.msg_error
92
+ puts esedex_com_contrato.erro?
93
+ puts esedex_com_contrato.msg_erro
94
94
 
95
95
  # Searching by CEP
96
96
 
data/lib/correios-ws.rb CHANGED
@@ -166,12 +166,16 @@ module Correios
166
166
  :entrega_domiciliar,
167
167
  :entrega_sabado,
168
168
  :valor_mao_propria,
169
- :error,
170
- :msg_error)
169
+ :erro,
170
+ :msg_erro)
171
171
 
172
172
  def initialize
173
173
  yield self if block_given?
174
174
  end
175
+
176
+ def erro?
177
+ @erro
178
+ end
175
179
  end
176
180
 
177
181
  class Result
@@ -200,8 +204,8 @@ module Correios
200
204
  s.entrega_domiciliar = cservico['EntregaDomiciliar']
201
205
  s.entrega_sabado = cservico['EntregaSabado']
202
206
  #Informacoes de Erro
203
- s.error = cservico['Erro'].to_s == '1'
204
- s.msg_error = cservico['MsgErro']
207
+ s.erro = cservico['Erro'].to_s != '0'
208
+ s.msg_erro = s.erro? ? (cservico['Erro'].to_i * -1).to_s + ' - ' + cservico['MsgErro'] : ''
205
209
  end
206
210
  end
207
211
 
@@ -1,3 +1,3 @@
1
1
  module Correios
2
- VERSION = "5"
2
+ VERSION = "6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: correios-ws
3
3
  version: !ruby/object:Gem::Version
4
- version: '5'
4
+ version: '6.0'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: