mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 08:52:04 +02:00
Merge remote-tracking branch 'origin/master' into repp-domains
This commit is contained in:
commit
221e4ba578
140 changed files with 2575 additions and 731 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
|
||||
|
|
|
@ -3,11 +3,14 @@ module Serializers
|
|||
class Domain
|
||||
attr_reader :domain
|
||||
|
||||
def initialize(domain)
|
||||
def initialize(domain, simplify: false)
|
||||
@domain = domain
|
||||
@simplify = simplify
|
||||
end
|
||||
|
||||
def to_json
|
||||
def to_json(_obj = nil)
|
||||
return simple_object if @simplify
|
||||
|
||||
{
|
||||
id: domain.uuid,
|
||||
name: domain.name,
|
||||
|
@ -49,6 +52,17 @@ module Serializers
|
|||
|
||||
private
|
||||
|
||||
def simple_object
|
||||
{
|
||||
id: domain.uuid, name: domain.name, registered_at: domain.registered_at,
|
||||
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,
|
||||
phone: domain.registrant.phone, email: domain.registrant.email }
|
||||
}
|
||||
end
|
||||
|
||||
def dnssec_keys
|
||||
domain.dnskeys.map do |key|
|
||||
"#{key.flags} #{key.protocol} #{key.alg} #{key.public_key}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue