Method: ActiveShipping::UPS#build_document

Defined in:
lib/active_shipping/carriers/ups.rb

#build_document(xml, expected_root_tag) ⇒ Object (protected)



804
805
806
807
808
809
810
811
812
# File 'lib/active_shipping/carriers/ups.rb', line 804

def build_document(xml, expected_root_tag)
  document = Nokogiri.XML(xml)
  if document.root.nil? || document.root.name != expected_root_tag
    raise ActiveShipping::ResponseContentError.new(StandardError.new('Invalid document'), xml)
  end
  document
rescue Nokogiri::XML::SyntaxError => e
  raise ActiveShipping::ResponseContentError.new(e, xml)
end