lib/intacctrb/base.rb in intacctrb-0.9.0 vs lib/intacctrb/base.rb in intacctrb-0.9.1
- old
+ new
@@ -64,11 +64,11 @@
@sent_xml = xml
url = "https://www.intacct.com/ia/xml/xmlgw.phtml"
uri = URI(url)
retry_count += 1
- res = Net::HTTP.post_form(uri, 'xmlrequest' => xml, read_timeout: 60)
+ res = Net::HTTP.post_form(uri, 'xmlrequest' => xml, read_timeout: 120)
@response = Nokogiri::XML(res.body)
IntacctRB.logger.debug res.body
if successful?
if key = response.at('//result//RECORDNO') || response.at('//result//key')
set_intacct_id key.content if object
@@ -86,17 +86,11 @@
if retry_count <= 3
IntacctRB.logger.warn "Net::ReadTimeout in IntacctRB; retrying"
retry
else
IntacctRB.logger.error "Net::ReadTimeout in IntacctRB; retries exhausted"
- @response = {
- result: {
- errormessage: {
- error: [{ description: e }]
- }
- }
- }
+ @response = Nokogiri::XML("<result><errormessage><error><errorno></errorno><description>#{e}</description><description2></description2></error></errormessage></result>")
end
end
end
def successful?
@@ -113,10 +107,10 @@
object: response, data: data})
else
data = OpenStruct.new({result: false, intacct_id: object.intacct_id})
data.errors = []
response.xpath("//result/errormessage/error").each do |error|
- data.errors << {
+ errors << {
code: error.at("//errorno").content,
title: error.at("//description").content,
description: error.at("//description2").content
}
end