Class: Skein::RPC::Response
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#result ⇒ Object
Properties ===========================================================.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(content = nil) ⇒ Response
constructor
Instance Methods =====================================================.
- #to_h ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(content = nil) ⇒ Response
Instance Methods =====================================================
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/skein/rpc/response.rb', line 9 def initialize(content = nil) case (content) when String data = Skein::Support.symbolize_keys(JSON.load(content)) assign_from_hash!(data) when Hash assign_from_hash!(content) when nil self.id = SecureRandom.uuid else raise Skein::RPC::InvalidPayload, 'Invalid payload type: %s' % content.class end end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
5 6 7 |
# File 'lib/skein/rpc/response.rb', line 5 def error @error end |
#result ⇒ Object
Properties ===========================================================
4 5 6 |
# File 'lib/skein/rpc/response.rb', line 4 def result @result end |
Instance Method Details
#to_h ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/skein/rpc/response.rb', line 24 def to_h { method: self.method, params: self.params, id: self.id } end |