Sha256: baf83b6ec00d1b1d242b5e975c96f4b1cb410bcef70f2c2d4bdd504e6d332531

Contents?: true

Size: 980 Bytes

Versions: 35

Compression:

Stored size: 980 Bytes

Contents

require 'fog/core/collection'
require 'fog/zerigo/models/dns/record'

module Fog
  module DNS
    class Zerigo

      class Records < Fog::Collection

        attribute :zone

        model Fog::DNS::Zerigo::Record

        def all
          requires :zone
          parent = zone.collection.get(zone.identity)
          if parent
            merge_attributes(parent.records.attributes)
            load(parent.records.map {|record| record.attributes})
          else
            nil
          end
        end

        def get(record_id)
          data = connection.get_host(record_id).body
          new(data)
        rescue Fog::Service::NotFound
          nil
        end

        def new(attributes = {})
          requires :zone
          super({ :zone => zone }.merge!(attributes))
        end

        def find(fqdn)
          hosts = connection.find_hosts(fqdn, zone.id).body['hosts']
          hosts.collect { |host| new(host) }
        end

      end

    end
  end
end

Version data entries

35 entries across 35 versions & 13 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/zerigo/models/dns/records.rb
fog-nirvanix-1.8.1 lib/fog/zerigo/models/dns/records.rb
fog-parser-fix-1.6.1 lib/fog/zerigo/models/dns/records.rb
fog-test-again-1.6.0 lib/fog/zerigo/models/dns/records.rb
fog-parser-fix-1.6.0 lib/fog/zerigo/models/dns/records.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/zerigo/models/dns/records.rb
fog-sgonyea-1.8.1 lib/fog/zerigo/models/dns/records.rb
fog-1.8.0 lib/fog/zerigo/models/dns/records.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/zerigo/models/dns/records.rb
fog-1.7.0 lib/fog/zerigo/models/dns/records.rb
fog-1.6.0 lib/fog/zerigo/models/dns/records.rb
fog-1.5.0 lib/fog/zerigo/models/dns/records.rb
fog-1.4.0 lib/fog/zerigo/models/dns/records.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/zerigo/models/dns/records.rb
michiels-fog-1.3.1 lib/fog/zerigo/models/dns/records.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/zerigo/models/dns/records.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/zerigo/models/dns/records.rb
fog-1.3.1 lib/fog/zerigo/models/dns/records.rb
fog-1.3.0 lib/fog/zerigo/models/dns/records.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/zerigo/models/dns/records.rb