Class: Amsi::DocumentParser::Base
- Inherits:
-
Object
- Object
- Amsi::DocumentParser::Base
- Defined in:
- lib/amsi/document_parser/base.rb
Overview
Base class for parsing AMSI responses. Subclasses must implement #parse_body and can optionally override #validator_classes to add more validation than just the default
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Base
constructor
A new instance of Base.
-
#parse(xml) ⇒ Object
The parsed object(s) from the response.
Constructor Details
#initialize(params = {}) ⇒ Base
Returns a new instance of Base.
11 12 13 |
# File 'lib/amsi/document_parser/base.rb', line 11 def initialize(params = {}) @params = params end |
Instance Method Details
#parse(xml) ⇒ Object
Returns the parsed object(s) from the response.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/amsi/document_parser/base.rb', line 18 def parse(xml) begin parsed_response = MultiXml.parse(xml) rescue MultiXml::ParseError => e raise Amsi::Error::UnparsableResponse, xml end validate_response!(parsed_response) parse_body(parsed_response['soap:Envelope']['soap:Body']) end |