Sha256: 12a32606014a735f8ebb526635f73da6a72dc6164077e96749b065c565296961

Contents?: true

Size: 1.44 KB

Versions: 10

Compression:

Stored size: 1.44 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 WashOut::Engine.camelize_wsdl.to_s == 'lower'
            options[:to] ||= action.to_s
            action         = action.to_s.camelize(:lower)
          elsif WashOut::Engine.camelize_wsdl
            options[:to] ||= action.to_s
            action         = action.to_s.camelize
          end
        end

        default_response_tag = WashOut::Engine.camelize_wsdl ? 'Response' : '_response'
        default_response_tag = "tns:#{action}#{default_response_tag}"

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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
wash_out-0.8.4 lib/wash_out/soap.rb
wash_out-0.8.3 lib/wash_out/soap.rb
wash_out-0.8.2 lib/wash_out/soap.rb
wash_out-0.8.1 lib/wash_out/soap.rb
wash_out-0.7.1 lib/wash_out/soap.rb
wash_out-0.7.0 lib/wash_out/soap.rb
wash_out-0.6.1 lib/wash_out/soap.rb
wash_out-0.6.0 lib/wash_out/soap.rb
wash_out-0.5.6 lib/wash_out/soap.rb
wash_out-0.5.4 lib/wash_out/soap.rb