mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 00:12:03 +02:00
REPP: Port accounts controller from Grape to Rails API
This commit is contained in:
parent
aa325604f9
commit
1686c352bc
3 changed files with 16 additions and 16 deletions
|
@ -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
|
11
app/controllers/repp/v1/accounts_controller.rb
Normal file
11
app/controllers/repp/v1/accounts_controller.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue