Class: MoonropeClient::Response

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

Instance Method Summary collapse

Constructor Details

#initialize(request, data) ⇒ Response

Initialize a new response object

Parameters:



10
11
12
13
# File 'lib/moonrope_client/response.rb', line 10

def initialize(request, data)
  @request = request
  @data = data
end

Instance Method Details

#dataObject

Returns the data returned by the server.

Returns:

  • (Object)

    the data returned by the server



40
41
42
# File 'lib/moonrope_client/response.rb', line 40

def data
  @data['data']
end

#exception_messageObject

 @return [Strig] the string for representing this response in an exception



54
55
56
# File 'lib/moonrope_client/response.rb', line 54

def exception_message
  self.data
end

#flagsHash

Returns any flags returned by the server.

Returns:

  • (Hash)

    any flags returned by the server



33
34
35
# File 'lib/moonrope_client/response.rb', line 33

def flags
  @data['flags']
end

#statusString

Returns the status of the request returned by the server.

Returns:

  • (String)

    the status of the request returned by the server



27
28
29
# File 'lib/moonrope_client/response.rb', line 27

def status
  @data['status']
end

#success?Boolean

Is this a successful response?

Returns:

  • (Boolean)


20
21
22
# File 'lib/moonrope_client/response.rb', line 20

def success?
  false
end

#timeFloat

Returns the time the request took at the server.

Returns:

  • (Float)

    the time the request took at the server



47
48
49
# File 'lib/moonrope_client/response.rb', line 47

def time
  @data['time']
end