Sha256: 0229c4467874b6af90c43b38b881f3823b4b09a673e920a372699249596c63f2

Contents?: true

Size: 604 Bytes

Versions: 8

Compression:

Stored size: 604 Bytes

Contents

module Restfulie::Client::HTTP
  module ResponseHolder
    attr_reader :response, :request
    
    def resource
      type = headers['content-type'] || response['Content-Type']
      representation = Medie.registry.for(type[0])
      representation.unmarshal(response.body)
    end
    
    def at(uri)
      request.clone.at(uri)
    end
    
    def headers
      response.to_hash.extend(::Restfulie::Client::HTTP::LinkHeader)
    end
    
    def results_from(request, response)
      @request = request
      @response = response
    end

    def verb
      @request.verb
    end
        
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
restfulie-nosqlite-1.0.4 lib/restfulie/client/http/response_holder.rb
restfulie-1.1.1 lib/restfulie/client/http/response_holder.rb
restfulie-1.1.0 lib/restfulie/client/http/response_holder.rb
restfulie-nosqlite-1.0.3 lib/restfulie/client/http/response_holder.rb
restfulie-1.0.3 lib/restfulie/client/http/response_holder.rb
restfulie-1.0.0 lib/restfulie/client/http/response_holder.rb
restfulie-1.0.0.beta5 lib/restfulie/client/http/response_holder.rb
restfulie-1.0.0.beta4 lib/restfulie/client/http/response_holder.rb