Class: Unfuzzle::Response

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

Overview

Response

A simple wrapper around an HTTP response from the Unfuddle API

Instance Method Summary collapse

Constructor Details

#initialize(http_response) ⇒ Response

Create a new response from an HTTP response object



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

def initialize(http_response)
  @http_response = http_response
end

Instance Method Details

#bodyObject

Raw body of the HTTP response



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

def body
  @http_response.body
end

#error?Boolean

Was there an error produced as part of the request?

Returns:

  • (Boolean)


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

def error?
  !@http_response.is_a?(Net::HTTPSuccess)
end