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

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

Instance Attribute Summary

Attributes inherited from Collection

#service

Instance Method Summary collapse

Methods inherited from Collection

#clear, #create, #destroy, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#all(filter = {}) ⇒ Object



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

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

#get(record_name) ⇒ Object



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

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