Sha256: e99b84add78369938f4ab5299bb297b32501c19bd4b14674cad1d0d5fd42b63d

Contents?: true

Size: 832 Bytes

Versions: 108

Compression:

Stored size: 832 Bytes

Contents

module RestClient
  # The response from RestClient on a raw request looks like a string, but is
  # actually one of these.  99% of the time you're making a rest call all you
  # care about is the body, but on the occassion you want to fetch the
  # headers you can:
  #
  #   RestClient.get('http://example.com').headers[:content_type]
  #
  # In addition, if you do not use the response as a string, you can access
  # a Tempfile object at res.file, which contains the path to the raw
  # downloaded request body.
  class RawResponse

    include AbstractResponse

    attr_reader :file

    def initialize tempfile, net_http_res, args
      @net_http_res = net_http_res
      @args = args
      @file = tempfile
    end

    def to_s
      @file.open
      @file.read
    end

    def size
      File.size file
    end

  end
end

Version data entries

108 entries across 102 versions & 13 rubygems

Version Path
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/rest-client-1.6.7/lib/restclient/raw_response.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/rest-client-1.6.7/lib/restclient/raw_response.rb
rest-client-1.6.14 lib/restclient/raw_response.rb
tdiary-5.0.8 vendor/bundle/ruby/2.5.0/gems/rest-client-1.6.7/lib/restclient/raw_response.rb
tdiary-5.0.8 vendor/bundle/gems/rest-client-1.6.7/lib/restclient/raw_response.rb
rest-client-1.6.9 lib/restclient/raw_response.rb
rest-client_jxb_fix-1.6.7 lib/restclient/raw_response.rb
rest-client-1.7.3-x86-mswin32 lib/restclient/raw_response.rb
rest-client-1.7.3-x64-mingw32 lib/restclient/raw_response.rb
rest-client-1.7.3-x86-mingw32 lib/restclient/raw_response.rb
rest-client-1.7.3 lib/restclient/raw_response.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/rest-client-1.6.7/lib/restclient/raw_response.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/rest-client-1.6.7/lib/restclient/raw_response.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/rest-client-1.6.7/lib/restclient/raw_response.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/rest-client-1.6.7/lib/restclient/raw_response.rb
rest-client-1.7.2-x86-mswin32 lib/restclient/raw_response.rb
rest-client-1.7.2-x64-mingw32 lib/restclient/raw_response.rb
rest-client-1.7.2-x86-mingw32 lib/restclient/raw_response.rb
rest-client-1.7.2 lib/restclient/raw_response.rb
rest-client-1.7.2.rc1-x86-mswin32 lib/restclient/raw_response.rb