Class: BarnyardDns::DnsObject

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ DnsObject

Returns a new instance of DnsObject.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/barnyard_dns.rb', line 13

def initialize(args)

  @began_at = Time.now

  @debug = args.fetch(:debug) { false }
  @log = args.fetch(:logger) { Logger.new(STDOUT) }

  @zone = args.fetch(:zone) { raise "You must provide the :zone to transfer." }

  @log.debug JSON.pretty_generate(args)

  @synchronizer = BarnyardHarvester::Sync.new(args)

  @synchronizer.run do

    zt = Dnsruby::ZoneTransfer.new
    zt.transfer_type = Dnsruby::Types.AXFR
    zone = zt.transfer(@zone)

    next if zone.nil?

    zone.each do |rec|

      @synchronizer.process rec.name, rec

    end

  end

  @log.info @synchronizer.stats

end

Instance Attribute Details

#began_atObject (readonly)

Returns the value of attribute began_at.



11
12
13
# File 'lib/barnyard_dns.rb', line 11

def began_at
  @began_at
end

#ended_atObject (readonly)

Returns the value of attribute ended_at.



11
12
13
# File 'lib/barnyard_dns.rb', line 11

def ended_at
  @ended_at
end

#synchronizerObject (readonly)

Returns the value of attribute synchronizer.



11
12
13
# File 'lib/barnyard_dns.rb', line 11

def synchronizer
  @synchronizer
end