mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 05:05:45 +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'
|
||||
|
|
|
@ -29,7 +29,8 @@ module Serializers
|
|||
|
||||
def dnssec_keys
|
||||
domain.dnskeys.map do |nssec|
|
||||
{ flags: nsec.flags, protocol: nssec.protocol, alg: nssec.alg, public_key: nssec.public_key }
|
||||
{ flags: nssec.flags, protocol: nssec.protocol, alg: nssec.alg,
|
||||
public_key: nssec.public_key }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue