cieloz 0.0.2 → 0.0.3

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.
@@ -6,6 +6,10 @@ module Cieloz
6
6
  def success?
7
7
  false
8
8
  end
9
+
10
+ def status
11
+ codigo
12
+ end
9
13
  end
10
14
  end
11
15
  end
@@ -20,7 +20,13 @@ module Cieloz
20
20
  attr_reader :xml
21
21
 
22
22
  def self.from xml
23
- obj = new.from_xml xml
23
+ obj = new
24
+ begin
25
+ obj = obj.from_xml xml
26
+ rescue
27
+ # makes it resilient to bad responses,
28
+ # allowing them to be logged
29
+ end
24
30
  obj.instance_variable_set :@xml, xml
25
31
  obj
26
32
  end
@@ -52,7 +52,7 @@ class Cieloz::Requisicao
52
52
 
53
53
  def parse res
54
54
  body = res.body.force_encoding("ISO-8859-1").encode "UTF-8"
55
- return Erro.new(codigo: res.code, mensagem: body) if res.code != "200"
55
+ return Erro.from(body).tap { |e| e.codigo = res.code } if res.code != "200"
56
56
 
57
57
  root = Nokogiri::XML(body).root
58
58
  response_class = case root.name
@@ -1,3 +1,3 @@
1
1
  module Cieloz
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cieloz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: