diff --git a/app/controllers/api/v2/base_controller.rb b/app/controllers/api/v0/base_controller.rb similarity index 60% rename from app/controllers/api/v2/base_controller.rb rename to app/controllers/api/v0/base_controller.rb index a9d85bcc4..0899a13a8 100644 --- a/app/controllers/api/v2/base_controller.rb +++ b/app/controllers/api/v0/base_controller.rb @@ -1,4 +1,4 @@ -class Api::V2::BaseController < ApplicationController +class Api::V0::BaseController < ApplicationController include OpenidConnect::Authentication before_filter :require_access_token diff --git a/app/controllers/api/v2/users_controller.rb b/app/controllers/api/v0/users_controller.rb similarity index 66% rename from app/controllers/api/v2/users_controller.rb rename to app/controllers/api/v0/users_controller.rb index 7f8ea55b7..e57c7cd23 100644 --- a/app/controllers/api/v2/users_controller.rb +++ b/app/controllers/api/v0/users_controller.rb @@ -1,4 +1,4 @@ -class Api::V2::UsersController < Api::V2::BaseController +class Api::V0::UsersController < Api::V0::BaseController def show render json: user diff --git a/app/presenters/api/v0/base_presenter.rb b/app/presenters/api/v0/base_presenter.rb new file mode 100644 index 000000000..b425b1440 --- /dev/null +++ b/app/presenters/api/v0/base_presenter.rb @@ -0,0 +1,2 @@ +class Api::V0::BasePresenter +end diff --git a/app/presenters/api/v2/base_presenter.rb b/app/presenters/api/v2/base_presenter.rb deleted file mode 100644 index 2afabc56a..000000000 --- a/app/presenters/api/v2/base_presenter.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Api::V2::BasePresenter -end diff --git a/config/routes.rb b/config/routes.rb index 02d62211f..58c7d7445 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -198,15 +198,7 @@ Diaspora::Application.routes.draw do end end - scope 'api/v0', :controller => :apis do - get :me - end - namespace :api do - namespace :v0 do - get "/users/:username" => 'users#show', :as => 'user' - get "/tags/:name" => 'tags#show', :as => 'tag' - end namespace :v1 do resources :tokens, :only => [:create, :destroy] end @@ -249,7 +241,7 @@ Diaspora::Application.routes.draw do post 'access_tokens', to: proc { |env| OpenidConnect::TokenEndpoint.new.call(env) } end - api_version(:module => "Api::V2", path: {value: "api/v2"}, default: true) do + api_version(module: "Api::V0", path: {value: "api/v0"}, default: true) do match 'user', to: 'users#show', via: :get end end diff --git a/features/step_definitions/openid_steps.rb b/features/step_definitions/openid_steps.rb index ef1974da8..47fada788 100644 --- a/features/step_definitions/openid_steps.rb +++ b/features/step_definitions/openid_steps.rb @@ -10,13 +10,13 @@ end When /^I use received valid bearer tokens to access user info via URI query parameter$/ do accessTokenJson = JSON.parse(last_response.body) - userInfoEndPointURL = "/api/v2/user/" + userInfoEndPointURL = "/api/v0/user/" userInfoEndPointURLQuery = "?access_token=" + accessTokenJson["access_token"] visit userInfoEndPointURL + userInfoEndPointURLQuery end When /^I use invalid bearer tokens to access user info via URI query parameter$/ do - userInfoEndPointURL = "/api/v2/user/" + userInfoEndPointURL = "/api/v0/user/" userInfoEndPointURLQuery = "?access_token=" + SecureRandom.hex(32) visit userInfoEndPointURL + userInfoEndPointURLQuery end diff --git a/public/docs/v2/index.html b/public/docs/v0/index.html similarity index 79% rename from public/docs/v2/index.html rename to public/docs/v0/index.html index 518259ab3..08b6b913f 100644 --- a/public/docs/v2/index.html +++ b/public/docs/v0/index.html @@ -1,7 +1,7 @@
-