Class: JSONRPCOverMQTT::JSONRPC::Request
- Inherits:
-
Object
- Object
- JSONRPCOverMQTT::JSONRPC::Request
- Defined in:
- lib/json_rpc_over_mqtt_example/json_rpc/request.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(message) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(message) ⇒ Request
Returns a new instance of Request.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/json_rpc_over_mqtt_example/json_rpc/request.rb', line 8 def initialize() json_rpc_obj = JSON.parse() @id = json_rpc_obj["id"] @method = json_rpc_obj["method"] if json_rpc_obj["params"].nil? @params = nil else @params = Hash[json_rpc_obj["params"].map{ |k,v| [k.to_sym, v] }] end end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/json_rpc_over_mqtt_example/json_rpc/request.rb', line 6 def id @id end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
6 7 8 |
# File 'lib/json_rpc_over_mqtt_example/json_rpc/request.rb', line 6 def method @method end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'lib/json_rpc_over_mqtt_example/json_rpc/request.rb', line 6 def params @params end |