lib/active_remote/rpc.rb in active_remote-1.8.1 vs lib/active_remote/rpc.rb in active_remote-2.0.0.rc1
- old
+ new
@@ -1,17 +1,11 @@
-require 'active_remote/serializers/protobuf'
-
module ActiveRemote
module RPC
- def self.included(klass)
- klass.class_eval do
- extend ::ActiveRemote::RPC::ClassMethods
- include ::ActiveRemote::Serializers::Protobuf
- end
- end
+ extend ActiveSupport::Concern
module ClassMethods
+
# Execute an RPC call to the remote service and return the raw response.
#
def remote_call(rpc_method, request_args)
remote = self.new
remote.execute(rpc_method, request_args)
@@ -21,11 +15,10 @@
# Return a protobuf request object for the given rpc request.
#
def request(rpc_method, request_args)
return request_args unless request_args.is_a?(Hash)
- message_class = request_type(rpc_method)
- build_message(message_class, request_args)
+ request_type(rpc_method).new(request_args)
end
# Return the class applicable to the request for the given rpc method.
#
def request_type(rpc_method)