Module: OAuth::RequestProxy — Documentation by YARD 0.9.45

# 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

## Constant Summary collapse

AVAILABLE_PROXIES =

      {}

## Class Method Summary collapse

- .available_proxies ⇒ Object

  :nodoc:.

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

## Class Method Details

### .available_proxies ⇒ `Object`

:nodoc:

    8
    9
    10
    # File 'lib/oauth/request_proxy.rb', line 8

    def available_proxies # :nodoc:
      AVAILABLE_PROXIES
    end

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

Raises:

- (`UnknownRequestType`)

    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    # File 'lib/oauth/request_proxy.rb', line 12

    def 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