Class: AuthorizeNet::Response
- Inherits:
-
Object
- Object
- AuthorizeNet::Response
- Defined in:
- lib/authorize_net/response.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#messages ⇒ Object
Returns the value of attribute messages.
-
#parsed_xml ⇒ Object
Returns the value of attribute parsed_xml.
-
#raw_xml ⇒ Object
Returns the value of attribute raw_xml.
-
#result ⇒ Object
Returns the value of attribute result.
Class Method Summary collapse
-
.parseXml(xml) ⇒ Object
Returns a populated response object =============================================.
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
6 7 8 |
# File 'lib/authorize_net/response.rb', line 6 def errors @errors end |
#messages ⇒ Object
Returns the value of attribute messages.
7 8 9 |
# File 'lib/authorize_net/response.rb', line 7 def @messages end |
#parsed_xml ⇒ Object
Returns the value of attribute parsed_xml.
9 10 11 |
# File 'lib/authorize_net/response.rb', line 9 def parsed_xml @parsed_xml end |
#raw_xml ⇒ Object
Returns the value of attribute raw_xml.
8 9 10 |
# File 'lib/authorize_net/response.rb', line 8 def raw_xml @raw_xml end |
#result ⇒ Object
Returns the value of attribute result.
5 6 7 |
# File 'lib/authorize_net/response.rb', line 5 def result @result end |
Class Method Details
.parseXml(xml) ⇒ Object
Returns a populated response object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/authorize_net/response.rb', line 18 def parseXml(xml) response = new response.raw_xml = xml response.parsed_xml = Nokogiri::XML.parse(xml) response.result = AuthorizeNet::Util.getXmlValue(response.parsed_xml, "resultCode") errors = response.parsed_xml.at_css("errors") if !errors.nil? response.errors = [] errors.css("error").each do |xml_error| response.errors << { :code => AuthorizeNet::Util.getXmlValue(xml_error, "errorCode"), :text => AuthorizeNet::Util.getXmlValue(xml_error, "errorText"), } end end = response.parsed_xml.at_css("messages") if !.nil? response. = [] .css("message").each do |xml_msg| response. << { :code => AuthorizeNet::Util.getXmlValue(xml_msg, "code"), :text => AuthorizeNet::Util.getXmlValue(xml_msg, "text"), } end end return response end |