Class: Patentscope::WebserviceSoapBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/patentscope/webservice_soap_builder.rb

Instance Method Summary collapse

Instance Method Details

#build_envelope(operation, options_hash) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/patentscope/webservice_soap_builder.rb', line 5

def build_envelope(operation, options_hash)
  builder = Nokogiri::XML::Builder.new do |xml|
    xml.Envelope do
      ns = xml.doc.root.add_namespace_definition('S', 'http://schemas.xmlsoap.org/soap/envelope/')
      xml.doc.root.namespace = ns
      xml.Body do
        xml.send(operation, :'xmlns' => 'http://www.wipo.org/wsdl/ps') do
          options_hash.each do |key, value|
            xml.send(key, value)
          end
        end
      end
    end
  end.to_xml
end