Class: Fog::DNS::Zerigo::Zone
- Inherits:
-
Model
- Object
- Model
- Fog::DNS::Zerigo::Zone
show all
- Defined in:
- lib/fog/zerigo/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
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#connection, #connection=, #prepare_service_value
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
#initialize(attributes = {}) ⇒ Zone
28
29
30
31
|
# File 'lib/fog/zerigo/models/dns/zone.rb', line 28
def initialize(attributes={})
self.type ||= 'pri_sec'
super
end
|
Instance Method Details
#destroy ⇒ Object
33
34
35
36
37
|
# File 'lib/fog/zerigo/models/dns/zone.rb', line 33
def destroy
requires :identity
service.delete_zone(identity)
true
end
|
#nameservers ⇒ Object
48
49
50
51
52
53
54
55
56
|
# File 'lib/fog/zerigo/models/dns/zone.rb', line 48
def nameservers
[
'a.ns.zerigo.net',
'b.ns.zerigo.net',
'c.ns.zerigo.net',
'd.ns.zerigo.net',
'e.ns.zerigo.net'
]
end
|
#records ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'lib/fog/zerigo/models/dns/zone.rb', line 39
def records
@records ||= begin
Fog::DNS::Zerigo::Records.new(
:zone => self,
:service => service
)
end
end
|
#save ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/fog/zerigo/models/dns/zone.rb', line 58
def save
self.ttl ||= 3600
requires :domain, :type, :ttl
options = {}
data = unless identity
service.create_zone(domain, ttl, type, options)
else
options[:default_ttl] = ttl
options[:ns_type] = type
service.update_zone(identity, options)
end
merge_attributes(data.body)
true
end
|