mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 07:04:47 +02:00
Repp: Add contacts/check action
This commit is contained in:
parent
1686c352bc
commit
39c6d20413
2 changed files with 25 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
module Repp
|
module Repp
|
||||||
module V1
|
module V1
|
||||||
class ContactsController < BaseController
|
class ContactsController < BaseController
|
||||||
before_action :find_contact, only: [:update]
|
before_action :find_contact, only: %i[show update]
|
||||||
|
|
||||||
## GET /repp/v1/contacts
|
## GET /repp/v1/contacts
|
||||||
def index
|
def index
|
||||||
|
@ -20,6 +20,24 @@ module Repp
|
||||||
render(json: resp, status: :ok)
|
render(json: resp, status: :ok)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
## GET /repp/v1/contacts/1
|
||||||
|
def show
|
||||||
|
render(json: @contact.as_json, status: :ok)
|
||||||
|
end
|
||||||
|
|
||||||
|
## GET /repp/v1/contacts/check/1
|
||||||
|
def check
|
||||||
|
contact = Epp::Contact.find_by(code: params[:id])
|
||||||
|
|
||||||
|
render json: {
|
||||||
|
code: 1000, message: I18n.t('epp.contacts.completed'),
|
||||||
|
data: { contact: {
|
||||||
|
id: params[:id],
|
||||||
|
available: contact.nil?
|
||||||
|
} }
|
||||||
|
}, status: :ok
|
||||||
|
end
|
||||||
|
|
||||||
## POST /repp/v1/contacts
|
## POST /repp/v1/contacts
|
||||||
def create
|
def create
|
||||||
@legal_doc = params[:legal_documents]
|
@legal_doc = params[:legal_documents]
|
||||||
|
|
|
@ -39,7 +39,12 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
namespace :repp do
|
namespace :repp do
|
||||||
namespace :v1 do
|
namespace :v1 do
|
||||||
resources :contacts
|
resources :contacts do
|
||||||
|
collection do
|
||||||
|
get 'check/:id', to: 'contacts#check'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
resources :accounts do
|
resources :accounts do
|
||||||
collection do
|
collection do
|
||||||
get 'balance'
|
get 'balance'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue