Sha256: 798d0c3f7e94a36d8821444f6e111d6354f6bbc5057e09b1066c6f7ea2be9ff6
Contents?: true
Size: 911 Bytes
Versions: 1
Compression:
Stored size: 911 Bytes
Contents
require "forwardable" module Duracloud class Response extend Forwardable attr_reader :original_response delegate [:header, :body, :code, :ok?, :redirect?, :status, :reason] => :original_response, :content_type => :header, :empty? => :body def_delegator :header, :request_uri, :url def_delegator :header, :request_method def initialize(original_response) @original_response = original_response end def error? !(ok? || redirect?) end def plain_text? content_type == "text/plain" end def has_body? !empty? end def headers header.all.each_with_object({}) do |(name, value), memo| memo[name] ||= [] memo[name] << value end end def md5 header["content-md5"].first end def size header["content-length"].first.to_i rescue nil end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
duracloud-client-0.6.0 | lib/duracloud/response.rb |