Class: Plz::Response

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

Constant Summary collapse

TEMPLATE =
<<-EOS.strip_heredoc
  HTTP/1.1 %{status}
  %{headers}

  %{body}
EOS

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Response

Returns a new instance of Response.

Parameters:

  • (Faraday::Response)


11
12
13
# File 'lib/plz/response.rb', line 11

def initialize(raw)
  @raw = raw
end

Instance Method Details

#renderString

Returns:

  • (String)


16
17
18
19
20
21
22
# File 'lib/plz/response.rb', line 16

def render
  TEMPLATE % {
    status: status,
    headers: headers.join("\n"),
    body: body,
  }
end