Sha256: 0e76b3faab715327b04ba8109fa56786fe06cf0052da15854d111a1a3da26bcd

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

module LolSoap
  # Represents a HTTP request containing a SOAP Envelope
  class Request
    attr_reader :envelope

    def initialize(envelope)
      @envelope = envelope
    end

    # @see Envelope#body
    def body(&block)
      envelope.body(&block)
    end

    # @see Envelope#header
    def header(&block)
      envelope.header(&block)
    end

    # Namespace used for SOAP envelope tags
    def soap_namespace
      envelope.soap_namespace
    end

    # URL to be POSTed to
    def url
      envelope.endpoint
    end

    # The type of the element sent in the request body
    def input_type
      envelope.input_type
    end

    # The type of the element that will be received in the response body
    def output_type
      envelope.output_type
    end

    # Headers that must be set when making the request
    def headers
      {
        'Content-Type'   => 'application/soap+xml;charset=UTF-8',
        'Content-Length' => content.bytesize.to_s,
        'SOAPAction'     => envelope.action
      }
    end

    # The content to be sent in the HTTP request
    def content
      @content ||= envelope.to_xml
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lolsoap-0.1.2 lib/lolsoap/request.rb
lolsoap-0.1.1 lib/lolsoap/request.rb
lolsoap-0.1.0 lib/lolsoap/request.rb