class Reactor::Cm::MultiXmlRequest::MultiXmlResponse

Public Class Methods

new(xml, mandatory, optional) click to toggle source
# File lib/reactor/cm/multi_xml_request.rb, line 91
def initialize(xml, mandatory, optional)
  @xml, @mandatory, @optional = xml, mandatory, optional
  @n = Nokogiri::XML.parse(@xml)
end

Public Instance Methods

assert_success() click to toggle source
# File lib/reactor/cm/multi_xml_request.rb, line 96
def assert_success
  first_failed = nil
  @mandatory.any? do |mandatory_id|
    @n.xpath("//cm-response[@request-id='#{mandatory_id}']//cm-code[@numeric='200']").empty? && (first_failed = mandatory_id)
  end && raise(XmlMultiRequestError, @n.xpath("//cm-response[@request-id='#{first_failed}']//cm-code//error/phrase/text()").map(&:to_s).join("\n"))
end