Skip to content

Commit

Permalink
Fix CC issue
Browse files Browse the repository at this point in the history
  • Loading branch information
karlerikounapuu committed Dec 1, 2020
1 parent c9d4aad commit 15e090c
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions lib/serializers/registrant_api/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,8 @@ def initialize(domain, simplify: false)
@simplify = simplify
end

def to_json
if @simplify
return {
id: domain.uuid,
name: domain.name,
registered_at: domain.registered_at,
valid_to: domain.valid_to,
outzone_at: domain.outzone_at,
registrant_verification_asked_at: domain.registrant_verification_asked_at,
statuses: domain.statuses,
registrar: {
name: domain.registrar.name,
website: domain.registrar.website,
},
registrant: {
name: domain.registrant.name,
id: domain.registrant.uuid,
},
}
end
def to_json(_obj = nil)
return simple_object if @simplify

{
id: domain.uuid,
Expand Down Expand Up @@ -70,6 +52,16 @@ def to_json

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 }
}
end

def dnssec_keys
domain.dnskeys.map do |key|
"#{key.flags} #{key.protocol} #{key.alg} #{key.public_key}"
Expand Down

0 comments on commit 15e090c

Please sign in to comment.