Class: JsonRpcObjects::V20::Error
- Inherits:
-
JsonRpcObjects::V11::Alt::Error
- Object
- Generic::Object
- Generic::Error
- JsonRpcObjects::V10::Error
- JsonRpcObjects::V11::WD::Error
- JsonRpcObjects::V11::Alt::Error
- JsonRpcObjects::V20::Error
- Defined in:
- lib/json-rpc-objects/v20/error.rb
Overview
Error description object class for Response.
Constant Summary collapse
- VERSION =
Holds link to its version module.
JsonRpcObjects::V20
- DATA_MEMBER_NAME =
Indicates data member name.
:data
Instance Attribute Summary
Attributes inherited from JsonRpcObjects::V11::WD::Error
Attributes included from JsonRpcObjects::V11::WD::Extensions
Attributes inherited from JsonRpcObjects::V10::Error
Attributes inherited from Generic::Object
Instance Method Summary collapse
-
#check! ⇒ Object
Checks correctness of the data.
-
#output ⇒ Hash
Renders data to output hash.
Methods inherited from JsonRpcObjects::V11::WD::Error
Methods included from JsonRpcObjects::V11::WD::Extensions
Methods inherited from JsonRpcObjects::V10::Error
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 data.
42 43 44 45 46 47 48 |
# File 'lib/json-rpc-objects/v20/error.rb', line 42 def check! self.normalize! if (@code.in? -32768..-32000) and not ((@code == -32700) or (@code.in? -32603..-32600) or (@code.in? -32099..-32000)) raise Exception::new("Code is invalid because of reserved space.") end end |
#output ⇒ Hash
Renders data to output hash.
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/json-rpc-objects/v20/error.rb', line 55 def output result = super() if result.include? "error" result["data"] = result["error"] result.delete("error") end return result end |