class GlobalSign::RequestXmlBuilder

Public Class Methods

build_xml(action:, params:) click to toggle source
# File lib/global_sign/request_xml_builder.rb, line 11
def build_xml(action:, params:)
  xml = xml_envelope(action).at('//Request') << xml_body(params).root.elements

  builder = Nokogiri::XML::Builder.with(xml)
  builder.doc.root.to_xml
end
xml_body(params) click to toggle source
# File lib/global_sign/request_xml_builder.rb, line 34
def xml_body(params)
  Nokogiri.XML(params.to_xml) do |configuration|
    configuration.default_xml.noblanks
  end
end
xml_envelope(action) click to toggle source
# File lib/global_sign/request_xml_builder.rb, line 18
      def xml_envelope(action)
        Nokogiri::XML(
          <<-EOS
<soap:Envelope xmlns:soap=\"#{XmlNamespace::BODY}\" xmlns:ns2=\"#{XmlNamespace::ACTION}\">
  <soap:Body>
    <ns2:#{action}>
      <Request/>
    </ns2:#{action}>
  </soap:Body>
</soap:Envelope>
          EOS
        ) do |configuration|
          configuration.default_xml.noblanks
        end
      end