Class: FunApi::TemplateResponse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, status: 200, headers: {}) ⇒ TemplateResponse

Returns a new instance of TemplateResponse.



7
8
9
10
11
# File 'lib/funapi/template_response.rb', line 7

def initialize(body, status: 200, headers: {})
  @body = body
  @status = status
  @headers = {"content-type" => "text/html; charset=utf-8"}.merge(headers)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



5
6
7
# File 'lib/funapi/template_response.rb', line 5

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



5
6
7
# File 'lib/funapi/template_response.rb', line 5

def headers
  @headers
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/funapi/template_response.rb', line 5

def status
  @status
end

Instance Method Details

#to_responseObject



13
14
15
# File 'lib/funapi/template_response.rb', line 13

def to_response
  [status, headers, [body]]
end