Class: Mylk::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/mylk/response.rb

Overview

Response from the SurrealDB

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#resultObject (readonly)

Returns the value of attribute result.



6
7
8
# File 'lib/mylk/response.rb', line 6

def result
  @result
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/mylk/response.rb', line 6

def status
  @status
end

#timeObject (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

Returns:

  • (Boolean)


18
19
20
# File 'lib/mylk/response.rb', line 18

def error?
  !success?
end

#success?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/mylk/response.rb', line 14

def success?
  @status == "OK"
end