mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 09:45:11 +02:00
Merge branch '111297422-whois_blocked_domains' into staging
This commit is contained in:
commit
2f4d89995b
5 changed files with 36 additions and 7 deletions
16
app/jobs/update_whois_record_job.rb
Normal file
16
app/jobs/update_whois_record_job.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
class UpdateWhoisRecordJob < Que::Job
|
||||
|
||||
def run(ids, type)
|
||||
klass = case type
|
||||
when 'reserved'then ReservedDomain
|
||||
when 'blocked' then BlockedDomain
|
||||
else Domain
|
||||
end
|
||||
|
||||
ids.each do |id|
|
||||
record = klass.find_by(id: id)
|
||||
next unless record
|
||||
record.update_whois_record
|
||||
end
|
||||
end
|
||||
end
|
|
@ -24,6 +24,8 @@ class BlockedDomain < ActiveRecord::Base
|
|||
update_whois_server
|
||||
end
|
||||
|
||||
alias_method :update_whois_record, :generate_data
|
||||
|
||||
def update_whois_server
|
||||
wr = Whois::Record.find_or_initialize_by(name: name)
|
||||
wr.body = @body
|
||||
|
|
|
@ -35,6 +35,8 @@ class ReservedDomain < ActiveRecord::Base
|
|||
update_whois_server
|
||||
end
|
||||
|
||||
alias_method :update_whois_record, :generate_data
|
||||
|
||||
def update_whois_server
|
||||
wr = Whois::Record.find_or_initialize_by(name: name)
|
||||
wr.body = @body
|
||||
|
|
|
@ -106,7 +106,7 @@ class WhoisRecord < ActiveRecord::Base
|
|||
self.json = generated_json
|
||||
self.body = generated_body
|
||||
self.name = json['name']
|
||||
self.registrar_id = domain.registrar_id # for faster registrar updates
|
||||
self.registrar_id = domain.registrar_id if domain # for faster registrar updates
|
||||
end
|
||||
|
||||
def update_whois_server
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue