Class: JsonRpcObjects::V20::Request
- Inherits:
-
JsonRpcObjects::V11::Alt::Request
- Object
- Generic::Object
- Generic::Request
- JsonRpcObjects::V10::Request
- JsonRpcObjects::V11::WD::ProcedureCall
- JsonRpcObjects::V11::WD::Request
- JsonRpcObjects::V11::Alt::ProcedureCall
- JsonRpcObjects::V11::Alt::Request
- JsonRpcObjects::V20::Request
- Defined in:
- lib/json-rpc-objects/v20/request.rb
Overview
Request object class.
Constant Summary collapse
- VERSION =
Holds link to its version module.
JsonRpcObjects::V20
- VERSION_NUMBER =
Holds JSON-RPC version specification.
"2.0"
- VERSION_MEMBER =
Holds JSON-RPC version member identification.
"jsonrpc"
Instance Attribute Summary
Attributes inherited from JsonRpcObjects::V11::WD::ProcedureCall
Attributes included from JsonRpcObjects::V11::WD::Extensions
Attributes inherited from JsonRpcObjects::V10::Request
Attributes inherited from Generic::Object
Instance Method Summary collapse
-
#check! ⇒ Object
Checks correctness of the request data.
-
#notification? ⇒ Boolean
Indicates, it’s notification.
-
#output ⇒ Hash
Renders data to output hash.
Methods included from JsonRpcObjects::V11::WD::Extensions
Methods inherited from JsonRpcObjects::V10::Request
Methods inherited from Generic::Object
create, #initialize, parse, #serialize, #to_json, version
Constructor Details
This class inherits a constructor from JsonRpcObjects::Generic::Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class JsonRpcObjects::V11::WD::Extensions
Instance Method Details
#check! ⇒ Object
Checks correctness of the request data.
54 55 56 57 58 59 60 |
# File 'lib/json-rpc-objects/v20/request.rb', line 54 def check! super() if not @id.kind_of_any? [Symbol, String, Integer, NilClass] raise Exception::new("ID must contain Symbol, String, Number or nil if included.") end end |
#notification? ⇒ Boolean
Indicates, it’s notification.
82 83 84 |
# File 'lib/json-rpc-objects/v20/request.rb', line 82 def notification? not @_id_set end |
#output ⇒ Hash
Renders data to output hash.
67 68 69 70 71 72 73 74 75 |
# File 'lib/json-rpc-objects/v20/request.rb', line 67 def output result = super() if @_id_set and @id.nil? result["id"] = nil end return result end |