Class: WsdlMapper::Runtime::S8rBase
- Inherits:
-
Object
- Object
- WsdlMapper::Runtime::S8rBase
- Defined in:
- lib/wsdl_mapper/runtime/s8r_base.rb
Instance Method Summary collapse
-
#build(x, envelope) ⇒ Object
Serializes the
envelopeusingx. -
#build_body(x, body) ⇒ Object
abstract
noinspection RubyUnusedLocalVariable.
-
#build_header(x, header) ⇒ Object
abstract
noinspection RubyUnusedLocalVariable.
-
#initialize(type_directory, default_namespace = nil) ⇒ S8rBase
constructor
A new instance of S8rBase.
-
#to_doc(envelope) ⇒ Nokogiri::XML::Document
Serializes the
envelopeand returns a Nokogiri::XML::Document. -
#to_xml(envelope) ⇒ String
Serializes the
envelopeand returns an XML string.
Constructor Details
#initialize(type_directory, default_namespace = nil) ⇒ S8rBase
Returns a new instance of S8rBase.
9 10 11 12 |
# File 'lib/wsdl_mapper/runtime/s8r_base.rb', line 9 def initialize(type_directory, default_namespace = nil) @type_directory = type_directory @default_namespace = default_namespace end |
Instance Method Details
#build(x, envelope) ⇒ Object
Serializes the envelope using x
33 34 35 36 37 38 |
# File 'lib/wsdl_mapper/runtime/s8r_base.rb', line 33 def build(x, envelope) x.complex(nil, ['http://schemas.xmlsoap.org/soap/envelope/', 'Envelope'], []) do |x| build_header(x, envelope.header) build_body(x, envelope.body) end end |
#build_body(x, body) ⇒ Object
This method is abstract.
noinspection RubyUnusedLocalVariable
52 53 54 |
# File 'lib/wsdl_mapper/runtime/s8r_base.rb', line 52 def build_body(x, body) raise NotImplementedError end |
#build_header(x, header) ⇒ Object
This method is abstract.
noinspection RubyUnusedLocalVariable
44 45 46 |
# File 'lib/wsdl_mapper/runtime/s8r_base.rb', line 44 def build_header(x, header) raise NotImplementedError end |
#to_doc(envelope) ⇒ Nokogiri::XML::Document
Serializes the envelope and returns a Nokogiri::XML::Document
24 25 26 27 28 |
# File 'lib/wsdl_mapper/runtime/s8r_base.rb', line 24 def to_doc(envelope) core = WsdlMapper::Serializers::SerializerCore.new resolver: @type_directory, default_namespace: @default_namespace build core, envelope core.to_doc end |
#to_xml(envelope) ⇒ String
Serializes the envelope and returns an XML string
17 18 19 |
# File 'lib/wsdl_mapper/runtime/s8r_base.rb', line 17 def to_xml(envelope) to_doc(envelope).to_xml save_with: Nokogiri::XML::Node::SaveOptions::NO_DECLARATION end |