Class: Fog::DNS::Zerigo::Records

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) all(options = {})

List all domains

Parameters:

  • options (Hash) (defaults to: {})

    Options to pass to the underlying API call

Options Hash (options):

  • :fqdn (String)

    search for the given fqdn



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fog/zerigo/models/dns/records.rb', line 17

def all(options = {})
  requires :zone
  if options[:fqdn]
    hosts = service.find_hosts(options[:fqdn], zone.id).body['hosts']
    load(hosts)
  else
    parent = zone.collection.get(zone.identity)
    if parent
      merge_attributes(parent.records.attributes)
      load(parent.records.map {|record| record.attributes})
    else
      nil
    end
  end
end

- (Object) get(record_id)



33
34
35
36
37
38
# File 'lib/fog/zerigo/models/dns/records.rb', line 33

def get(record_id)
  data = service.get_host(record_id).body
  new(data)
rescue Fog::Service::NotFound
  nil
end

- (Object) new(attributes = {})



40
41
42
43
# File 'lib/fog/zerigo/models/dns/records.rb', line 40

def new(attributes = {})
  requires :zone
  super({ :zone => zone }.merge!(attributes))
end