Class: JsonRpcObjects::V11::WD::ProcedureReturn

Inherits:
JsonRpcObjects::V10::Response show all
Includes:
Extensions
Defined in:
lib/json-rpc-objects/v11/wd/procedure-return.rb

Overview

Procedure return (response) class.

Direct Known Subclasses

Response

Constant Summary collapse

VERSION =

Holds link to its version module.

JsonRpcObjects::V11::WD
VERSION_NUMBER =

Holds JSON-RPC version specification.

"1.1"
VERSION_MEMBER =

Holds JSON-RPC version member identification.

"version"
ERROR_CLASS =

Identifies the error object class.

JsonRpcObjects::V11::WD::Error

Instance Attribute Summary

Attributes included from Extensions

#extensions

Attributes inherited from JsonRpcObjects::V10::Response

#error, #id, #result

Attributes inherited from Generic::Object

#serializer

Instance Method Summary collapse

Methods included from Extensions

#[], #[]=, #method_missing

Methods inherited from JsonRpcObjects::V10::Response

#<<, create, #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 request data.



64
65
66
67
68
69
# File 'lib/json-rpc-objects/v11/wd/procedure-return.rb', line 64

def check!
    self.normalize!
    
    __check_coherency
    __check_error
end

#outputHash

Renders data to output hash.

Returns:

  • (Hash)

    with data of return



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/json-rpc-objects/v11/wd/procedure-return.rb', line 76

def output
    self.check!
    
    data = { }
    __assign_version(data)
    
    if not @result.nil?
        data["result"] = @result
    end
    
    if not @error.nil?
        data["error"] = @error.output
    end

    if not @id.nil?
        data["id"] = @id
    end

    data.merge! Utils::Hash.map_keys(@extensions) { |k| k.to_s }
    return data
end