Module: OAuth::RequestProxy

Defined in:
lib/oauth/request_proxy.rb,
lib/oauth/request_proxy/base.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/action_dispatch_request.rb,
lib/oauth/request_proxy/action_controller_request.rb

Defined Under Namespace

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

Class Method Summary collapse

Class Method Details

.available_proxiesObject

:nodoc:



3
4
5
# File 'lib/oauth/request_proxy.rb', line 3

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

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

Raises:



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

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

  klass = available_proxies[request.class]

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

  raise UnknownRequestType, request.class.to_s unless klass
  klass.new(request, options)
end