class RmsWebService::Response::Item::Parser

Attributes

status[RW]

Public Class Methods

new(xml) click to toggle source
# File lib/rms_web_service/response/item/parser.rb, line 8
def initialize(xml)
  @parsed_xml = Nokogiri::XML.parse(xml)
  @status = Item::Status.new(xml)
  @code = @parsed_xml.xpath("//code").first.content if @parsed_xml.xpath("//code").present?
  @errors = []
  @parsed_xml.xpath("//errorMessages").children.each {|error| @errors << Error.parse(error.to_s)} if @parsed_xml.xpath("//errorMessages").present?
end

Public Instance Methods

set_attribute(name, content) click to toggle source
# File lib/rms_web_service/response/item/parser.rb, line 20
def set_attribute(name, content)
  self.define_singleton_method(name.underscore) {content}
end
set_attributes(args) click to toggle source
# File lib/rms_web_service/response/item/parser.rb, line 16
def set_attributes(args)
  args.each {|s| set_attribute(s.name, s.content)}
end