Class: Bixby::WebSocket::Response
- Defined in:
- lib/bixby-common/websocket/response.rb
Instance Attribute Summary
Attributes inherited from Message
Instance Method Summary collapse
-
#initialize(json_response, id, headers = nil) ⇒ Response
constructor
A new instance of Response.
- #json_response ⇒ Object
Methods inherited from Message
Constructor Details
#initialize(json_response, id, headers = nil) ⇒ Response
Returns a new instance of Response.
7 8 9 10 11 12 13 14 15 |
# 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) @hash[:data] = json_response.to_wire @body = MultiJson.dump(@hash) end |
Instance Method Details
#json_response ⇒ Object
17 18 19 |
# File 'lib/bixby-common/websocket/response.rb', line 17 def json_response JsonResponse.from_json(body) end |