Sha256: 2182dc8b50e195e24a998b66a19c90d09afbd843850a24907542fa2c24b42453

Contents?: true

Size: 635 Bytes

Versions: 2

Compression:

Stored size: 635 Bytes

Contents

module Restfulie::Client::HTTP
  module ResponseHolder
    attr_reader :response, :request
    
    def resource
      type = headers['content-type'] || response['Content-Type']
      representation = Restfulie::Common::Converter.content_type_for(type[0]) || Restfulie::Common::Representation::Generic.new
      representation.unmarshal(response.body)
    end
    
    def at(uri)
      request.clone.at(uri)
    end
    
    def headers
      response.to_hash
    end
    
    def results_from(request, response)
      @request = request
      @response = response
    end

    def verb
      @request.verb
    end
        
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
restfulie-1.0.0.beta1 lib/restfulie/client/http/response_holder.rb
restfulie-0.1.0.beta1 lib/restfulie/client/http/response_holder.rb