Create Whois Records for subzones

This commit is contained in:
Karl Erik Õunapuu 2020-08-13 12:36:42 +03:00
parent 21d246cc3e
commit 7953b3f8df
2 changed files with 73 additions and 1 deletions

View file

@ -8,10 +8,11 @@ class UpdateWhoisRecordJob < Que::Job
when 'blocked' then BlockedDomain
when 'domain' then Domain
when 'disputed' then Dispute.active
when 'zone' then DNS::Zone
end
Array(names).each do |name|
record = klass.find_by(name: name)
record = klass == DNS::Zone ? klass.find_by(origin: name) : klass.find_by(name: name)
if record
send "update_#{type}", record
else
@ -36,6 +37,10 @@ class UpdateWhoisRecordJob < Que::Job
update_reserved(record)
end
def update_zone(record)
update_reserved(record)
end
# 1. deleting own
# 2. trying to regenerate reserved in order domain is still in the list
def delete_domain(name)
@ -60,6 +65,10 @@ class UpdateWhoisRecordJob < Que::Job
remove_status_from_whois(domain_name: name, domain_status: 'disputed')
end
def delete_zone(name)
WhoisRecord.where(name: name).destroy_all
end
def remove_status_from_whois(domain_name:, domain_status:)
Whois::Record.where(name: domain_name).each do |r|
r.json['status'] = r.json['status'].delete_if { |status| status == domain_status }