Class: Response

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

Instance Method Summary collapse

Constructor Details

#initialize(content, headers, code) ⇒ Response

Returns a new instance of Response.

Parameters:

  • the body of the http request

  • the headers of the http request

  • the status code of the http request



6
7
8
9
10
# File 'lib/kirin_http/http_response.rb', line 6

def initialize(content, headers, code)
  @content = content
  @header = headers
  @code = code
end

Instance Method Details

#codeInteger

Returns the status code as integer

Returns:



30
31
32
# File 'lib/kirin_http/http_response.rb', line 30

def code
  @code
end

#contentObject

Gets the content of the Http Request made. This can be any type, please check headers for Content-Type to verify

Returns:



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

def content
  @content
end

#headerHash

Returns the header as hash

Returns:



23
24
25
# File 'lib/kirin_http/http_response.rb', line 23

def header
  @header
end