mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 03:06:14 +02:00
Registrant API: Return associated domains for contact query
This commit is contained in:
parent
15e090c3b1
commit
15d2ffe200
4 changed files with 26 additions and 14 deletions
|
@ -1,14 +1,15 @@
|
|||
module Serializers
|
||||
module RegistrantApi
|
||||
class Contact
|
||||
attr_reader :contact
|
||||
attr_reader :contact, :links
|
||||
|
||||
def initialize(contact)
|
||||
def initialize(contact, links)
|
||||
@contact = contact
|
||||
@links = links
|
||||
end
|
||||
|
||||
def to_json
|
||||
{
|
||||
def to_json(_obj = nil)
|
||||
obj = {
|
||||
id: contact.uuid,
|
||||
name: contact.name,
|
||||
code: contact.code,
|
||||
|
@ -31,6 +32,10 @@ module Serializers
|
|||
statuses: contact.statuses,
|
||||
disclosed_attributes: contact.disclosed_attributes,
|
||||
}
|
||||
|
||||
obj[:links] = contact.related_domains if @links
|
||||
|
||||
obj
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -58,7 +58,8 @@ module Serializers
|
|||
valid_to: domain.valid_to, outzone_at: domain.outzone_at, statuses: domain.statuses,
|
||||
registrant_verification_asked_at: domain.registrant_verification_asked_at,
|
||||
registrar: { name: domain.registrar.name, website: domain.registrar.website },
|
||||
registrant: { name: domain.registrant.name, id: domain.registrant.uuid }
|
||||
registrant: { name: domain.registrant.name, id: domain.registrant.uuid,
|
||||
phone: domain.registrant.phone, email: domain.registrant.email }
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue