Module: ActiveRemote::RPC::ClassMethods

Defined in:
lib/active_remote/rpc.rb

Instance Method Summary collapse

Instance Method Details

#remote_call(rpc_method, request_args) ⇒ Object

Execute an RPC call to the remote service and return the raw response.



15
16
17
18
19
# File 'lib/active_remote/rpc.rb', line 15

def remote_call(rpc_method, request_args)
  remote = self.new
  remote.execute(rpc_method, request_args)
  remote.last_response
end

#request(rpc_method, request_args) ⇒ Object

Return a protobuf request object for the given rpc request.



23
24
25
26
27
28
# File 'lib/active_remote/rpc.rb', line 23

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)
end

#request_type(rpc_method) ⇒ Object

Return the class applicable to the request for the given rpc method.



32
33
34
# File 'lib/active_remote/rpc.rb', line 32

def request_type(rpc_method)
  service_class.rpcs[rpc_method].request_type
end