mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 01:11:43 +02:00
Nameserver removing with domain update request
This commit is contained in:
parent
c0d25ccedf
commit
87cc7799be
9 changed files with 87 additions and 16 deletions
|
@ -49,7 +49,7 @@ class Domain < ActiveRecord::Base
|
|||
write_attribute(:name_dirty, value)
|
||||
end
|
||||
|
||||
### CREATE ###
|
||||
### CREATE & UPDATE ###
|
||||
|
||||
def attach_objects(ph, parsed_frame)
|
||||
attach_owner_contact(ph[:registrant]) if ph[:registrant]
|
||||
|
@ -60,6 +60,10 @@ class Domain < ActiveRecord::Base
|
|||
errors.empty?
|
||||
end
|
||||
|
||||
def detach_objects(ph, parsed_frame)
|
||||
detach_nameservers(self.class.parse_nameservers_from_frame(parsed_frame))
|
||||
end
|
||||
|
||||
def attach_owner_contact(code)
|
||||
self.owner_contact = Contact.find_by(code: code)
|
||||
|
||||
|
@ -116,6 +120,15 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def detach_nameservers(ns_list)
|
||||
to_delete = []
|
||||
ns_list.each do |ns_attrs|
|
||||
to_delete << self.nameservers.where(ns_attrs)
|
||||
end
|
||||
|
||||
self.nameservers.delete(to_delete)
|
||||
end
|
||||
|
||||
### RENEW ###
|
||||
|
||||
def renew(cur_exp_date, period, unit='y')
|
||||
|
@ -255,7 +268,6 @@ class Domain < ActiveRecord::Base
|
|||
description: x.text
|
||||
}
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
|
||||
|
@ -275,7 +287,7 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
if Domain.find_by(name: x)
|
||||
res << {name: x, avail: 0, reason: 'in use'} #confirm reason with current API
|
||||
res << {name: x, avail: 0, reason: 'in use'}
|
||||
else
|
||||
res << {name: x, avail: 1}
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue