Class: Glare::Domain

Inherits:
Object
  • Object
show all
Defined in:
lib/glare/domain.rb

Defined Under Namespace

Classes: Record, Zone

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Domain

Returns a new instance of Domain.



90
91
92
# File 'lib/glare/domain.rb', line 90

def initialize(client)
  @client = client
end

Instance Method Details

#deregister(fqdn, type) ⇒ Object



109
110
111
112
113
# File 'lib/glare/domain.rb', line 109

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

#register(fqdn, destinations, type) ⇒ Object



94
95
96
97
98
99
100
101
# File 'lib/glare/domain.rb', line 94

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

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

#resolve(fqdn, type) ⇒ Object



103
104
105
106
107
# File 'lib/glare/domain.rb', line 103

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