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

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#inspect, #reload, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

#initialize(attributes = {}) ⇒ Zone

Returns a new instance of Zone.



19
20
21
22
# File 'lib/fog/dynect/models/dns/zone.rb', line 19

def initialize(attributes={})
  self.ttl  ||= 3600
  super
end

Instance Method Details

#destroyObject



24
25
26
27
28
# File 'lib/fog/dynect/models/dns/zone.rb', line 24

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

#domain=(new_domain) ⇒ Object



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

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

#nameserversObject



45
46
47
# File 'lib/fog/dynect/models/dns/zone.rb', line 45

def nameservers
  raise 'nameservers Not Implemented'
end

#publishObject



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

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

#recordsObject



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

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

#saveObject



49
50
51
52
53
54
# File 'lib/fog/dynect/models/dns/zone.rb', line 49

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