From 0ab9f6333fb53eb60f170abd7399d27448b98450 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Thu, 26 Jul 2018 14:46:03 +0300 Subject: [PATCH] Add API/Registrant/Domains route --- .../api/v1/registrant/domains_controller.rb | 17 +++++++++++++++++ config/routes.rb | 8 ++++++++ test/fixtures/domains.yml | 12 +++++++++++- .../registrant/registrant_api_domains_test.rb | 17 +++++++++++++++++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 app/controllers/api/v1/registrant/domains_controller.rb create mode 100644 test/system/api/registrant/registrant_api_domains_test.rb diff --git a/app/controllers/api/v1/registrant/domains_controller.rb b/app/controllers/api/v1/registrant/domains_controller.rb new file mode 100644 index 000000000..44662c673 --- /dev/null +++ b/app/controllers/api/v1/registrant/domains_controller.rb @@ -0,0 +1,17 @@ +require 'rails5_api_controller_backport' + +module Api + module V1 + module Registrant + class DomainsController < ActionController::API + def index + render json: { success: true } + end + + def show + render json: { success: true } + end + end + end + end +end diff --git a/config/routes.rb b/config/routes.rb index 8f50d5587..aa73eef3f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,6 +18,14 @@ Rails.application.routes.draw do mount Repp::API => '/' + namespace :api do + namespace :v1 do + namespace :registrant do + resources :domains, only: [:index, :show], param: :uuid + end + end + end + # REGISTRAR ROUTES namespace :registrar do resource :dashboard diff --git a/test/fixtures/domains.yml b/test/fixtures/domains.yml index 59a1b8ea5..38500e9cc 100644 --- a/test/fixtures/domains.yml +++ b/test/fixtures/domains.yml @@ -42,10 +42,20 @@ metro: period_unit: m uuid: ef97cb80-333b-4893-b9df-163f2b452798 +hospital: + name: hospital.test + registrar: goodnames + registrant: william + transfer_code: 23118v2 + valid_to: 2010-07-05 + period: 1 + period_unit: m + uuid: 5edda1a5-3548-41ee-8b65-6d60daf85a37 + invalid: name: invalid.test transfer_code: 1438d6 valid_to: <%= Time.zone.parse('2010-07-05').utc.to_s(:db) %> registrar: bestnames registrant: invalid - uuid: 3c430ead-bb17-4b5b-aaa1-caa7dde7e138 \ No newline at end of file + uuid: 3c430ead-bb17-4b5b-aaa1-caa7dde7e138 diff --git a/test/system/api/registrant/registrant_api_domains_test.rb b/test/system/api/registrant/registrant_api_domains_test.rb new file mode 100644 index 000000000..6a53f7720 --- /dev/null +++ b/test/system/api/registrant/registrant_api_domains_test.rb @@ -0,0 +1,17 @@ +require 'test_helper' + +class RegistrantApiDomainsTest < ApplicationSystemTestCase + def setup + super + + @registrant = contacts(:william) + end + + def teardown + super + end + + + def test_can_get_domain_details_by_uuid + end +end