diff options
author | Leon Breedt <bitserf@gmail.com> | 2005-02-19 08:29:42 +0000 |
---|---|---|
committer | Leon Breedt <bitserf@gmail.com> | 2005-02-19 08:29:42 +0000 |
commit | 418d487020d24e69b528fdbedfecb20a87f99fcb (patch) | |
tree | 1956d6982123df1638bdef8274dff50ae71b25c2 /actionwebservice/lib/action_web_service/invocation.rb | |
parent | e7499638d06023ae493d14ec1dc4f58bad8ac168 (diff) | |
download | rails-418d487020d24e69b528fdbedfecb20a87f99fcb.tar.gz rails-418d487020d24e69b528fdbedfecb20a87f99fcb.tar.bz2 rails-418d487020d24e69b528fdbedfecb20a87f99fcb.zip |
refactoring:
* move dispatching out of the Container into Dispatcher, it makes more sense
for Container to only contain the list of web services defined
in it.
* collapse Wsdl and ActionController "routers" into
an ActionController-specific module, no advantage
to having them seperate as they were quite tightly
coupled. rename to Dispatcher, to avoi
confusion with Routing.
* add a "_thing" suffix to concept-specific filenames. this is so that
we don't end up with many soap.rb files, for example.
* remove "virtual invocation" support. adds complexity, and it doesn't
seem to add any value.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@679 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice/lib/action_web_service/invocation.rb')
-rw-r--r-- | actionwebservice/lib/action_web_service/invocation.rb | 61 |
1 files changed, 7 insertions, 54 deletions
diff --git a/actionwebservice/lib/action_web_service/invocation.rb b/actionwebservice/lib/action_web_service/invocation.rb index 64d3e8d524..62f38b8ecd 100644 --- a/actionwebservice/lib/action_web_service/invocation.rb +++ b/actionwebservice/lib/action_web_service/invocation.rb @@ -1,9 +1,5 @@ module ActionWebService # :nodoc: module Invocation # :nodoc: - ConcreteInvocation = :concrete - VirtualInvocation = :virtual - UnpublishedConcreteInvocation = :unpublished_concrete - class InvocationError < ActionWebService::ActionWebServiceError # :nodoc: end @@ -137,31 +133,15 @@ module ActionWebService # :nodoc: end end - def perform_invocation_with_interception(invocation, &block) - return if before_invocation(invocation.method_name, invocation.params, &block) == false - result = perform_invocation_without_interception(invocation) - after_invocation(invocation.method_name, invocation.params, result) - result + def perform_invocation_with_interception(method_name, params, &block) + return if before_invocation(method_name, params, &block) == false + return_value = perform_invocation_without_interception(method_name, params) + after_invocation(method_name, params, return_value) + return_value end - def perform_invocation(invocation) - if invocation.concrete? - unless self.respond_to?(invocation.method_name) && \ - self.class.web_service_api.has_api_method?(invocation.method_name) - raise InvocationError, "no such web service method '#{invocation.method_name}' on service object" - end - end - params = invocation.params - if invocation.concrete? || invocation.unpublished_concrete? - self.send(invocation.method_name, *params) - else - if invocation.block - params = invocation.block_params + params - invocation.block.call(invocation.public_method_name, *params) - else - self.send(invocation.method_name, *params) - end - end + def perform_invocation(method_name, params) + send(method_name, *params) end def before_invocation(name, args, &block) @@ -221,32 +201,5 @@ module ActionWebService # :nodoc: end end end - - class InvocationRequest # :nodoc: - attr_accessor :type - attr :public_method_name - attr_accessor :method_name - attr_accessor :params - attr_accessor :block - attr :block_params - - def initialize(type, public_method_name, method_name, params=nil) - @type = type - @public_method_name = public_method_name - @method_name = method_name - @params = params || [] - @block = nil - @block_params = [] - end - - def concrete? - @type == ConcreteInvocation ? true : false - end - - def unpublished_concrete? - @type == UnpublishedConcreteInvocation ? true : false - end - end - end end |