Class: JsonRpcObjects::V20::Response
- Inherits:
-
JsonRpcObjects::V11::Alt::Response
- Object
- Generic::Object
- Generic::Response
- JsonRpcObjects::V10::Response
- JsonRpcObjects::V11::WD::ProcedureReturn
- JsonRpcObjects::V11::WD::Response
- JsonRpcObjects::V11::Alt::ProcedureReturn
- JsonRpcObjects::V11::Alt::Response
- JsonRpcObjects::V20::Response
- Defined in:
- lib/json-rpc-objects/v20/response.rb
Overview
Response object class.
Constant Summary collapse
- VERSION =
Holds link to its version module.
JsonRpcObjects::V20
- ERROR_CLASS =
Identifies the error object class.
JsonRpcObjects::V20::Error
- VERSION_NUMBER =
Holds JSON-RPC version specification.
"2.0"
- VERSION_MEMBER =
Holds JSON-RPC version member identification.
"jsonrpc"
Instance Attribute Summary
Attributes included from JsonRpcObjects::V11::WD::Extensions
Attributes inherited from JsonRpcObjects::V10::Response
Attributes inherited from Generic::Object
Instance Method Summary collapse
-
#check! ⇒ Object
Checks correctness of the request data.
-
#output ⇒ Hash
Renders data to output hash.
Methods included from JsonRpcObjects::V11::WD::Extensions
Methods inherited from JsonRpcObjects::V10::Response
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.
60 61 62 63 64 65 66 |
# File 'lib/json-rpc-objects/v20/response.rb', line 60 def check! super() if not [Symbol, String, Integer, NilClass].any?{ |cl| @id.kind_of?(cl) } raise Exception::new("ID must contain Symbol, String, Number or nil if included.") end end |
#output ⇒ Hash
Renders data to output hash.
73 74 75 76 77 78 79 80 81 |
# File 'lib/json-rpc-objects/v20/response.rb', line 73 def output result = super() if @_id_set and @id.nil? result["id"] = nil end return result end |