lib/acfs/response.rb in acfs-0.10.0 vs lib/acfs/response.rb in acfs-0.11.0

- old
+ new

@@ -1,21 +1,28 @@ require 'acfs/response/formats' +require 'acfs/response/status' +require 'active_support/core_ext/module/delegation' module Acfs # This represents a response. In addition to an standard HTTP # it has a field `data` for storing the encoded body. # class Response attr_accessor :data - attr_reader :request, :status, :headers, :body + attr_reader :headers, :body include Response::Formats + include Response::Status - def initialize(request, status = 200, headers = {}, body = nil) - @request = request - @status = status - @headers = headers - @body = body + #delegate :status, :status_message, :success?, :modified?, :timed_out?, + # :response_body, :response_headers, :response_code, :headers, + # to: :response + + def initialize(request, data = {}) + @request = request + @status = data[:status] + @headers = data[:headers] + @body = data[:body] end end end