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.



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

def body
  @body
end

#headersObject

The headers of the HTTP response.



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

def headers
  @headers
end

#status_codeObject

The HTTP response code.



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

def status_code
  @status_code
end

Instance Method Details

#to_xmlObject

Converts the response body into a REXML::Document



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

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