Class: Mondo::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resp) ⇒ Response

Initializes a Response instance

Parameters:

  • response (Faraday::Response)

    The Faraday response instance



9
10
11
12
# File 'lib/api/mondo/response.rb', line 9

def initialize(resp)
  @response = resp
  @parsed = -> { MultiJson.load(body) rescue body }.call
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



4
5
6
# File 'lib/api/mondo/response.rb', line 4

def error
  @error
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/api/mondo/response.rb', line 4

def options
  @options
end

#parsedObject (readonly)

Returns the value of attribute parsed.



3
4
5
# File 'lib/api/mondo/response.rb', line 3

def parsed
  @parsed
end

#responseObject (readonly)

Returns the value of attribute response.



3
4
5
# File 'lib/api/mondo/response.rb', line 3

def response
  @response
end

Instance Method Details

#bodyObject

The HTTP response body



25
26
27
# File 'lib/api/mondo/response.rb', line 25

def body
  response.body || ''
end

#headersObject

The HTTP response headers



15
16
17
# File 'lib/api/mondo/response.rb', line 15

def headers
  response.headers
end

#statusObject

The HTTP response status code



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

def status
  response.status
end