Class: Arbetsformedlingen::SOAPBuilder
- Inherits:
-
Object
- Object
- Arbetsformedlingen::SOAPBuilder
- Defined in:
- lib/arbetsformedlingen/soap_builder.rb
Overview
SOAP Envelope XML builder
Constant Summary collapse
- SOAP_ATTRIBUTES =
SOAP attributes
{ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema', 'xmlns:soap12' => 'http://www.w3.org/2003/05/soap-envelope', }.freeze
Class Method Summary collapse
-
.wrap(&block) ⇒ Object
Wrap block.
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ SOAPBuilder
constructor
Initialize object.
- #to_xml ⇒ Object
-
#wrap ⇒ SOAPBuilder
Wrap block in SOAP envelope.
Constructor Details
#initialize {|_self| ... } ⇒ SOAPBuilder
Initialize object
22 23 24 25 26 27 |
# File 'lib/arbetsformedlingen/soap_builder.rb', line 22 def initialize @builder = Builder::XmlMarkup.new(indent: 2) @builder.instruct! yield self if block_given? end |
Class Method Details
.wrap(&block) ⇒ Object
Wrap block
17 18 19 |
# File 'lib/arbetsformedlingen/soap_builder.rb', line 17 def self.wrap(&block) new.wrap(&block) end |
Instance Method Details
#to_xml ⇒ Object
39 40 41 |
# File 'lib/arbetsformedlingen/soap_builder.rb', line 39 def to_xml @builder.target! end |
#wrap ⇒ SOAPBuilder
Wrap block in SOAP envelope
31 32 33 34 35 36 37 |
# File 'lib/arbetsformedlingen/soap_builder.rb', line 31 def wrap @builder.soap12(:Envelope, SOAP_ATTRIBUTES) do |envelope| envelope.soap12(:Body) { |body| yield(body) } end self end |