From b94bd32f3116b469b48400382dbc964bf17994d1 Mon Sep 17 00:00:00 2001 From: Leon Breedt Date: Tue, 29 Mar 2005 12:31:39 +0000 Subject: first pass of web service scaffolding. add ability to quickly generate an action pack request for a protocol, add missing log_error when we fail to parse protocol messages. add RDoc for scaffolding and functional testing. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1037 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionwebservice/lib/action_web_service/api/base.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'actionwebservice/lib/action_web_service/api') diff --git a/actionwebservice/lib/action_web_service/api/base.rb b/actionwebservice/lib/action_web_service/api/base.rb index e440a8b1bd..03e406cfc3 100644 --- a/actionwebservice/lib/action_web_service/api/base.rb +++ b/actionwebservice/lib/action_web_service/api/base.rb @@ -284,10 +284,31 @@ module ActionWebService # :nodoc: marshaler.cast_inbound_recursive(return_value, @returns[0]) end + # String representation of this method + def to_s + fqn = "" + fqn << (@returns ? (friendly_param(@returns[0], nil) + " ") : "void ") + fqn << "#{@public_name}(" + if @expects + i = 0 + fqn << @expects.map{ |p| friendly_param(p, i+= 1) }.join(", ") + end + fqn << ")" + fqn + end + private def response_name(encoder) encoder.is_a?(WS::Encoding::SoapRpcEncoding) ? (@public_name + "Response") : @public_name end + + def friendly_param(spec, i) + name = param_name(spec, i) + type = param_type(spec) + spec = spec.values.first if spec.is_a?(Hash) + type = spec.is_a?(Array) ? (type.to_s + "[]") : type.to_s + i ? (type + " " + name) : type + end end end end -- cgit v1.2.3