internetee-registry/app/services/contact_notification.rb
2022-02-09 15:15:08 +02:00

24 lines
671 B
Ruby

module ContactNotification
extend self
def notify_registrar(domain:, text:)
domain.registrar.notifications.create(text: text)
end
def notify_tech_contact(domain:, nameserver: nil, reason: nil)
case reason
when 'dnssec'
domain.tech_contacts.each do |tech|
contact = Contact.find(tech.id)
ContactInformMailer.notify_dnssec(contact: contact, domain: domain).deliver_now
end
when 'nameserver'
domain.tech_contacts.each do |tech|
contact = Contact.find(tech.id)
ContactInformMailer.notify_nameserver(contact: contact, domain: domain, nameserver: nameserver).deliver_now
end
end
end
end