Class: Bixby::WebSocket::Response

Inherits:
Message
  • Object
show all
Defined in:
lib/bixby-common/websocket/response.rb

Instance Attribute Summary

Attributes inherited from Message

#body, #headers, #id, #type

Instance Method Summary collapse

Methods inherited from Message

from_wire, #to_s, #to_wire

Constructor Details

#initialize(json_response, id, headers = nil) ⇒ Response

Returns a new instance of Response.



7
8
9
10
11
12
13
14
# File 'lib/bixby-common/websocket/response.rb', line 7

def initialize(json_response, id, headers=nil)
  if json_response.respond_to? :headers then
    headers = json_response.headers
  end
  super(id, "rpc_result", headers)

  @body = json_response.to_wire
end

Instance Method Details

#json_responseObject



16
17
18
# File 'lib/bixby-common/websocket/response.rb', line 16

def json_response
  JsonResponse.from_json(body)
end