Sha256: 0cd3d9858ad0dcbaf8aa92f4b71e2df0699a048347849dfab51f35be59cad60e

Contents?: true

Size: 1.57 KB

Versions: 4

Compression:

Stored size: 1.57 KB

Contents

require 'active_support/concern'

module WashOut
  module SOAP
    extend ActiveSupport::Concern

    module ClassMethods
      attr_accessor :soap_actions

      # Define a SOAP action +action+. The function has two required +options+:
      # :args and :return. Each is a type +definition+ of format described in
      # WashOut::Param#parse_def.
      #
      # An optional option :to can be passed to allow for names of SOAP actions
      # which are not valid Ruby function names.
      def soap_action(action, options={})
        if action.is_a?(Symbol)
          if soap_config.camelize_wsdl.to_s == 'lower'
            options[:to] ||= action.to_s
            action         = action.to_s.camelize(:lower)
          elsif soap_config.camelize_wsdl
            options[:to] ||= action.to_s
            action         = action.to_s.camelize
          end

        end

        default_response_tag = soap_config.camelize_wsdl ? 'Response' : '_response'
        default_response_tag = action+default_response_tag

        self.soap_actions[action] = options.merge(
          :in           => WashOut::Param.parse_def(soap_config, options[:args]),
          :request_tag  => options[:as] || action,
          :out          => WashOut::Param.parse_def(soap_config, options[:return]),
          :to           => options[:to] || action,
          :response_tag => options[:response_tag] || default_response_tag
        )
      end
    end

    included do
      include WashOut::Configurable
      include WashOut::Dispatcher
      include WashOut::WsseParams
      self.soap_actions = {}
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
wash-out-0.10.1 lib/wash_out/soap.rb
wash_out-0.11.0.beta.2 lib/wash_out/soap.rb
wash_out-0.11.0.beta.1 lib/wash_out/soap.rb
wash_out-0.10.0 lib/wash_out/soap.rb