Class: Zerigo::DNS::Zone

Inherits:
Base
  • Object
show all
Defined in:
lib/zerigo_dns.rb

Class Method Summary collapse

Methods inherited from Base

api_key=, #load

Class Method Details

.find_by_domain(domain) ⇒ Object

Find by domain



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/zerigo_dns.rb', line 59

def self.find_by_domain(domain)
  zones = find(:all) 
  zone = nil
  zones.each do |z|
    if z.domain == domain
      zone = z
      break;
    end
  end
  zone
end

.find_or_create(domain) ⇒ Object

Find or Create Zone



73
74
75
76
77
78
79
# File 'lib/zerigo_dns.rb', line 73

def self.find_or_create(domain)
  zone = find_by_domain(domain)
  unless zone
    zone = create(:domain=> domain, :ns_type=>'pri_sec')
  end  
  zone
end