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.
@@ -20,7 +20,13 @@ module Cieloz
|
|
20
20
|
attr_reader :xml
|
21
21
|
|
22
22
|
def self.from xml
|
23
|
-
obj = new
|
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
|
data/lib/cieloz/requisicao.rb
CHANGED
@@ -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.
|
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
|
data/lib/cieloz/version.rb
CHANGED