Class: ZerigoDNS::Zone
- Includes:
- Resource
- Defined in:
- lib/zerigodns/zone.rb
Constant Summary
Constants inherited from Client
Client::ACTIONS, Client::ResponseError
Instance Attribute Summary
Attributes inherited from Client
Class Method Summary collapse
-
.count ⇒ Fixnum
Get count of all zones.
-
.find_by_domain(domain) ⇒ Zone
Find zone by domain name.
-
.find_or_create(domain) ⇒ Zone
Find or Create Zone.
Instance Method Summary collapse
-
#count_hosts ⇒ Fixnum
Get count of all hosts belonging to this zone.
Methods included from Resource
Methods inherited from Client
Class Method Details
.count ⇒ Fixnum
Get count of all zones
8 9 10 |
# File 'lib/zerigodns/zone.rb', line 8 def count get('zones/count.xml').body['count'].to_i end |
.find_by_domain(domain) ⇒ Zone
Find zone by domain name
16 17 18 |
# File 'lib/zerigodns/zone.rb', line 16 def find_by_domain(domain) find(domain) end |
.find_or_create(domain) ⇒ Zone
Find or Create Zone
23 24 25 26 27 28 |
# File 'lib/zerigodns/zone.rb', line 23 def find_or_create(domain) find_by_domain(domain) rescue ZerigoDNS::Client::ResponseError => e raise unless e.response.code.not_found? create(:domain=> domain, :ns_type=>'pri_sec') end |
Instance Method Details
#count_hosts ⇒ Fixnum
Get count of all hosts belonging to this zone
33 34 35 |
# File 'lib/zerigodns/zone.rb', line 33 def count_hosts get("zones/#{id}/hosts/count.xml").body['count'].to_i end |