Class: RPC::Encoders::Json::Request
- Inherits:
-
Object
- Object
- RPC::Encoders::Json::Request
- Defined in:
- lib/rpc/lib/rpc/encoders/json.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #generate_id ⇒ Object
-
#initialize(method, params, id = self.generate_id) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(method, params, id = self.generate_id) ⇒ Request
Returns a new instance of Request.
39 40 41 42 |
# File 'lib/rpc/lib/rpc/encoders/json.rb', line 39 def initialize(method, params, id = self.generate_id) @data = {jsonrpc: JSON_RPC_VERSION, method: method, params: params} @data.merge!(id: id) unless id.nil? end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
38 39 40 |
# File 'lib/rpc/lib/rpc/encoders/json.rb', line 38 def data @data end |
Instance Method Details
#generate_id ⇒ Object
44 45 46 |
# File 'lib/rpc/lib/rpc/encoders/json.rb', line 44 def generate_id rand(999_999_999_999) end |