Class: QRPC::Protocol::Object::Response

Inherits:
Abstract::Response show all
Defined in:
lib/qrpc/protocol/object/response.rb

Overview

Object response implementation.

Since:

  • 0.9.0

Instance Attribute Summary

Attributes inherited from Abstract::Object

#options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract::Response

#initialize

Methods inherited from Abstract::Object

#assign_options, #initialize

Constructor Details

This class inherits a constructor from QRPC::Protocol::Abstract::Response

Class Method Details

.parse(raw) ⇒ Response

Parses the data for new object.

Since:

  • 0.9.0



41
42
43
# File 'lib/qrpc/protocol/object/response.rb', line 41

def self.parse(raw)
    self::new(raw.options)
end

Instance Method Details

#errorException

Returns response error.

Since:

  • 0.9.0



77
78
79
# File 'lib/qrpc/protocol/object/response.rb', line 77

def error
    @options.error
end

#error?Boolean

Indicates, error state of the response.

Since:

  • 0.9.0



68
69
70
# File 'lib/qrpc/protocol/object/response.rb', line 68

def error?
    not self.error.nil?
end

#idObject

Returns ID of the response.

Since:

  • 0.9.0



59
60
61
# File 'lib/qrpc/protocol/object/response.rb', line 59

def id
    @options.request.id
end

#resultObject

Returns response result.

Since:

  • 0.9.0



86
87
88
# File 'lib/qrpc/protocol/object/response.rb', line 86

def result
    @options.result
end

#serializeResponse

Serializes object to the resultant form.

Since:

  • 0.9.0



50
51
52
# File 'lib/qrpc/protocol/object/response.rb', line 50

def serialize
    self
end