Class: RemoteService::Call

Inherits:
Object
  • Object
show all
Defined in:
lib/remote_service/call.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(queue, action, params, timeout:) ⇒ Call

Returns a new instance of Call.



5
6
7
8
9
10
# File 'lib/remote_service/call.rb', line 5

def initialize(queue, action, params, timeout:)
  @queue = queue
  @action = action
  @params = params
  @timeout = (timeout || 10) / 1000.0
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



3
4
5
# File 'lib/remote_service/call.rb', line 3

def action
  @action
end

#paramsObject (readonly)

Returns the value of attribute params.



3
4
5
# File 'lib/remote_service/call.rb', line 3

def params
  @params
end

#queueObject (readonly)

Returns the value of attribute queue.



3
4
5
# File 'lib/remote_service/call.rb', line 3

def queue
  @queue
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



3
4
5
# File 'lib/remote_service/call.rb', line 3

def timeout
  @timeout
end

Instance Method Details

#run(&block) ⇒ Object



12
13
14
15
# File 'lib/remote_service/call.rb', line 12

def run(&block)
  return call_service_synchronously if !block_given?
  call_service(&block)
end