mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 15:14:47 +02:00
Add DNS keys to domain API response
It is fairly similar to what we do for WHOIS records, but one query is slightly rewritten with removal of try-catch block
This commit is contained in:
parent
41d0931607
commit
74a9d59753
2 changed files with 16 additions and 0 deletions
|
@ -42,11 +42,23 @@ module Serializers
|
||||||
locked_by_registrant_at: domain.locked_by_registrant_at,
|
locked_by_registrant_at: domain.locked_by_registrant_at,
|
||||||
status_notes: domain.status_notes,
|
status_notes: domain.status_notes,
|
||||||
nameservers: nameservers,
|
nameservers: nameservers,
|
||||||
|
dnssec_keys: dnssec_keys,
|
||||||
|
dnssec_changed_at: dnssec_updated_at
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def dnssec_keys
|
||||||
|
domain.dnskeys.map do |key|
|
||||||
|
"#{key.flags} #{key.protocol} #{key.alg} #{key.public_key}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def dnssec_updated_at
|
||||||
|
domain.dnskeys.order(updated_at: :desc).select(:updated_at).first
|
||||||
|
end
|
||||||
|
|
||||||
def contacts(type)
|
def contacts(type)
|
||||||
contact_pool = begin
|
contact_pool = begin
|
||||||
if type == :tech
|
if type == :tech
|
||||||
|
|
|
@ -29,7 +29,11 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
||||||
email: 'john@inbox.test'}],
|
email: 'john@inbox.test'}],
|
||||||
domain[:tech_contacts])
|
domain[:tech_contacts])
|
||||||
assert_equal({ name: 'Good Names', website: nil }, domain[:registrar])
|
assert_equal({ name: 'Good Names', website: nil }, domain[:registrar])
|
||||||
|
|
||||||
assert_equal([], domain[:nameservers])
|
assert_equal([], domain[:nameservers])
|
||||||
|
assert_equal([], domain[:dnssec_keys])
|
||||||
|
assert(domain.has_key?(:dnssec_changed_at))
|
||||||
|
|
||||||
assert(domain.has_key?(:locked_by_registrant_at))
|
assert(domain.has_key?(:locked_by_registrant_at))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue