File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 draw :pushes
1515 draw :pwp_api
1616
17- apipie
18- get "/help/api" , to : "pages#api" , as : :help_api
19-
2017 get "/pages/*id" => "pages#show" , :as => :page , :format => false
2118
2219 mount Mailbin ::Engine => :mailbin if Rails . env . development?
Original file line number Diff line number Diff line change 11constraints ( format : :json ) do
2- namespace :api do
3- namespace :v2 do
2+ namespace :api , defaults : { format : :json } do
3+ namespace :v2 , defaults : { format : :json } do
44 get :version , to : "version#show"
55
66 resources :pushes , except : %i[ new index edit update ] do
1212 end
1313 end
1414
15- namespace :api do
16- namespace :v1 do
15+ namespace :api , defaults : { format : :json } do
16+ namespace :v1 , defaults : { format : :json } do
1717 get :version , to : "version#show"
1818 end
1919 end
5050 end
5151 end
5252end
53+
54+ # APIv2 Documentation
55+ constraints ( format : :html ) do
56+ get "/help/api" , to : "pages#api" , as : :help_api
57+ end
58+
59+ # Legacy APIv1 Documentation - redirect to https://docs.pwpush.com/docs/api-v1/
60+ constraints ( format : :html ) do
61+ get "/api" , to : redirect ( "https://docs.pwpush.com/docs/api-v1/" ) , as : :help_api_v1
62+ end
Original file line number Diff line number Diff line change @@ -17,9 +17,9 @@ def test_help_api_page_is_available
1717 assert_response :success
1818 end
1919
20- def test_existing_apipie_docs_remain_available
20+ def test_legacy_api_v1_docs_are_redirected
2121 get "/api"
22- assert_response :success
22+ assert_response :redirect
2323 end
2424
2525 def test_versioned_requests_and_accounts_endpoints_are_not_exposed
You can’t perform that action at this time.
0 commit comments