Module: OAuth::RequestProxy

Defined in:
lib/oauth/request_proxy.rb,
lib/oauth/request_proxy/base.rb,
lib/oauth/request_proxy/net_http.rb,
lib/oauth/request_proxy/curb_request.rb,
lib/oauth/request_proxy/mock_request.rb,
lib/oauth/request_proxy/rack_request.rb,
lib/oauth/request_proxy/jabber_request.rb,
lib/oauth/request_proxy/em_http_request.rb,
lib/oauth/request_proxy/typhoeus_request.rb,
lib/oauth/request_proxy/rest_client_request.rb,
lib/oauth/request_proxy/action_dispatch_request.rb,
lib/oauth/request_proxy/action_controller_request.rb

Defined Under Namespace

Modules: Curl, EventMachine, Net, RestClient, Typhoeus Classes: ActionControllerRequest, ActionDispatchRequest, Base, JabberRequest, MockRequest, RackRequest, UnknownRequestType

Class Method Summary collapse

Class Method Details

.available_proxiesObject

:nodoc:



5
6
7
# File 'lib/oauth/request_proxy.rb', line 5

def self.available_proxies # :nodoc:
  @available_proxies ||= {}
end

.proxy(request, options = {}) ⇒ Object

Raises:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/oauth/request_proxy.rb', line 9

def self.proxy(request, options = {})
  return request if request.is_a?(OAuth::RequestProxy::Base)

  klass = available_proxies[request.class]

  # Search for possible superclass matches.
  if klass.nil?
    request_parent = available_proxies.keys.find { |rc| request.is_a?(rc) }
    klass = available_proxies[request_parent]
  end

  raise UnknownRequestType, request.class.to_s unless klass

  klass.new(request, options)
end