mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 02:35:57 +02:00
Merge branch 'master' of https://github.com/internetee/registry into 1857-covered-registry-by-tests
This commit is contained in:
commit
ad391e1b8c
13 changed files with 207 additions and 24 deletions
|
@ -42,17 +42,12 @@ class Epp::Contact < Contact
|
|||
)
|
||||
end
|
||||
|
||||
def check_availability(codes)
|
||||
def check_availability(codes, reg:)
|
||||
codes = [codes] if codes.is_a?(String)
|
||||
|
||||
res = []
|
||||
codes.each do |x|
|
||||
contact = find_by_epp_code(x)
|
||||
if contact
|
||||
res << { code: contact.code, avail: 0, reason: 'in use' }
|
||||
else
|
||||
res << { code: x, avail: 1 }
|
||||
end
|
||||
codes.map { |c| c.include?(':') ? c : "#{reg}:#{c}" }.map { |c| c.strip.upcase }.each do |x|
|
||||
c = find_by_epp_code(x)
|
||||
res << (c ? { code: c.code, avail: 0, reason: 'in use' } : { code: x, avail: 1 })
|
||||
end
|
||||
|
||||
res
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue