Module ActionWebService::Container::ActionController::ClassMethods
In: actionwebservice/lib/action_web_service/container/action_controller_container.rb

Methods

Public Instance methods

Creates a client for accessing remote web services, using the given protocol to communicate with the endpoint_uri.

Example

  class MyController < ActionController::Base
    web_client_api :blogger, :xmlrpc, "http://blogger.com/myblog/api/RPC2", :handler_name => 'blogger'
  end

In this example, a protected method named blogger will now exist on the controller, and calling it will return the XML-RPC client object for working with that remote service.

options is the set of protocol client specific options (see a protocol client class for details).

If your API definition does not exist on the load path with the correct rules for it to be found using name, you can pass in the API definition class via options, using a key of :api

[Source]

# File actionwebservice/lib/action_web_service/container/action_controller_container.rb, line 32
        def web_client_api(name, protocol, endpoint_uri, options={})
          unless method_defined?(name)
            api_klass = options.delete(:api) || require_web_service_api(name)
            class_eval do
              define_method(name) do
                create_web_service_client(api_klass, protocol, endpoint_uri, options)
              end
              protected name
            end
          end
        end

Private Instance methods

[Source]

# File actionwebservice/lib/action_web_service/container/action_controller_container.rb, line 83
          def inherited_with_api(child)
            inherited_without_api(child)
            begin child.web_service_api(child.controller_path)
            rescue MissingSourceFile => e
              raise unless e.is_missing?("apis/#{child.controller_path}_api")
            end
          end

[Validate]