Class: Isomorfeus::Transport::ResponseAgent

Inherits:
Object
  • Object
show all
Defined in:
lib/isomorfeus/transport/response_agent.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent_id, request) ⇒ ResponseAgent

Returns a new instance of ResponseAgent.



10
11
12
13
# File 'lib/isomorfeus/transport/response_agent.rb', line 10

def initialize(agent_id, request)
  @agent_id = agent_id
  @request = request
end

Instance Attribute Details

#agent_idObject (readonly)

Returns the value of attribute agent_id.



4
5
6
# File 'lib/isomorfeus/transport/response_agent.rb', line 4

def agent_id
  @agent_id
end

#agent_resultObject

Returns the value of attribute agent_result.



6
7
8
# File 'lib/isomorfeus/transport/response_agent.rb', line 6

def agent_result
  @agent_result
end

#errorObject

Returns the value of attribute error.



8
9
10
# File 'lib/isomorfeus/transport/response_agent.rb', line 8

def error
  @error
end

#outer_resultObject

Returns the value of attribute outer_result.



7
8
9
# File 'lib/isomorfeus/transport/response_agent.rb', line 7

def outer_result
  @outer_result
end

#requestObject (readonly)

Returns the value of attribute request.



5
6
7
# File 'lib/isomorfeus/transport/response_agent.rb', line 5

def request
  @request
end

Instance Method Details

#resultObject



15
16
17
18
19
20
# File 'lib/isomorfeus/transport/response_agent.rb', line 15

def result
  return { response: { agent_ids: { @agent_id => @error }}} if @error
  response = { response: { agent_ids: { @agent_id => @agent_result }}}
  response.deep_merge!(@outer_result) if @outer_result
  return response
end