Add API for getting info about authenticated user: /api/v1/accounts/verify_credentials

master
Eugen Rochko 8 years ago
parent 31a0202546
commit 6d7290f47c
  1. 7
      app/controllers/api/v1/accounts_controller.rb
  2. 1
      config/routes.rb
  3. 7
      spec/controllers/api/v1/accounts_controller_spec.rb

@ -1,11 +1,16 @@
class Api::V1::AccountsController < ApiController
before_action :doorkeeper_authorize!
before_action :set_account
before_action :set_account, except: :verify_credentials
respond_to :json
def show
end
def verify_credentials
@account = current_user.account
render action: :show
end
def following
@following = @account.following
end

@ -63,6 +63,7 @@ Rails.application.routes.draw do
resources :accounts, only: [:show] do
collection do
get :relationships
get :verify_credentials
end
member do

@ -18,6 +18,13 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
end
end
describe 'GET #verify_credentials' do
it 'returns http success' do
get :verify_credentials
expect(response).to have_http_status(:success)
end
end
describe 'GET #statuses' do
it 'returns http success' do
get :statuses, params: { id: user.account.id }

Loading…
Cancel
Save