Sha256: db27e21314d32a98c23ff373c76706a44fb511f786398cff91ed1dd4dde2374e

Contents?: true

Size: 904 Bytes

Versions: 3

Compression:

Stored size: 904 Bytes

Contents

require 'glare/domain/zone'
require 'glare/domain/record'

module Glare
  class Domain
    def initialize(client)
      @client = client
    end

    def register(fqdn, destinations, type, proxied=false)
      dns_records = Array(destinations).map do |destination|
        DnsRecord.new(type: type, name: fqdn, content: destination, proxied: proxied)
      end

      zone = Zone.new(@client, fqdn)
      Record.register(@client, zone, dns_records)
    end

    def resolve(fqdn, type)
      zone = Zone.new(@client, fqdn)
      records = zone.records(type)
      records.contents
    end

    def deregister(fqdn, type)
      zone = Zone.new(@client, fqdn)
      dns_records = zone.records(type)
      Record.deregister(@client, zone, dns_records)
    end

    def proxied?(fqdn, type)
      zone = Zone.new(@client, fqdn)
      records = zone.records(type)
      records.all_proxied?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
glare-0.9.0 lib/glare/domain.rb
glare-0.8.0 lib/glare/domain.rb
glare-0.7.0 lib/glare/domain.rb