lib/duracloud/response.rb in duracloud-client-0.0.1 vs lib/duracloud/response.rb in duracloud-client-0.0.2
- old
+ new
@@ -1,35 +1,21 @@
require "forwardable"
-require_relative "error_handler"
module Duracloud
class Response
extend Forwardable
- # class << self
- # def error_handler
- # @error_handler ||=
- # begin
- # class_name = self.name.split(/::/).last.sub(/Response\z/, "ErrorHandler")
- # Duracloud.const_get(class_name)
- # rescue NameError
- # superclass.error_handler
- # end
- # end
- # end
-
attr_reader :original_response
delegate [:header, :body, :code, :ok?, :redirect?, :status, :reason] => :original_response,
:content_type => :header,
[:size, :empty?] => :body
def_delegator :header, :request_uri, :url
+ def_delegator :header, :request_method
def initialize(original_response)
@original_response = original_response
- #self.class.error_handler.call(self) if error?
- ErrorHandler.call(self) if error?
end
def error?
!(ok? || redirect?)
end