Skip to content

Commit

Permalink
fix routes
Browse files Browse the repository at this point in the history
  • Loading branch information
kjgarza committed Apr 30, 2020
1 parent 89697e0 commit 4774127
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
resources :index, path: '/', only: [:index]
# resources :index, only: [:index]

resources :publishers, constraints: { id: /.+/ }

def add_swagger_route http_method, path, opts = {}
full_path = path.gsub(/{(.*?)}/, ':\1')
match full_path, to: "#{opts.fetch(:controller_name)}##{opts[:action_name]}", via: http_method
end

add_swagger_route 'GET', '//reports/publishers', controller_name: 'publishers', action_name: 'index'
# add_swagger_route 'GET', '//reports/publishers', controller_name: 'publishers', action_name: 'index'
add_swagger_route 'DELETE', '//publishers/{id}', controller_name: 'publishers', action_name: 'destroy'
add_swagger_route 'GET', '//repositories-usage-reports/{id}', controller_name: 'publishers', action_name: 'show'
add_swagger_route 'PUT', '//publishers/{id}', controller_name: 'publishers', action_name: 'update'
add_swagger_route 'POST', '//publishers', controller_name: 'publishers', action_name: 'create'
add_swagger_route 'GET', '//report-types', controller_name: 'report_types', action_name: 'index'
Expand All @@ -25,4 +22,10 @@ def add_swagger_route http_method, path, opts = {}
add_swagger_route 'GET', '//report-subsets/{id}', controller_name: 'report_subsets', action_name: 'show'
add_swagger_route 'PUT', '//reports/{id}', controller_name: 'reports', action_name: 'update'
add_swagger_route 'POST', '//reports', controller_name: 'reports', action_name: 'create'

get 'repositories-usage-reports/:id', :to => 'publishers#show', constraints: { :id => /.+/ }


resources :publishers, constraints: { :id => /.+/ }, format: false, defaults: { format: false }
resources :repositories_usage_reports, constraints: { :id => /.+/ }, format: false, defaults: { format: false }
end

0 comments on commit 4774127

Please sign in to comment.