class Reactor::Cm::XmlResponse
Attributes
xml[R]
xml_str[R]
Public Class Methods
new(xml)
click to toggle source
# File lib/reactor/cm/xml_response.rb, line 13 def initialize(xml) @xml_str = xml @xml = REXML::Document.new(xml) @handler = Reactor::ResponseHandler::XmlAttribute.new end
Public Instance Methods
ok?()
click to toggle source
# File lib/reactor/cm/xml_response.rb, line 26 def ok? xp = xpath('//cm-code') if xp.is_a?(Array) codes = xp.map { |result| result.attribute('numeric').value }.uniq return codes.size == 1 && codes.first == '200' end xp.attribute('numeric').value == '200' end
xpath(expr)
click to toggle source
# File lib/reactor/cm/xml_response.rb, line 19 def xpath(expr) arr = REXML::XPath.match(@xml, expr) return arr.first if arr.length == 1 return arr end