mirror of
https://github.com/internetee/registry.git
synced 2025-06-09 22:24:47 +02:00
REPP: Serialize domains
This commit is contained in:
parent
57df268d91
commit
e55fc833e7
2 changed files with 8 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
require 'serializers/registrant_api/domain'
|
||||
require 'serializers/repp/domain'
|
||||
module Repp
|
||||
module V1
|
||||
class DomainsController < BaseController
|
||||
|
@ -13,13 +13,17 @@ module Repp
|
|||
domains = records.limit(limit).offset(offset)
|
||||
domains = domains.pluck(:name) unless index_params[:details] == 'true'
|
||||
|
||||
if index_params[:details] == 'true'
|
||||
domains = domains.map { |d| Serializers::Repp::Domain.new(d).to_json }
|
||||
end
|
||||
|
||||
render_success(data: { domains: domains, total_number_of_records: records.count })
|
||||
end
|
||||
|
||||
api :GET, '/repp/v1/domains/:domain_name'
|
||||
desc 'Get a specific domain'
|
||||
def show
|
||||
render_success(data: { domain: Serializers::RegistrantApi::Domain.new(@domain).to_json })
|
||||
render_success(data: { domain: Serializers::Repp::Domain.new(@domain).to_json })
|
||||
end
|
||||
|
||||
api :POST, '/repp/v1/domains'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue