Class: PayXML::Error

Inherits:
Message show all
Defined in:
lib/payxml/error.rb

Overview

Wraps an error message from the API.

Constant Summary

Constants inherited from Message

Message::PAYXML_VERSION_NUMBER

Instance Attribute Summary collapse

Attributes inherited from Message

#paygate_id, #paygate_password

Instance Method Summary collapse

Methods inherited from Message

#initialize, #xml_string

Constructor Details

This class inherits a constructor from PayXML::Message

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



6
7
8
# File 'lib/payxml/error.rb', line 6

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



7
8
9
# File 'lib/payxml/error.rb', line 7

def description
  @description
end

Instance Method Details

#parse(xml_string) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/payxml/error.rb', line 9

def parse(xml_string)
  super(xml_string)

  doc = Nokogiri::XML(xml_string)
  errorrx = doc.xpath("//errorrx").first

  @code = errorrx['ecode']
  @description = errorrx['edesc']
end