Class: Aria2Driver::JsonRpc::Request
- Inherits:
-
Object
- Object
- Aria2Driver::JsonRpc::Request
- Defined in:
- lib/aria2_driver/json_rpc/request.rb
Constant Summary collapse
- DEFAULT_PATH =
'/jsonrpc'- JSON_RPC_VERSION =
'2.0'
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#rpc_method ⇒ Object
readonly
Returns the value of attribute rpc_method.
Instance Method Summary collapse
-
#initialize(rpc_method, options = {}) ⇒ Request
constructor
A new instance of Request.
- #to_hash ⇒ Object
Constructor Details
#initialize(rpc_method, options = {}) ⇒ Request
Returns a new instance of Request.
13 14 15 16 17 |
# File 'lib/aria2_driver/json_rpc/request.rb', line 13 def initialize(rpc_method, ={}) @path = [:path] || DEFAULT_PATH @rpc_method = rpc_method @params = [:params] || [] end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
11 12 13 |
# File 'lib/aria2_driver/json_rpc/request.rb', line 11 def params @params end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'lib/aria2_driver/json_rpc/request.rb', line 11 def path @path end |
#rpc_method ⇒ Object (readonly)
Returns the value of attribute rpc_method.
11 12 13 |
# File 'lib/aria2_driver/json_rpc/request.rb', line 11 def rpc_method @rpc_method end |
Instance Method Details
#to_hash ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/aria2_driver/json_rpc/request.rb', line 19 def to_hash { jsonrpc: JSON_RPC_VERSION, method: rpc_method, params: params } end |