Sha256: 3a6907d5b07dfc4b941bace47f8c538d8f1e2dd4c7f141a3b09dccd292c00f5f

Contents?: true

Size: 1.46 KB

Versions: 3

Compression:

Stored size: 1.46 KB

Contents

require 'active_support/concern'

module WashoutBuilder
  # the module that is used for soap actions to parse their definition and hold the infoirmation about
  # their arguments and return types
  module SOAP
    extend ActiveSupport::Concern
    included do
      # 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.
      # @param  [Symbol, Class]  action the action that is requested
      # @param [Hash] options  the options used for
      #
      # @return [void]
      #
      # @api public
      def soap_action(action, options = {})
        original_soap_action(action, options)

        if action.is_a?(Symbol)
          if soap_config.camelize_wsdl.to_s == 'lower'
            action = action.to_s.camelize(:lower)
          elsif soap_config.camelize_wsdl
            action = action.to_s.camelize
          end
        end

        current_action = soap_actions[action]
        base_param_class = WashoutBuilder::Type.base_param_class
        return if base_param_class.blank?
        current_action[:builder_in] = base_param_class.parse_builder_def(soap_config, options[:args])
        current_action[:builder_out] = base_param_class.parse_builder_def(soap_config, options[:return])
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
washout_builder-1.0.6 lib/washout_builder/soap.rb
washout_builder-1.0.5 lib/washout_builder/soap.rb
washout_builder-1.0.4 lib/washout_builder/soap.rb