lib/active_remote/rpc.rb in active_remote-2.1.0.beta2 vs lib/active_remote/rpc.rb in active_remote-2.1.0.rc1

- old
+ new

@@ -7,46 +7,41 @@ included do include Embedded end - # TODO: Deprecate this pattern of executing RPC calls - # module Embedded extend ActiveSupport::Concern included do include Serializers::Protobuf end module ClassMethods - # Return a protobuf request object for the given rpc request. - # - # TODO: Add deprecation warning - # + # :noapi: def request(rpc_method, request_args) + warn "DEPRECATED Model.request is deprecated and will be removed in Active Remote 3.0. This is handled by the Protobuf RPC adpater now" + return request_args unless request_args.is_a?(Hash) message_class = request_type(rpc_method) fields = fields_from_attributes(message_class, request_args) message_class.new(fields) end - # Return the class applicable to the request for the given rpc method. - # - # TODO: Add deprecation warning - # + # :noapi: def request_type(rpc_method) + warn "DEPRECATED Model.request_type is deprecated and will be removed in Active Remote 3.0. This is handled by the Protobuf RPC adpater now" + service_class.rpcs[rpc_method].request_type end end - # Invoke an RPC call to the service for the given rpc method. - # - # TODO: Add deprecation warning - # + # :noapi: def execute(rpc_method, request_args) + warn "DEPRECATED Model#execute is deprecated and will be removed in Active Remote 3.0. Use Model#rpc.execute instead" + @last_request = request(rpc_method, request_args) _service_class.client.__send__(rpc_method, @last_request) do |c| # In the event of service failure, raise the error. @@ -61,25 +56,22 @@ end @last_response end - - # Execute an RPC call to the remote service and return the raw response. - # - # TODO: Add deprecation warning - # + # :noapi: def remote_call(rpc_method, request_args) + warn "DEPRECATED Model#remote_call is deprecated and will be removed in Active Remote 3.0. Use Model#rpc.execute instead" + rpc.execute(rpc_method, request_args) end private - # Return a protobuf request object for the given rpc call. - # - # TODO: Add deprecation warning - # + # :noapi: def request(rpc_method, attributes) + warn "DEPRECATED Model#request is deprecated and will be removed in Active Remote 3.0. This is handled by the Protobuf RPC adpater now" + self.class.request(rpc_method, attributes) end end module ClassMethods