Class: WSDL::Response::Parser Private
- Inherits:
-
Object
- Object
- WSDL::Response::Parser
- Defined in:
- lib/wsdl/response/parser.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Parses XML responses into Ruby Hash structures with optional schema support.
Defined Under Namespace
Classes: QName
Instance Attribute Summary collapse
- #local ⇒ String readonly
- #namespace ⇒ String? readonly
Class Method Summary collapse
-
.parse(xml, schema: nil, unwrap: false) ⇒ Hash, Object
private
Parses XML into a nested hash.
Instance Method Summary collapse
-
#convert_node(node) ⇒ Hash
private
Parsed node.
-
#initialize(schema: nil, coercer: TypeCoercer) ⇒ Parser
constructor
private
A new instance of Parser.
Constructor Details
#initialize(schema: nil, coercer: TypeCoercer) ⇒ Parser
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Parser.
49 50 51 52 |
# File 'lib/wsdl/response/parser.rb', line 49 def initialize(schema: nil, coercer: TypeCoercer) @schema = schema @coercer = coercer end |
Instance Attribute Details
#local ⇒ String (readonly)
19 |
# File 'lib/wsdl/response/parser.rb', line 19 QName = Data.define(:namespace, :local) |
#namespace ⇒ String? (readonly)
19 |
# File 'lib/wsdl/response/parser.rb', line 19 QName = Data.define(:namespace, :local) |
Class Method Details
.parse(xml, schema: nil, unwrap: false) ⇒ Hash, Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses XML into a nested hash.
28 29 30 31 32 33 34 |
# File 'lib/wsdl/response/parser.rb', line 28 def parse(xml, schema: nil, unwrap: false) node = resolve_node(xml) return {} unless node parsed = new(schema:).convert_node(node) unwrap ? parsed.values.first : parsed end |
Instance Method Details
#convert_node(node) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns parsed node.
56 57 58 59 60 |
# File 'lib/wsdl/response/parser.rb', line 56 def convert_node(node) key = node.name.to_sym value = @schema ? convert_with_schema(node, @schema) : convert_without_schema(node) { key => value } end |