REPP: Domain info for not-sponsoring registrars

This commit is contained in:
Karl Erik Õunapuu 2021-03-23 12:04:03 +02:00
parent 265e135cd0
commit 016c5e802c
No known key found for this signature in database
GPG key ID: C9DD647298A34764
2 changed files with 14 additions and 6 deletions

View file

@ -3,8 +3,9 @@ module Serializers
class Domain
attr_reader :domain
def initialize(domain)
def initialize(domain, sponsored: true)
@domain = domain
@sponsored = sponsored
end
def to_json(obj = domain)
@ -12,10 +13,10 @@ module Serializers
name: obj.name, registrant: obj.registrant.code, created_at: obj.created_at,
updated_at: obj.updated_at, expire_time: obj.expire_time, outzone_at: obj.outzone_at,
delete_date: obj.delete_date, force_delete_date: obj.force_delete_date,
transfer_code: obj.auth_info, contacts: contacts, nameservers: nameservers,
dnssec_keys: dnssec_keys, statuses: obj.statuses
contacts: contacts, nameservers: nameservers, dnssec_keys: dnssec_keys,
statuses: obj.statuses, registrar: registrar
}
json[:transfer_code] = obj.auth_info if @sponsored
json
end
@ -33,6 +34,10 @@ module Serializers
public_key: nssec.public_key }
end
end
def registrar
{ name: domain.registrar.name, website: domain.registrar.website }
end
end
end
end