Module: ApiCanon::Routes

Defined in:
lib/api_canon/routes.rb

Class Method Summary collapse

Class Method Details

.draw(map, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/api_canon/routes.rb', line 3

def self.draw(map, options={})
  route_opts = {:as => 'api_canon_test',
    :controller => 'api_canon/api_canon', :action => 'test', :via => [:post]
  }.merge options
  if Rails.version.starts_with?('2')
    map.api_canon_test 'api_canon/test', route_opts
  else
    map.match 'api_canon/test', route_opts
  end

  # TODO: make :path => 'swagger-doc' customisable
  map.resources :path => 'swagger-doc',
    :controller => 'api_canon/swagger',
    :only => [:index, :show],
    :constraints => { :id => /.+/ },
    :as => :api_canon_swagger_doc
end