Class: Mylk::Response
- Inherits:
-
Object
- Object
- Mylk::Response
- Defined in:
- lib/mylk/response.rb
Overview
Response from the SurrealDB
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
8 9 10 11 12 |
# File 'lib/mylk/response.rb', line 8 def initialize(response) @result = response["result"] @status = response["status"] @time = response["time"] end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
6 7 8 |
# File 'lib/mylk/response.rb', line 6 def result @result end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/mylk/response.rb', line 6 def status @status end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
6 7 8 |
# File 'lib/mylk/response.rb', line 6 def time @time end |
Instance Method Details
#error? ⇒ Boolean
18 19 20 |
# File 'lib/mylk/response.rb', line 18 def error? !success? end |
#success? ⇒ Boolean
14 15 16 |
# File 'lib/mylk/response.rb', line 14 def success? @status == "OK" end |