Class: Fog::DNS::Dynect::Zone

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/dynect/models/dns/zone.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Zone

Returns a new instance of Zone.



17
18
19
# File 'lib/fog/dynect/models/dns/zone.rb', line 17

def initialize(attributes={})
  super
end

Instance Method Details

#destroyObject



21
22
23
24
25
# File 'lib/fog/dynect/models/dns/zone.rb', line 21

def destroy
  requires :domain
  service.delete_zone(domain)
  true
end

#domain=(new_domain) ⇒ Object



28
29
30
# File 'lib/fog/dynect/models/dns/zone.rb', line 28

def domain=(new_domain)
  attributes[:domain] = new_domain.split('/').last
end

#nameserversObject



42
43
44
# File 'lib/fog/dynect/models/dns/zone.rb', line 42

def nameservers
  raise 'nameservers Not Implemented'
end

#publishObject



32
33
34
35
36
# File 'lib/fog/dynect/models/dns/zone.rb', line 32

def publish
  requires :identity
  data = service.put_zone(identity, 'publish' => true)
  true
end

#recordsObject



38
39
40
# File 'lib/fog/dynect/models/dns/zone.rb', line 38

def records
  @records ||= Fog::DNS::Dynect::Records.new(:zone => self, :service => service)
end

#saveObject



46
47
48
49
50
51
52
# File 'lib/fog/dynect/models/dns/zone.rb', line 46

def save
  self.ttl ||= 3600
  requires :domain, :email, :ttl
  data = service.post_zone(email, ttl, domain).body['data']
  merge_attributes(data)
  true
end