Class: OpenID::HTTPResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/openid/fetchers.rb

Overview

Our HTTPResponse class extends Net::HTTPResponse with an additional method, final_url.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



61
62
63
# File 'lib/openid/fetchers.rb', line 61

def method_missing(method, *args)
  @_response.send(method, *args)
end

Instance Attribute Details

#_responseObject

Returns the value of attribute _response.



52
53
54
# File 'lib/openid/fetchers.rb', line 52

def _response
  @_response
end

#final_urlObject

Returns the value of attribute final_url.



50
51
52
# File 'lib/openid/fetchers.rb', line 50

def final_url
  @final_url
end

Class Method Details

._from_net_response(response, final_url, headers = nil) ⇒ Object



54
55
56
57
58
59
# File 'lib/openid/fetchers.rb', line 54

def self._from_net_response(response, final_url, headers=nil)
  me = self.new
  me._response = response
  me.final_url = final_url
  return me
end

Instance Method Details

#body=(s) ⇒ Object



65
66
67
68
69
70
71
72
73
# File 'lib/openid/fetchers.rb', line 65

def body=(s)
  @_response.instance_variable_set('@body', s)
  # XXX Hack to work around ruby's HTTP library behavior.  @body
  # is only returned if it has been read from the response
  # object's socket, but since we're not using a socket in this
  # case, we need to set the @read flag to true to avoid a bug in
  # Net::HTTPResponse.stream_check when @socket is nil.
  @_response.instance_variable_set('@read', true)
end