Sha256: 60422fdb840a010cf773f328946e7cf0e4450c3a66830df118e654fe8d8492d2

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

module ActionDispatch::Routing
  class Mapper
    # Includes mount_opro_oauth method for routes. This method is responsible to
    # generate all needed routes for oauth
    def mount_opro_oauth(options = {})
      skip_routes = options[:except].is_a?(Array) ? options[:except] : [options[:except]]
      controllers = options[:controllers] || {}

      match 'oauth/new'          => 'opro/oauth/auth#new',          :as => 'oauth_new'
      match 'oauth/authorize'    => 'opro/oauth/auth#create',       :as => 'oauth_authorize'
      match 'oauth/token'        => 'opro/oauth/token#create',      :as => 'oauth_token'

      unless skip_routes.include?(:client_apps)
        oauth_client_apps = controllers[:oauth_client_apps] ||'opro/oauth/client_app'
        resources :oauth_client_apps, :controller => oauth_client_apps
      end
      unless skip_routes.include?(:docs)
        oauth_docs = controllers[:oauth_docs] ||'opro/oauth/docs'
        resources :oauth_docs,        :controller => oauth_docs, :only => [:index, :show]
      end
      unless skip_routes.include?(:tests)
        oauth_tests = controllers[:oauth_tests] ||'opro/oauth/tests'
        resources :oauth_tests,       :controller => oauth_tests, :only => [:index, :show, :create, :destroy]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opro-0.4.2 lib/opro/rails/routes.rb