Module | ActionWebService::Container::ActionController::ClassMethods |
In: |
vendor/rails/actionwebservice/lib/action_web_service/container/action_controller_container.rb
|
Creates a client for accessing remote web services, using the given protocol to communicate with the endpoint_uri.
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
# File vendor/rails/actionwebservice/lib/action_web_service/container/action_controller_container.rb, line 32 32: def web_client_api(name, protocol, endpoint_uri, options={}) 33: unless method_defined?(name) 34: api_klass = options.delete(:api) || require_web_service_api(name) 35: class_eval do 36: define_method(name) do 37: create_web_service_client(api_klass, protocol, endpoint_uri, options) 38: end 39: protected name 40: end 41: end 42: end