REPP: Port accounts controller from Grape to Rails API

This commit is contained in:
Karl Erik Õunapuu 2020-10-08 16:28:05 +03:00
parent aa325604f9
commit 1686c352bc
No known key found for this signature in database
GPG key ID: C9DD647298A34764
3 changed files with 16 additions and 16 deletions

View file

@ -1,16 +0,0 @@
module Repp
class AccountV1 < Grape::API
version 'v1', using: :path
resource :accounts do
desc 'Return current cash account balance'
get 'balance' do
@response = {
balance: current_user.registrar.cash_account.balance,
currency: current_user.registrar.cash_account.currency
}
end
end
end
end

View file

@ -0,0 +1,11 @@
module Repp
module V1
class AccountsController < BaseController
def balance
resp = { balance: current_user.registrar.cash_account.balance,
currency: current_user.registrar.cash_account.currency }
render(json: resp, status: :ok)
end
end
end
end

View file

@ -40,6 +40,11 @@ Rails.application.routes.draw do
namespace :repp do
namespace :v1 do
resources :contacts
resources :accounts do
collection do
get 'balance'
end
end
resources :auctions, only: %i[index]
resources :retained_domains, only: %i[index]
end