Class: DSP::Response
Overview
interface Response extends ProtocolMessage {
/** Sequence number of the corresponding request. */
request_seq: number;
/** Outcome of the request.
If true, the request was successful and the 'body' attribute may contain the result of the request.
If the value is false, the attribute 'message' contains the error in short form and the 'body' may contain additional information (see 'ErrorResponse.body.error').
*/
success: boolean;
/** The command requested. */
command: string;
/** Contains the raw error in short form if 'success' is false.
This raw error might be interpreted by the frontend and is not shown in the UI.
Some predefined values exist.
Values:
'cancelled': request was cancelled.
etc.
*/
message?: string;
/** Contains request result if success is true and optional error details if success is false. */
body?: any;
}
Instance Attribute Summary collapse
-
#body ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string.
-
#command ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string.
-
#message ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string.
-
#request_seq ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string.
-
#seq ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string.
-
#success ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string.
-
#type ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string.
Instance Method Summary collapse
- #from_h!(value) ⇒ Object
-
#initialize(initial_hash = nil) ⇒ Response
constructor
A new instance of Response.
Methods inherited from DSPBase
Constructor Details
#initialize(initial_hash = nil) ⇒ Response
Returns a new instance of Response.
103 104 105 106 |
# File 'lib/dsp/dsp_protocol.rb', line 103 def initialize(initial_hash = nil) super @optional_method_names = %i[message body] end |
Instance Attribute Details
#body ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string
101 102 103 |
# File 'lib/dsp/dsp_protocol.rb', line 101 def body @body end |
#command ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string
101 102 103 |
# File 'lib/dsp/dsp_protocol.rb', line 101 def command @command end |
#message ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string
101 102 103 |
# File 'lib/dsp/dsp_protocol.rb', line 101 def @message end |
#request_seq ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string
101 102 103 |
# File 'lib/dsp/dsp_protocol.rb', line 101 def request_seq @request_seq end |
#seq ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string
101 102 103 |
# File 'lib/dsp/dsp_protocol.rb', line 101 def seq @seq end |
#success ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string
101 102 103 |
# File 'lib/dsp/dsp_protocol.rb', line 101 def success @success end |
#type ⇒ Object
type: number # type: boolean # type: string # type: string # type: any # type: number # type: string
101 102 103 |
# File 'lib/dsp/dsp_protocol.rb', line 101 def type @type end |
Instance Method Details
#from_h!(value) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/dsp/dsp_protocol.rb', line 108 def from_h!(value) value = {} if value.nil? self.request_seq = value['request_seq'] self.success = value['success'] # Unknown type self.command = value['command'] self. = value['message'] self.body = value['body'] self.seq = value['seq'] self.type = value['type'] self end |