Class: Response

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

Overview

The Response class is used to represent a set of HTTP response data. Populated instances of this class are serialized to JSON and passed to the GRIP proxy in the body. The GRIP proxy then parses the message and deserialized the JSON into an HTTP response that is passed back to the client.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code = nil, reason = nil, headers = nil, body = nil) ⇒ Response

Initialize with an HTTP response code, reason, headers, and body.



20
21
22
23
24
25
# File 'lib/response.rb', line 20

def initialize(code=nil, reason=nil, headers=nil, body=nil)
  @code = code
  @reason = reason
  @headers = headers
  @body = body
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



17
18
19
# File 'lib/response.rb', line 17

def body
  @body
end

#codeObject

Returns the value of attribute code.



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

def code
  @code
end

#headersObject

Returns the value of attribute headers.



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

def headers
  @headers
end

#reasonObject

Returns the value of attribute reason.



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

def reason
  @reason
end