From b44c757602ecbeb7f901b8bf78126dddcc6c20a5 Mon Sep 17 00:00:00 2001 From: Sergei Tsoganov Date: Tue, 30 May 2023 15:49:56 +0300 Subject: [PATCH] Added white ip show page --- app/controllers/repp/v1/white_ips_controller.rb | 8 +++++++- config/routes.rb | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/controllers/repp/v1/white_ips_controller.rb b/app/controllers/repp/v1/white_ips_controller.rb index 6f962c0b5..3411ed589 100644 --- a/app/controllers/repp/v1/white_ips_controller.rb +++ b/app/controllers/repp/v1/white_ips_controller.rb @@ -11,10 +11,16 @@ module Repp def index ips = current_user.registrar.white_ips - render_success(data: { ips: ips.as_json(except: %i[creator_str updator_str]), + render_success(data: { ips: ips.as_json, count: ips.count }) end + api :GET, '/repp/v1/white_ips/:id' + desc 'Get a specific whitelisted IP address' + def show + render_success(data: { ip: @white_ip.as_json, interfaces: WhiteIp::INTERFACES }) + end + api :POST, '/repp/v1/white_ips' desc 'Add new whitelisted IP' def create diff --git a/config/routes.rb b/config/routes.rb index 4677f01e1..32028d33b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -109,7 +109,7 @@ Rails.application.routes.draw do end end resources :api_users, only: %i[index show update create destroy] - resources :white_ips, only: %i[index update create destroy] + resources :white_ips, only: %i[index show update create destroy] namespace :registrar do resources :notifications, only: %i[index show update] do collection do