mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 03:06:14 +02:00
Merge pull request #1613 from internetee/add-dnskeys-to-domain-response
Add DNS keys to domain API response
This commit is contained in:
commit
f7d3ab5018
3 changed files with 35 additions and 3 deletions
|
@ -34,21 +34,25 @@ Content-Type: application/json
|
||||||
"admin_contacts":[
|
"admin_contacts":[
|
||||||
{
|
{
|
||||||
"name":"John Smith",
|
"name":"John Smith",
|
||||||
"id":"62015e7d-42c8-4d68-8164-e9b71680fd95"
|
"id":"62015e7d-42c8-4d68-8164-e9b71680fd95",
|
||||||
|
"email": "john@email.com"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"William Smith",
|
"name":"William Smith",
|
||||||
"id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867"
|
"id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867",
|
||||||
|
"email": "william@email.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"tech_contacts":[
|
"tech_contacts":[
|
||||||
{
|
{
|
||||||
"name":"John Smith",
|
"name":"John Smith",
|
||||||
"id":"62015e7d-42c8-4d68-8164-e9b71680fd95"
|
"id":"62015e7d-42c8-4d68-8164-e9b71680fd95",
|
||||||
|
"email": "john@email.com"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"William Smith",
|
"name":"William Smith",
|
||||||
"id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867"
|
"id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867"
|
||||||
|
"email": "william@email.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"transfer_code":"98oiewslkfkd",
|
"transfer_code":"98oiewslkfkd",
|
||||||
|
@ -93,6 +97,10 @@ Content-Type: application/json
|
||||||
},
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
|
"dnssec_keys": [
|
||||||
|
"257 3 13 KlHFYV42UtxC7LpsolDpoUZ9DNPDRYQypalBRIqlubBg/zg78aqciLk+NaWUbrkN7AUaM7h7tx91sLN+ORVPxA==",
|
||||||
|
],
|
||||||
|
"dnssec_changed_at": "2015-09-09T09:11:14.860Z",
|
||||||
"status_notes":{
|
"status_notes":{
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -205,6 +213,10 @@ Content-Type: application/json
|
||||||
},
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
|
"dnssec_keys": [
|
||||||
|
"257 3 13 KlHFYV42UtxC7LpsolDpoUZ9DNPDRYQypalBRIqlubBg/zg78aqciLk+NaWUbrkN7AUaM7h7tx91sLN+ORVPxA==",
|
||||||
|
],
|
||||||
|
"dnssec_changed_at": "2015-09-09T09:11:14.860Z",
|
||||||
"status_notes":{
|
"status_notes":{
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -308,6 +320,10 @@ Content-Type: application/json
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"dnssec_keys": [
|
||||||
|
"257 3 13 KlHFYV42UtxC7LpsolDpoUZ9DNPDRYQypalBRIqlubBg/zg78aqciLk+NaWUbrkN7AUaM7h7tx91sLN+ORVPxA==",
|
||||||
|
],
|
||||||
|
"dnssec_changed_at": "2015-09-09T09:11:14.860Z",
|
||||||
"status_notes":{
|
"status_notes":{
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -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