Sha256: af7dab504c19e78ce7be77822cc9b286fc2e5b0c8da77cb398a1fe10f2628c83

Contents?: true

Size: 830 Bytes

Versions: 7

Compression:

Stored size: 830 Bytes

Contents

require 'fog/core/collection'
require 'fog/dns/models/zerigo/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

7 entries across 7 versions & 3 rubygems

Version Path
brightbox-cli-0.13.1 lib/brightbox-cli/vendor/fog/lib/fog/dns/models/zerigo/records.rb
brightbox-cli-0.13.0 lib/brightbox-cli/vendor/fog/lib/fog/dns/models/zerigo/records.rb
fog-0.11.0 lib/fog/dns/models/zerigo/records.rb
fog-0.10.0 lib/fog/dns/models/zerigo/records.rb
fog4encbs-0.9.0.1 lib/fog/dns/models/zerigo/records.rb
fog4encbs-0.9.0 lib/fog/dns/models/zerigo/records.rb
fog-0.9.0 lib/fog/dns/models/zerigo/records.rb