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, #service

Instance Method Summary collapse

Methods inherited from Model

#inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

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

Methods included from Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

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

Constructor Details

#initialize(attributes = {}) ⇒ Zone

Returns a new instance of Zone.



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

def initialize(attributes={})
  super
end

Instance Method Details

#destroyObject



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

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

#domain=(new_domain) ⇒ Object



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

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

#nameserversObject



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

def nameservers
  raise 'nameservers Not Implemented'
end

#publishObject



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

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

#recordsObject



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

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

#saveObject



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

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