Sha256: 8bb17066543250a1a8b6361fbbe2129f82dbe64d731bd695c253f4461d7baf86
Contents?: true
Size: 701 Bytes
Versions: 8
Compression:
Stored size: 701 Bytes
Contents
module Restfully module HTTP # Container for an HTTP Response. Has <tt>status</tt>, <tt>headers</tt> and <tt>body</tt> properties. # The body is automatically parsed into a ruby object based on the response's <tt>Content-Type</tt> header. class Response include Headers, Restfully::Parsing attr_reader :status, :headers def initialize(status, headers, body) @status = status.to_i @headers = sanitize_http_headers(headers) @body = (body.nil? || body.empty?) ? nil : body.to_s end def body @unserialized_body ||= unserialize(@body, :content_type => @headers['Content-Type']) unless @body.nil? end end end end
Version data entries
8 entries across 8 versions & 2 rubygems