Class: ESortCode::Response::Base
- Inherits:
-
Object
- Object
- ESortCode::Response::Base
show all
- Defined in:
- lib/esortcode/response/base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(xml_data) ⇒ Base
Returns a new instance of Base.
6
7
8
|
# File 'lib/esortcode/response/base.rb', line 6
def initialize(xml_data)
@xml = REXML::Document.new(xml_data)
end
|
Instance Method Details
#error ⇒ Object
24
25
26
27
28
|
# File 'lib/esortcode/response/base.rb', line 24
def error
if has_error?
@error ||= (message_from(@xml.get_text('*/ErrorMessage')))
end
end
|
#has_error? ⇒ Boolean
20
21
22
|
# File 'lib/esortcode/response/base.rb', line 20
def has_error?
@has_error ||= (@xml.get_text('*/IsError') == 'true')
end
|
#invalid_message ⇒ Object
14
15
16
17
18
|
# File 'lib/esortcode/response/base.rb', line 14
def invalid_message
unless valid?
@invalid_message ||= (message_from(@xml.get_text('*/ValidationMessage')))
end
end
|
#valid? ⇒ Boolean
10
11
12
|
# File 'lib/esortcode/response/base.rb', line 10
def valid?
@valid ||= (@xml.get_text('*/ValidationMessage') == 'VALID')
end
|