Class: Fog::DNS::Dynect::Records
- Inherits:
-
Collection
- Object
- Collection
- Fog::DNS::Dynect::Records
- Defined in:
- lib/fog/dynect/models/dns/records.rb
Instance Method Summary collapse
Instance Method Details
#all(options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fog/dynect/models/dns/records.rb', line 14 def all( = {}) requires :zone data = [] service.get_all_records(zone.domain, ).body['data'].each do |url| (_, _, t, _, fqdn, id) = url.split('/') type = t.gsub(/Record$/, '') # leave out the default, read only records # by putting this here we don't make the secondary request for these records next if ['NS', 'SOA'].include?(type) record = service.get_record(type, zone.domain, fqdn, 'record_id' => id).body['data'] data << { :identity => record['record_id'], :fqdn => record['fqdn'], :type => record['record_type'], :rdata => record['rdata'] } end load(data) end |
#get(record_id) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fog/dynect/models/dns/records.rb', line 38 def get(record_id) requires :zone list = service.get_all_records(zone.domain, {}).body['data'] url = list.detect { |e| e =~ /\/#{record_id}$/ } return unless url (_, _, t, _, fqdn, id) = url.split('/') type = t.gsub(/Record$/, '') record = service.get_record(type, zone.domain, fqdn, 'record_id' => id).body['data'] new({ :identity => record['record_id'], :fqdn => record['fqdn'], :type => record['record_type'], :rdata => record['rdata'] }) end |
#new(attributes = {}) ⇒ Object
56 57 58 59 |
# File 'lib/fog/dynect/models/dns/records.rb', line 56 def new(attributes = {}) requires :zone super({:zone => zone}.merge!(attributes)) end |