mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 09:46:09 +02:00
fixes after review
This commit is contained in:
parent
8365bede3f
commit
c1a35cb468
1 changed files with 8 additions and 8 deletions
|
@ -8,12 +8,12 @@ module Whois
|
|||
def execute
|
||||
::PaperTrail.request.whodunnit = "job - #{self.class.name} - #{type}"
|
||||
|
||||
klass = determine_class
|
||||
collection = determine_collection
|
||||
|
||||
Array(names).each do |name|
|
||||
record = find_record(klass, name)
|
||||
record = find_record(collection, name)
|
||||
if record
|
||||
Whois::UpdateRecord.run(record: { klass: klass.to_s, id: record.id, type: type })
|
||||
Whois::UpdateRecord.run(record: { klass: collection.to_s, id: record.id, type: type })
|
||||
else
|
||||
Whois::DeleteRecord.run(name: name, type: type)
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ module Whois
|
|||
|
||||
private
|
||||
|
||||
def determine_class
|
||||
def determine_collection
|
||||
case type
|
||||
when 'reserved' then ReservedDomain
|
||||
when 'blocked' then BlockedDomain
|
||||
|
@ -32,11 +32,11 @@ module Whois
|
|||
end
|
||||
end
|
||||
|
||||
def find_record(klass, name)
|
||||
if klass == Dispute.active
|
||||
klass.find_by(domain_name: name)
|
||||
def find_record(collection, name)
|
||||
if collection == Dispute.active
|
||||
collection.find_by(domain_name: name)
|
||||
else
|
||||
klass == DNS::Zone ? klass.find_by(origin: name) : klass.find_by(name: name)
|
||||
collection == DNS::Zone ? collection.find_by(origin: name) : collection.find_by(name: name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue