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.



82
83
84
# File 'lib/active_remote/rpc.rb', line 82

def remote_call(rpc_method, request_args)
  rpc.execute(rpc_method, request_args)
end

#rpcObject



86
87
88
# File 'lib/active_remote/rpc.rb', line 86

def rpc
  rpc_adapter.new(service_class)
end

#rpc_adapterObject



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/active_remote/rpc.rb', line 90

def rpc_adapter
  # TODO: Make this pluggable
  #
  # raise(AdapterNotSpecified, "configuration does not specify adapter") unless adapter.present?
  #
  # path_to_adapter = "active_remote/rpc_adapters/#{adapter}_adapter"
  #
  # begin
  #   require path_to_adapter
  # rescue Gem::LoadError => e
  #   raise Gem::LoadError, "Specified '#{adapter]}' for RPC adapter, but the gem is not loaded. Add `gem '#{e.name}'` to your Gemfile (and ensure its version is at the minimum required by ActiveRemote)."
  # rescue LoadError => e
  #   raise LoadError, "Could not load '#{path_to_adapter}'. Make sure that the adapter is valid. If you use an adapter other than 'protobuf' add the necessary adapter gem to the Gemfile.", e.backtrace
  # end
  #
  # path_to_adapter.classify.constantize

  RPCAdapters::ProtobufAdapter
end