Class: Bixby::WebSocket::Request

Inherits:
Message
  • Object
show all
Defined in:
lib/bixby-common/websocket/request.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_request, id = nil, type = "rpc", headers = nil) ⇒ Request

Returns a new instance of Request.



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

def initialize(json_request, id=nil, type="rpc", headers=nil)
  if json_request.respond_to? :headers then
    headers = json_request.headers
  end
  super(id, type, headers)

  @body = json_request.to_wire
end

Instance Method Details

#json_requestObject



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

def json_request
  JsonRequest.from_json(body)
end