Class: HTTP::Client::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/http/client.rb

Overview

Request

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, last_effective_uri) ⇒ Response

Returns a new instance of Response.



256
257
258
259
# File 'lib/http/client.rb', line 256

def initialize response, last_effective_uri
  @response           = response
  @last_effective_uri = last_effective_uri
end

Instance Attribute Details

#last_effective_uriObject (readonly)

Returns the value of attribute last_effective_uri.



254
255
256
# File 'lib/http/client.rb', line 254

def last_effective_uri
  @last_effective_uri
end

Instance Method Details

#bodyObject



269
270
271
# File 'lib/http/client.rb', line 269

def body
  @response.body
end

#codeObject



261
262
263
# File 'lib/http/client.rb', line 261

def code
  @response.code.to_i
end

#headersObject



265
266
267
# File 'lib/http/client.rb', line 265

def headers
  @headers ||= Hash[@response.each_header.entries]
end

#inspectObject



273
274
275
# File 'lib/http/client.rb', line 273

def inspect
  "#<#{self.class} @code=#{code} @last_effective_uri=#{last_effective_uri}>"
end