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



64
65
66
# File 'lib/openid/fetchers.rb', line 64

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

Instance Attribute Details

#_responseObject

Returns the value of attribute _response.



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

def _response
  @_response
end

#final_urlObject

Returns the value of attribute final_url.



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

def final_url
  @final_url
end

Class Method Details

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



56
57
58
59
60
61
# File 'lib/openid/fetchers.rb', line 56

def _from_net_response(response, final_url, _headers = nil)
  instance = new
  instance._response = response
  instance.final_url = final_url
  instance
end

Instance Method Details

#body=(s) ⇒ Object



72
73
74
75
76
77
78
79
80
# File 'lib/openid/fetchers.rb', line 72

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

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/openid/fetchers.rb', line 68

def respond_to_missing?(method_name, include_private = false)
  super
end