Class: Fog::DNS::Zerigo::Records
- Inherits:
-
Collection
- Object
- Collection
- Fog::DNS::Zerigo::Records
- Defined in:
- lib/fog/zerigo/models/dns/records.rb
Instance Method Summary collapse
-
#all(options = {}) ⇒ Object
List all domains.
- #get(record_id) ⇒ Object
- #new(attributes = {}) ⇒ Object
Instance Method Details
#all(options = {}) ⇒ Object
List all domains
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fog/zerigo/models/dns/records.rb', line 15 def all( = {}) requires :zone if [:fqdn] hosts = service.find_hosts([: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 |
#get(record_id) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/fog/zerigo/models/dns/records.rb', line 31 def get(record_id) data = service.get_host(record_id).body new(data) rescue Fog::Service::NotFound nil end |
#new(attributes = {}) ⇒ Object
38 39 40 41 |
# File 'lib/fog/zerigo/models/dns/records.rb', line 38 def new(attributes = {}) requires :zone super({ :zone => zone }.merge!(attributes)) end |