Class: AgentClientProtocol::RPC::Request
- Inherits:
-
Object
- Object
- AgentClientProtocol::RPC::Request
- Defined in:
- lib/agent_client_protocol/rpc.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(id:, method:, params: nil) ⇒ Request
constructor
A new instance of Request.
- #to_h(include_jsonrpc: true) ⇒ Object
Constructor Details
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
69 70 71 |
# File 'lib/agent_client_protocol/rpc.rb', line 69 def id @id end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
69 70 71 |
# File 'lib/agent_client_protocol/rpc.rb', line 69 def method @method end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
69 70 71 |
# File 'lib/agent_client_protocol/rpc.rb', line 69 def params @params end |
Instance Method Details
#to_h(include_jsonrpc: true) ⇒ Object
77 78 79 80 81 82 83 84 |
# File 'lib/agent_client_protocol/rpc.rb', line 77 def to_h(include_jsonrpc: true) payload = { "id" => id, "method" => method } payload["params"] = params unless params.nil? include_jsonrpc ? { "jsonrpc" => JSONRPC_VERSION }.merge(payload) : payload end |