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:

  • content (Object)

    the body of the http request

  • headers (Hash)

    the headers of the http request

  • code (Integer)

    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:

  • (Integer)


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:

  • (Object)


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

def content
	@content
end

#headerHash

Returns the header as hash

Returns:

  • (Hash)


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

def header
	@header
end