mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 13:15:40 +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 Repp
|
||||||
module V1
|
module V1
|
||||||
class DomainsController < BaseController
|
class DomainsController < BaseController
|
||||||
|
@ -13,13 +13,17 @@ module Repp
|
||||||
domains = records.limit(limit).offset(offset)
|
domains = records.limit(limit).offset(offset)
|
||||||
domains = domains.pluck(:name) unless index_params[:details] == 'true'
|
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 })
|
render_success(data: { domains: domains, total_number_of_records: records.count })
|
||||||
end
|
end
|
||||||
|
|
||||||
api :GET, '/repp/v1/domains/:domain_name'
|
api :GET, '/repp/v1/domains/:domain_name'
|
||||||
desc 'Get a specific domain'
|
desc 'Get a specific domain'
|
||||||
def show
|
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
|
end
|
||||||
|
|
||||||
api :POST, '/repp/v1/domains'
|
api :POST, '/repp/v1/domains'
|
||||||
|
|
|
@ -29,7 +29,8 @@ module Serializers
|
||||||
|
|
||||||
def dnssec_keys
|
def dnssec_keys
|
||||||
domain.dnskeys.map do |nssec|
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue