Class: Fog::DNS::Dynect::Zone
- Inherits:
-
Model
- Object
- Model
- Fog::DNS::Dynect::Zone
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
#_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
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
#destroy ⇒ Object
24
25
26
27
28
|
# File 'lib/fog/dynect/models/dns/zone.rb', line 24
def destroy
requires :domain
service.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
|
#nameservers ⇒ Object
45
46
47
|
# File 'lib/fog/dynect/models/dns/zone.rb', line 45
def nameservers
raise 'nameservers Not Implemented'
end
|
#publish ⇒ Object
35
36
37
38
39
|
# File 'lib/fog/dynect/models/dns/zone.rb', line 35
def publish
requires :identity
data = service.put_zone(identity, 'publish' => true)
true
end
|
#records ⇒ Object
41
42
43
|
# File 'lib/fog/dynect/models/dns/zone.rb', line 41
def records
@records ||= Fog::DNS::Dynect::Records.new(:zone => self, :service => service)
end
|
#save ⇒ Object
49
50
51
52
53
54
|
# File 'lib/fog/dynect/models/dns/zone.rb', line 49
def save
requires :domain, :email, :ttl
data = service.post_zone(email, ttl, domain).body['data']
merge_attributes(data)
true
end
|