class Amazon::Coral::Call
Public Class Methods
new(dispatcher)
click to toggle source
Create a new Call
object tied to a specific Dispatcher
.
# File lib/amazon/coral/call.rb, line 12 def initialize(dispatcher) @dispatcher = dispatcher @identity = {} @request_id = nil end
Public Instance Methods
call(input = {})
click to toggle source
Invoke the remote service and return the result.
# File lib/amazon/coral/call.rb, line 41 def call(input = {}) begin @request_id = UUIDTools::UUID.random_create if @request_id.nil? return @dispatcher.dispatch(self, input) rescue Timeout::Error => timeout return { "Error" => { "Type" => "Receiver", "Code" => "Timeout", "Details" => timeout } } rescue Exception => e return { "Error" => { "Type" => "Sender", "Code" => "InternalFailure", "Details" => e } } end end
identity()
click to toggle source
Retrieve the hash of identity information for the outgoing request. The returned hash is mutable such that callers may add or remove identity information from it.
# File lib/amazon/coral/call.rb, line 26 def identity @identity end
identity=(i)
click to toggle source
Specify a hash containing identity information for the outgoing request. This is protocol specific but typically contains account names, certificates or other credentials.
# File lib/amazon/coral/call.rb, line 20 def identity=(i) @identity = i.to_hash end
request_id()
click to toggle source
Retrieve the request ID returned by the remote service.
# File lib/amazon/coral/call.rb, line 36 def request_id @request_id end
request_id=(r)
click to toggle source
Specify the request ID to attach to the outgoing request. (Internal only)
# File lib/amazon/coral/call.rb, line 31 def request_id=(r) @request_id = r end