Class: Fog::DNS::Dreamhost::Zones

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/dreamhost/models/dns/zones.rb

Overview

Dreamhost API has no concept of ‘Zone’, but we can emulate it.

wiki.dreamhost.com/API/Dns_commands

Instance Method Summary collapse

Instance Method Details

#allObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/dreamhost/models/dns/zones.rb', line 16

def all
  clear
  zones = []
  zones_added = []
  service.records.each do |r|
    unless zones_added.include?(r.zone)
      zones << { :id => r.zone, :domain => r.zone }
      zones_added << r.zone
    end
  end
  load(zones)
end

#get(zone_id) ⇒ Object



29
30
31
32
33
# File 'lib/fog/dreamhost/models/dns/zones.rb', line 29

def get(zone_id)
  service.zones.find { |z| z.domain == zone_id }
rescue Excon::Errors::NotFound
  nil
end