Class: Fog::DNS::Zerigo::Records
- Inherits:
-
Collection
- Object
- Array
- Collection
- Fog::DNS::Zerigo::Records
- Defined in:
- lib/fog/zerigo/models/dns/records.rb
Instance Attribute Summary
Attributes inherited from Collection
Instance Method Summary collapse
-
#all(options = {}) ⇒ Object
List all domains.
- #get(record_id) ⇒ Object
- #new(attributes = {}) ⇒ Object
Methods inherited from Collection
#clear, #create, #destroy, #initialize, #inspect, #load, model, #model, #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(options = {}) ⇒ Object
List all domains
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( = {}) 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
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 |
#new(attributes = {}) ⇒ Object
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 |