Class: GData::HTTP::Response

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

Overview

An extremely simple class to hold the values of an HTTP response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyObject

The body of the HTTP response.



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

def body
  @body
end

#headersObject

The headers of the HTTP response.



29
30
31
# File 'lib/gdata/http/response.rb', line 29

def headers
  @headers
end

#status_codeObject

The HTTP response code.



25
26
27
# File 'lib/gdata/http/response.rb', line 25

def status_code
  @status_code
end

Instance Method Details

#to_xmlObject

Converts the response body into a REXML::Document



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/gdata/http/response.rb', line 32

def to_xml
  if @body
    begin
      return REXML::Document.new(@body).root
    rescue
      raise GData::Client::Error, "Response body not XML."
    end
  else
    return nil
  end
end