Class: Fog::DNS::Dreamhost::Records

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

Instance Method Summary collapse

Instance Method Details

#all(filter = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/fog/dreamhost/models/dns/records.rb', line 10

def all(filter = {})
  clear
  if filter[:zone]
    data = service.list_records.body['data'].select { |r| r['zone'] == filter[:zone] }
  else
    data = service.list_records.body['data']
  end
  load(data)
end

#get(record_name) ⇒ Object



20
21
22
23
24
25
# File 'lib/fog/dreamhost/models/dns/records.rb', line 20

def get(record_name)
  data = service.list_records.body['data'].find { |r| r['record'] == record_name }
  new(data)
rescue Excon::Errors::NotFound
  nil
end