Sha256: bca12c2b271e06ea1a8f0374071ec276398630c810ce3c3aa8e6f8e6189c4d32

Contents?: true

Size: 830 Bytes

Versions: 3

Compression:

Stored size: 830 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

      end

    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/lib/fog/zerigo/models/dns/records.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/lib/fog/zerigo/models/dns/records.rb
fog-1.0.0 lib/fog/zerigo/models/dns/records.rb