class Esplanade::Response::Raw::Body
Public Class Methods
new(request, raw_response, raw_body)
click to toggle source
# File lib/esplanade/response/raw/body.rb, line 7 def initialize(request, raw_response, raw_body) @request = request @raw_response = raw_response @raw_body = raw_body end
Public Instance Methods
to_hash()
click to toggle source
# File lib/esplanade/response/raw/body.rb, line 18 def to_hash @hash ||= MultiJson.load(to_string) rescue MultiJson::ParseError raise BodyIsNotJson.new(**message) end
to_string()
click to toggle source
# File lib/esplanade/response/raw/body.rb, line 13 def to_string @to_string ||= @raw_body.body rescue nil @to_string ||= @raw_body.first rescue nil end
Private Instance Methods
message()
click to toggle source
# File lib/esplanade/response/raw/body.rb, line 26 def message { request: { method: @request.raw.method, path: @request.raw.path, raw_path: @request.raw.raw_path }, status: @raw_response.status, body: @raw_response.body.to_string } end