Class: Gandi::Domain::Zone
- Inherits:
-
Object
- Object
- Gandi::Domain::Zone
- Includes:
- GandiObjectMethods
- Defined in:
- lib/gandi/domain/zone.rb,
lib/gandi/domain/zone/record.rb,
lib/gandi/domain/zone/version.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
The zone_id of the Zone.
Class Method Summary collapse
-
.clone(zone_id, version_id = 0, params = {}) ⇒ Object
Clone a zone and its records from a given version.
-
.count(opts = {}) ⇒ Object
Count the zones.
-
.create(params) ⇒ Object
Create a zone.
-
.delete(zone_id) ⇒ Object
Deletes a zone if not linked to any domain Warning: this also deletes all versions and records.
-
.find(zone_id) ⇒ Object
Return the zone identified by its zone_id.
-
.info(zone_id) ⇒ Object
Fetch the zone information for the zone identified by its zone_id.
-
.list(opts = {}) ⇒ Object
List zones.
-
.set(domain, zone_id) ⇒ Object
Change the current zone of a domain.
-
.update(zone_id, params) ⇒ Object
Update an existing zone.
Instance Method Summary collapse
-
#clone(version_id = 0, params = {}) ⇒ Object
Clone a zone and its records from a given version.
-
#delete ⇒ Object
Delete the zone.
-
#initialize(attributes) ⇒ Zone
constructor
A new instance of Zone.
-
#update(params) ⇒ Object
Update a zone.
Methods included from GandiObjectMethods
#[], included, #inspect, #to_hash
Constructor Details
#initialize(attributes) ⇒ Zone
Returns a new instance of Zone.
12 13 14 |
# File 'lib/gandi/domain/zone.rb', line 12 def initialize(attributes) set_attributes attributes end |
Instance Attribute Details
#id ⇒ Object (readonly)
The zone_id of the Zone
10 11 12 |
# File 'lib/gandi/domain/zone.rb', line 10 def id @id end |
Class Method Details
.clone(zone_id, version_id = 0, params = {}) ⇒ Object
Clone a zone and its records from a given version. This create a new zone that will only contain this version. Note that cloned records will have new identifiers. Return a hash with the new zone information.
68 69 70 |
# File 'lib/gandi/domain/zone.rb', line 68 def clone(zone_id, version_id = 0, params = {}) call('domain.zone.clone', zone_id, version_id, params) end |
.count(opts = {}) ⇒ Object
Count the zones.
54 55 56 |
# File 'lib/gandi/domain/zone.rb', line 54 def count(opts = {}) call('domain.zone.count', opts) end |
.create(params) ⇒ Object
Create a zone. Return a Gandi::Domain::Zone object.
38 39 40 |
# File 'lib/gandi/domain/zone.rb', line 38 def create(params) new(call('domain.zone.create', params)) end |
.delete(zone_id) ⇒ Object
Deletes a zone if not linked to any domain Warning: this also deletes all versions and records. Return true.
75 76 77 |
# File 'lib/gandi/domain/zone.rb', line 75 def delete(zone_id) call('domain.zone.delete', zone_id) end |
.find(zone_id) ⇒ Object
Return the zone identified by its zone_id
43 44 45 |
# File 'lib/gandi/domain/zone.rb', line 43 def find(zone_id) new(call('domain.zone.info', zone_id)) end |
.info(zone_id) ⇒ Object
Fetch the zone information for the zone identified by its zone_id. Return a hash.
49 50 51 |
# File 'lib/gandi/domain/zone.rb', line 49 def info(zone_id) call('domain.zone.info', zone_id) end |
.list(opts = {}) ⇒ Object
List zones. Return an array of hashes.
60 61 62 |
# File 'lib/gandi/domain/zone.rb', line 60 def list(opts = {}) call('domain.zone.list', opts) end |
.set(domain, zone_id) ⇒ Object
Change the current zone of a domain. Return a hash with the modified domain
81 82 83 |
# File 'lib/gandi/domain/zone.rb', line 81 def set(domain, zone_id) call('domain.zone.set', domain, zone_id) end |
.update(zone_id, params) ⇒ Object
Update an existing zone. Return the updated information hash.
87 88 89 |
# File 'lib/gandi/domain/zone.rb', line 87 def update(zone_id, params) call('domain.zone.update', zone_id, params) end |
Instance Method Details
#clone(version_id = 0, params = {}) ⇒ Object
Clone a zone and its records from a given version. Return the created Gandi::Domain::Zone object.
18 19 20 |
# File 'lib/gandi/domain/zone.rb', line 18 def clone(version_id = 0, params = {}) self.class.new(self.class.clone(@id, version_id, params)) end |
#delete ⇒ Object
Delete the zone. Return true.
24 25 26 |
# File 'lib/gandi/domain/zone.rb', line 24 def delete self.class.delete(@id) end |
#update(params) ⇒ Object
Update a zone. Return self.
30 31 32 33 |
# File 'lib/gandi/domain/zone.rb', line 30 def update(params) set_attributes self.class.update(@id, params) self end |